This is the abridged developer documentation for Chainmetric API
# Chainmetric API
> Token, wallet and launch data on Ethereum, BNB Chain, Base and Solana, over HTTP and server-sent events.
The Chainmetric API answers questions about tokens, wallets and new launches on Ethereum, BNB Chain, Base and Solana. The base URL is `https://api.chainmetric.io`. Every request except the health check and logos needs a key. Get a key at [dashboard.chainmetric.com](https://dashboard.chainmetric.com). ## Start here [Section titled “Start here”](#start-here) * [For AI agents](/agents/): the whole API on one page. * [Authentication](/authentication/): how to send the key. * [Chains and addresses](/chains-and-addresses/): chain ids, address formats and units. * [Errors and retries](/errors/): the error shape and what to do with each status. * [Streams](/streams/): live updates and how to resume them. * [API reference](/api/): every route, built from the OpenAPI spec. * [Mobula-compatible endpoints](/mobula-compatible/): routes for clients that already speak the Mobula API. ## Machine-readable [Section titled “Machine-readable”](#machine-readable) * [/openapi.json](/openapi.json) and [/openapi.yaml](/openapi.yaml): the OpenAPI 3.1 spec. * [/llms.txt](/llms.txt): an index of these docs for language models, with [/llms-full.txt](/llms-full.txt) and [/llms-small.txt](/llms-small.txt). * Every page is also served as Markdown: add `.md` to its path, for example [/agents.md](/agents.md).
# For AI agents
> Everything an agent needs to call the Chainmetric API, on one page.
## Basics [Section titled “Basics”](#basics) * Base URL: `https://api.chainmetric.io`. * Auth: send `Authorization: `, the bare key. * `Authorization: Bearer ` is refused with `403` at the edge. Do not add `Bearer`. * Chain ids: Ethereum `1`, BNB Chain `56`, Base `8453`, Solana `1399811149`. * EVM addresses: 40 hex characters, lowercase, no `0x`. Solana addresses: base58, case-sensitive. * Every answer is JSON in one envelope; the document is in `data`. * A value that cannot be computed exactly is `null`, never `0`. * The full spec is at [/openapi.json](/openapi.json). Every page is also Markdown at `.md`. ## From question to route [Section titled “From question to route”](#from-question-to-route) | Question | Route | | --------------------------------------------- | ------------------------------------------------------- | | Price, market cap, volume, holders of a token | `GET /v2/token/{chain_id}/{address}/stats` | | Recent buys and sells of a token | `GET /v2/token/{chain_id}/{address}/trades` | | Price history or a chart | `GET /v2/token/{chain_id}/{address}/ohlcv?interval=1h` | | Liquidity added or removed | `GET /v2/token/{chain_id}/{address}/liquidity` | | Top holders of a token | `GET /v2/token/{chain_id}/{address}/positions` | | Who funded a wallet | `GET /v2/wallet/{chain_id}/{address}/funding?hops=root` | | What a wallet holds of one token | `GET /v2/wallet/{chain_id}/{wallet}/position/{token}` | | What launched just now | `GET /v2/pilot/trenches/{chain_id}?view=launches` | | Live trades, resumable | `GET /v2/stream/token/{chain_id}/{address}/replay` | Trades, liquidity and holders answer on EVM chains; Solana support for them is in progress. ## Errors and retries [Section titled “Errors and retries”](#errors-and-retries) * Every error is `{"error": "...", "message": "...", "statusCode": 400}`. * `400`: the request is wrong. Fix it; do not retry unchanged. * `401`: the key is missing, unknown or revoked. `404`: unknown chain, token or resource. * `429`: the key’s rate limit is reached. Back off exponentially and retry. * `503`: busy or catching up. Wait `Retry-After` seconds when sent, then retry. * `500`, `502`, `504`: retry with exponential backoff, at most a few times. ## Streams [Section titled “Streams”](#streams) * `/v2/stream/...` routes are server-sent events: `event:` and `data:` lines, one JSON envelope per event. * Resumable streams send `id:` lines. Reconnect with header `Last-Event-ID: ` to resume. * The trades and liquidity replay streams also start from history with `from_block` or `from_seq`. * A `: keepalive` comment arrives every 20 seconds. ## Three calls [Section titled “Three calls”](#three-calls)
```sh
curl -s -H "Authorization: $CHAINMETRIC_KEY" https://api.chainmetric.io/v2/token/1/c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/stats
curl -s -H "Authorization: $CHAINMETRIC_KEY" "https://api.chainmetric.io/v2/token/1/c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/trades?limit=3"
curl -s -H "Authorization: $CHAINMETRIC_KEY" "https://api.chainmetric.io/v2/pilot/trenches/1399811149?view=curves&limit=3"
```
# Authentication
> Send the bare key in the Authorization header; Bearer is refused.
Every request needs a key, except `GET /healthz` and `GET /v2/logo/...`. Get a key at [dashboard.chainmetric.com](https://dashboard.chainmetric.com). ## Send the key [Section titled “Send the key”](#send-the-key) Send the key bare in the `Authorization` header:
```sh
curl -s -H "Authorization: $CHAINMETRIC_KEY" https://api.chainmetric.io/v2/token/1/c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/stats
```
Do not prefix it with `Bearer`. `Authorization: Bearer ` is refused with `403` at the edge. ## Key errors [Section titled “Key errors”](#key-errors) | Status | `error` | Meaning | | ------ | ---------------------------- | ------------------------------------------------------------------------------ | | `401` | `api key missing` | No `Authorization` header was sent. | | `401` | `api key unknown` | The key does not exist. | | `401` | `api key revoked` | The key was revoked. Get a new one in the dashboard. | | `403` | | The request was refused at the edge, for example because of a `Bearer` prefix. | | `429` | `api key rate limit reached` | The key’s request rate limit is reached. | The rate limit is set per key. A `429` carries no `Retry-After` header: back off exponentially and retry. ## Browsers [Section titled “Browsers”](#browsers) The API answers cross-origin requests from any origin. It allows the `Authorization`, `Content-Type` and `Last-Event-ID` request headers. Do not ship a key in public browser code: anyone can read it there.
# Chains and addresses
> Which chain ids the API takes in the path, and how addresses are written in requests and answers.
## Chain ids [Section titled “Chain ids”](#chain-ids) Every native route takes the chain’s numeric id in the path as `{chain_id}`. | Chain | `chain_id` | Address format | | --------- | ------------ | -------------- | | Ethereum | `1` | hex | | BNB Chain | `56` | hex | | Base | `8453` | hex | | Solana | `1399811149` | base58 | The [Mobula-compatible endpoints](/mobula-compatible/) spell chains differently, for example `evm:1` and `solana`. ## EVM addresses [Section titled “EVM addresses”](#evm-addresses) An EVM address is 40 hex characters. Answers write it in lowercase without the `0x` prefix, for example `c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2`. Requests accept the same form. Transaction ids are 64 hex characters, lowercase, without `0x`. Some pool ids are 64 hex characters, because some exchanges identify a pool by a 32-byte id rather than by a contract address. ## Solana addresses [Section titled “Solana addresses”](#solana-addresses) A Solana address is base58, for example `So11111111111111111111111111111111111111112`. Base58 is case-sensitive: send it exactly as the chain writes it. ## Amounts and times [Section titled “Amounts and times”](#amounts-and-times) Fields ending in `_usd` are US dollars. Fields ending in `_pct` are percentages, so `2.5` means 2.5 %. Fields ending in `_us` are Unix time in microseconds. Fields ending in `_raw`, and `balance` in holder lists, are integers in the token’s smallest unit, written as strings so no precision is lost. Other token amounts are decimal numbers already divided by the token’s decimals.
# Errors and retries
> The one error shape every route uses, and what to do with each status code.
## Error shape [Section titled “Error shape”](#error-shape) Every error answer is JSON with three fields:
```json
{"error": "blockchain: unknown chain: \"ethereum\"", "message": "blockchain: unknown chain: \"ethereum\"", "statusCode": 400}
```
`error` and `message` carry the same text. For a `4xx` status the text says what was wrong with the request. For a `5xx` status the text is usually only the status name, for example `Service Unavailable`. ## What to do [Section titled “What to do”](#what-to-do) | Status | Meaning | Action | | ------ | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | | `400` | The request is malformed: a bad address, an unknown chain, or a bad parameter value. | Fix the request. Do not retry unchanged. | | `401` | The key is missing, unknown or revoked. | Send `Authorization: `. | | `403` | Refused at the edge, for example `Bearer `. | Send the bare key. | | `404` | The chain is not served, or the token or resource is not known. | Check the chain id and address. | | `410` | A stream’s `from_seq` is no longer held. | Resume with `from_block`. | | `429` | The key’s rate limit is reached. | Back off exponentially, then retry. | | `500` | A read failed. | Retry with exponential backoff, a few times at most. | | `501` | The requested option is not served yet, for example a holder sort other than `balance`. | Use a served option. | | `502` | The logo store failed. | Retry later. | | `503` | Busy, catching up, or starting. | Wait the `Retry-After` header’s seconds when sent (5 or 10), then retry. | | `504` | A read ran past its time limit. | Retry later, or narrow the request with `pool` or a smaller `limit`. | ## Empty is not an error [Section titled “Empty is not an error”](#empty-is-not-an-error) A known token with no activity answers `200` with zeros, `null` values or empty lists. A `pool` that does not belong to the token answers `200` with an empty list. A value that cannot be computed exactly is `null`, never `0`. ## Solana [Section titled “Solana”](#solana) On 2026-11-30, trades and liquidity answered `500` on Solana, and holders answered `503`. Those routes serve EVM chains; Solana support for them is in progress. Stats, candles and launches answered `200` on Solana.
# Mobula-compatible endpoints
> Routes that answer in the shape of the Mobula API, for clients that already speak it.
These routes accept Mobula-style requests and answer in the Mobula response shape. Use them only if your client already speaks that API. New integrations should use the native routes in the [API reference](/api/). Every route here needs the same `Authorization: ` header as the native routes. ## Chain spelling [Section titled “Chain spelling”](#chain-spelling) The `blockchain` parameter (and `chainId` where a route accepts it) takes an exact id. Chain names such as `ethereum` are refused with `400` and the message `unknown chain`. The match is exact: no lowercasing and no trimming. | Chain | Accepted values | | --------- | --------------------------- | | Ethereum | `evm:1` or `1` | | BNB Chain | `evm:56` or `56` | | Base | `evm:8453` or `8453` | | Solana | `solana:solana` or `solana` | On these routes Solana is `solana`, not `1399811149`. `/v2/fast-search` is the one exception to exact matching: it lowercases its chain list and strips spaces. ## Addresses [Section titled “Addresses”](#addresses) An EVM address is 40 hex characters. The `0x` prefix is optional and case is ignored. Answers spell EVM addresses as lowercase hex. A Solana address is base58 and case-sensitive. The zero address is refused where a wallet or token is required. ## Token routes [Section titled “Token routes”](#token-routes) | Route | Parameters | Answer | | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | | `GET /v2/token/details` | `blockchain` (or `chainId`), `address` (required) | Price, supply, volume and holder figures for one token. Marked `partial`. | | `POST /v2/token/details` | Body: a JSON array of `{blockchain, address, currencies?}`, at most 50 items and 64 KiB. Query `currencies=EUR,...`, at most 8 codes. | `{payload: [...], partial: true}` with one entry per item, or `null` for an item that has no answer. The all-time high and low fields are `null`. | | `GET /v2/token/security` | `blockchain` (required, no `chainId` fallback), `address` | Security flags and buy and sell taxes. Answers `503` with `Retry-After` when busy. | | `GET /v2/token/markets` | `blockchain`, `address`; `pairToken` (comma list, up to 10); `sortBy` (only `liquidityUSD`); `limit` (default 10, max 100) | `{data, totalCount, partial: true}`: the token’s pools by 24 h volume. | | `GET /v2/token/trades-enriched` | `blockchain`, `address` (token or pool); `sortOrder` `asc` or `desc` (default `desc`); `type` (comma list of `buy`, `sell`, `deposit`, `withdrawal`); `pool`; `cursor` (with `asc` only); `limit` (default 10, max 500); `offset` (`offset + limit` at most 5000); `fromDate`, `toDate` (Unix seconds, Unix milliseconds or RFC 3339); `label` (only `dev`); `swapRecipients`, `transactionSenderAddresses` (up to 10 each); `route=true` | Trades with wallet and pool context, plus `hasMore`. `swapTypes`, `minAmountUSD` and `maxAmountUSD` answer `400`. | | `GET /v2/token/holder-positions` | `blockchain`, `address`; `limit` (default 100, max 250); `offset`; `includeNativeBalance=true` | The top holders with their positions. `label` and `walletAddresses` answer `400`. | | `GET /v2/token/trader-positions` | Same as holder-positions | The top traders by realized PnL, in the holder-positions shape, plus `built` and `asOfBlock`. | | `GET /v2/token/dev-history` | `blockchain` (required), `address`; `limit` (default and max 200) | Other tokens created by the token’s deployer. | | `GET /v2/token/ohlcv-history` | `chainId`, `address` (both required); `period` (default `5m`; one of `1s 5s 15s 30s 1m 5m 15m 30m 1h 4h 6h 12h 1d 1w`); `amount` (default 500, max 2000); `to` (Unix ms) | `{data: [{t, o, h, l, c, v}]}`: USD candles of the token’s busiest pool, oldest first. | ## Market (pool) routes [Section titled “Market (pool) routes”](#market-pool-routes) | Route | Parameters | Answer | | ------------------------------ | -------------------------------------------------------- | -------------------------------------------------------------------- | | `GET /v2/market/details` | `blockchain`, `address` (a pool) | `{data, partial: true}` for one pool. An unknown pool answers `404`. | | `GET /v2/market/ohlcv-history` | Same as `/v2/token/ohlcv-history`, with `address` a pool | USD candles for that one pool. An unknown pool answers `404`. | ## Wallet routes [Section titled “Wallet routes”](#wallet-routes) | Route | Parameters | Answer | | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | | `GET /v2/wallet/analysis` | `chainIds` (or `blockchains`, or `chainId`; a comma list, chains are merged); `wallet` (required); `period` `1d`, `7d`, `30d` or `90d` (default `7d`), or `from` and `to` in ms (window at most 90 days); `includeNetworkBreakdown` | Trading statistics for the wallet over the window. PnL fields are `null` for now. | | `GET /v2/wallet/trades` | `blockchains` (or `chainIds`; exactly one chain); `wallet`; `from`, `to` in ms (window at most 30 days, default the last 30 days); `limit` (default 50, max 100); `cursor`; `order` (only `asc`); `swapRecipients`; `transactionSenderAddresses` (EVM only). With `tokenAddress`: `order` `asc` or `desc` (default `desc`) and `offset` (`offset + limit` at most 5000), no cursor. | `data` (trades, oldest first), `pagination: {hasMore, nextCursor}` and `partial`. More than 20,000 trades for one token answers `422`. | ## Search and metadata [Section titled “Search and metadata”](#search-and-metadata) | Route | Parameters | Answer | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | | `GET /v2/fast-search` | `input` (required, 1 to 1024 bytes); `filters` (JSON, for example `{"blockchains":"evm:1,solana"}`; default every searchable chain); `sortBy` `volume24h`, `marketCap` or `liquidity` (default: relevance) | Matching tokens. Marked `partial`. | | `GET /system-metadata` | `chainId` (optional, default all chains); `factories=false` leaves out factories | The list of known DEX factories and launchpads per chain. A known chain that is not served answers an empty list. | ## Pulse [Section titled “Pulse”](#pulse) `POST /v2/pulse` answers token lists for a launch-tracking view. The body is `{subscriptionId, compressed, maxUpdatesPerMinute, coalesce, views: [...]}` with up to 10 views. Each view is `{name, model, chainId: [...], limit, offset, addressToExclude, filters, sortBy, sortOrder, includeTokens}`. `model` is one of `new`, `bonding` or `bonded`. The answer is `{"data": {"": {"data": [cards]}}}`. It answers `503` while the launch feed is starting. For the same data in the native shape, use [`GET /v2/pilot/trenches/{chain_id}`](/api/operations/get-trenches/). ## WebSocket [Section titled “WebSocket”](#websocket) `GET /v2/mobula/ws` upgrades to a WebSocket. Messages are JSON text frames of the form `{"type": ..., "payload": ...}`. | `type` | `payload` | | --------------- | -------------------------------------------------------------------------- | | `ohlcv` | `{asset or address, chainId, period, subscriptionId, maxUpdatesPerMinute}` | | `token-details` | `{tokens: [{blockchain, address}], subscriptionId, maxUpdatesPerMinute}` | | `stream` | Trades: `{chainIds, events, filters, subscriptionId}` | | `holders` | `{tokens, sortBy, includeNativeBalance, subscriptionId}` | | `pulse-v2` | The same body as `POST /v2/pulse` | | `pulse-pause` | `{action: "pause" or "unpause", views: [...]}` | | `unsubscribe` | `{subscriptionId, type?, viewName?, tokens?}` | Send `{"event":"ping"}` to get `{"event":"pong"}`. A subscription is confirmed with `{"event":"subscribed", ...}`. An error arrives as `{"event":"error","message": ...}`. The socket answers `503` when no live feed is attached.
# Streams
> Live updates over server-sent events, and how to resume a stream after a disconnect.
Routes under `/v2/stream/` are server-sent event (SSE) streams. Each event has an `event:` line and a `data:` line holding one JSON object. Most `data` objects are the same envelope the REST routes answer with. A `: keepalive` comment line arrives every 20 seconds. Send the key in the `Authorization` header, as on every other route. ## The streams [Section titled “The streams”](#the-streams) | Stream | Events | Resume | | ------------------------------------------------------------ | ------------------------------------------------- | ----------------------------------------- | | `GET /v2/stream/token/{chain_id}/{address}/replay` | `attached`, then one `frame` per trade | `Last-Event-ID`, `from_block`, `from_seq` | | `GET /v2/stream/token/{chain_id}/{address}/liquidity/replay` | `attached`, then one `frame` per liquidity change | `Last-Event-ID`, `from_block`, `from_seq` | | `GET /v2/stream/pilot/trenches/{chain_id}` | `snapshot`, then `card`, `update`, `remove` | `Last-Event-ID` | | `GET /v2/stream/token/{chain_id}/{address}/ohlcv?interval=` | `attached`, then one `frame` per changed candle | none | | `GET /v2/stream/token/{chain_id}/{address}` | `attached`, then one `frame` per trade | none | The plain token stream may be closed at the public edge. Use `/replay` for trades: it carries the same trades and can resume. ## Resume [Section titled “Resume”](#resume) Resumable streams send an `id:` line with their events. Keep the last `id` you received. On reconnect, send it in the `Last-Event-ID` header. The stream then sends what you missed and continues live. Browser `EventSource` clients do this on their own. The replay streams can also start from history: * `from_block=` starts at a block height (a slot on Solana). * `from_seq=` starts after a stream sequence. * Send at most one of them. `Last-Event-ID` wins over both. * Without any of them, the stream is live only. * A `from_seq` that is no longer held answers `410`; resume with `from_block`. The launches stream resumes with `Last-Event-ID` only. An id it no longer holds gets a fresh `snapshot` instead of an error.
```sh
curl -N -H "Authorization: $CHAINMETRIC_KEY" -H "Last-Event-ID: 26527763.112.450.0" \
https://api.chainmetric.io/v2/stream/token/1/c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/replay
```
## Fast and safe data [Section titled “Fast and safe data”](#fast-and-safe-data) A frame’s `lane` is `fast` when it was published as soon as its block was seen. The same data is published again with `lane` `safe` once the block is final, and replaces the fast copy. `commitment` says how settled a frame is: `processed` (Solana fast), `confirmed` (EVM fast) or `finalized`. A frame that a chain reorganisation withdrew arrives again with `revoked: true`. If you want final data only, keep frames whose `commitment` is `finalized`. ## Launch events [Section titled “Launch events”](#launch-events) The launches stream’s `snapshot` is `{"views": {"new": [...], "curves": [...], "graduated": [...], "pairs": [...]}}`. The stream calls the launches view `new`; the REST route calls it `launches`. `card` and `update` carry `{views, card}`. `remove` carries `{views, pool}`. ## When a stream is full [Section titled “When a stream is full”](#when-a-stream-is-full) A stream that has no free slot answers `503` with `Retry-After: 5`. Wait that long and reconnect.