---
title: API quickstart
description: Make your first call to the public Invictus API, and learn the conventions every response follows - pool paths, amounts, value states, paging, errors and rate limits.
icon: terminal
---

The public Invictus API serves the same market data the terminal shows: pools, tokens, prices, candles, liquidity
depth, analytics and quotes. It is read only, needs no key and returns JSON.

| | |
| --- | --- |
| **Base URL** | `https://api.lpinvictus.com` (every path starts with `/v1`) |
| **Authentication** | None for the public routes |
| **Format** | JSON; errors as `application/problem+json` |
| **Specification** | OpenAPI 3.1 at [`/api/openapi.json`](/api/openapi.json) |
| **Reference** | One page per route under [API](/api), with a **Try it** panel |

:::note[Calling from a web page]
The API answers browsers only from the Invictus app's own origin. Call it from a server, a script or an agent, not from
JavaScript in your own website.
:::

## Your first call

List the five deepest pools on Base, ranked by TVL:

**curl**

```bash
curl "https://api.lpinvictus.com/v1/pools?chain=base&sort=tvl&limit=5"
```

**TypeScript**

```ts
const url = new URL("https://api.lpinvictus.com/v1/pools");
url.search = new URLSearchParams({ chain: "base", sort: "tvl", limit: "5" }).toString();

const response = await fetch(url);
if (!response.ok) throw new Error((await response.json()).detail);
const page = await response.json();
for (const pool of page.items) {
  const tvl = pool.tvlUsd.status === "unavailable" ? "not available" : pool.tvlUsd.value;
  console.log(`${pool.base.symbol}/${pool.quote.symbol}`, tvl);
}
```

**Python**

```python
import requests

response = requests.get(
    "https://api.lpinvictus.com/v1/pools",
    params={"chain": "base", "sort": "tvl", "limit": 5},
    timeout=10,
)
response.raise_for_status()
for pool in response.json()["items"]:
    tvl = pool["tvlUsd"].get("value", "not available")
    print(f'{pool["base"]["symbol"]}/{pool["quote"]["symbol"]}', tvl)
```

## Conventions

### Chains are slugs

A chain is one of `solana`, `ethereum`, `base`, `robinhood`, `bsc`, `arc` or `hyperevm`.

### A pool has a five-part path

Every pool is identified by five parts, which form its path:

```text
/v1/pools/{chain}/{protocol}/{variant}/{deployment}/{poolKey}
```

| Part | Example | Meaning |
| --- | --- | --- |
| `chain` | `base` | The chain slug |
| `protocol` | `uniswap` | The protocol |
| `variant` | `v3` | The protocol version or pool type |
| `deployment` | `base` | Which deployment of that version on the chain |
| `poolKey` | `0x4c36…4b18` | The pool's address, id or Solana account |

Each pool in a list or search result carries its `identity` with these five parts (`poolKey` as `{ kind, value }`; use
`value` in the path). Build paths from it rather than by hand. Detail, candles, depth, analytics, stats and quotes all
hang off this path.

### Amounts are integers in base units

A token amount is a string of the integer number of its smallest units, next to the token's `decimals`. To show it,
divide by 10 to the power of `decimals`: `"1500000"` of USDC (6 decimals) is 1.5 USDC. Send amounts the same way. Never
use floating-point numbers for money.

Prices, USD values and percents are decimal strings, such as `"3021.55"`.

### Every value says how sure it is

A figure that can be missing or uncertain comes as an object with a `status`:

| `status` | Meaning | Has `value` |
| --- | --- | --- |
| `exact` | Current, from a trusted read | Yes |
| `stale` | Older than its freshness bound; check `observedAt` | Yes |
| `provisional` | Rests on one source, not yet confirmed; see `source` | Yes |
| `disputed` | Two sources disagree | No; `values` holds both, each with its `source` |
| `unavailable` | No reliable value, with a reason | No |

```json
{ "status": "exact", "value": "1834221.07", "observedAt": 1793145600 }
```

Show `unavailable` as unknown, never as zero. An agent should say "not available" rather than guess.

### Lists are paged with a cursor

List routes return `items` and `nextCursor`. Pass `cursor=<nextCursor>` to get the next page; `null` means the last
page. `limit` sets the page size within the bounds in the reference.

### Times are Unix seconds

Timestamps such as `asOf` and `observedAt` are whole seconds since 1970, in UTC.

## Errors

Every error follows [RFC 9457](https://www.rfc-editor.org/rfc/rfc9457) problem details:

```json
{
  "type": "about:blank",
  "title": "Invalid input",
  "status": 400,
  "code": "invalid_input",
  "errors": [
    { "field": "query.limit", "code": "too_big", "message": "Too big: expected number to be <=100" }
  ],
  "instance": "urn:trace:…"
}
```

- Branch on `status` and the stable `code` (such as `invalid_input`, `not_found` or `rate_limited`), not on `title`
  or `detail`, which are for people.
- Quote `instance` when you report a problem; it identifies that one request.
- `400` lists the refused fields in `errors`.
- `404` means the pool or token does not exist under that path.

## Rate limits

Too many requests get `429 Too Many Requests`; a temporary outage of a data source gets `503`. Both carry
`retryAfterSeconds` in the body and a `Retry-After` header. Wait that long, then retry, with backoff if it repeats.
Cache what you can: lists and pool figures change on the order of seconds, not milliseconds.

## Live updates

`GET /v1/live` upgrades to a WebSocket. Send `{"type":"subscribe", "topic":"pool/<five-part path>", ...}` to receive a
snapshot of a pool, then deltas. The message shapes are in the [reference](/api).

## Next

- [Recipes](/build-with-ai/recipes) for common agent tasks.
- The [API reference](/api) for every parameter and field.
