For AI agents
Basics
Section titled “Basics”- Base URL:
https://api.chainmetric.io. - Auth: send
Authorization: <key>, the bare key. Authorization: Bearer <key>is refused with403at the edge. Do not addBearer.- Chain ids: Ethereum
1, BNB Chain56, Base8453, Solana1399811149. - 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, never0. - The full spec is at /openapi.json. Every page is also Markdown at
<page>.md.
From question to route
Section titled “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”- 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. WaitRetry-Afterseconds when sent, then retry.500,502,504: retry with exponential backoff, at most a few times.
Streams
Section titled “Streams”/v2/stream/...routes are server-sent events:event:anddata:lines, one JSON envelope per event.- Resumable streams send
id:lines. Reconnect with headerLast-Event-ID: <last id>to resume. - The trades and liquidity replay streams also start from history with
from_blockorfrom_seq. - A
: keepalivecomment arrives every 20 seconds.
Three calls
Section titled “Three calls”curl -s -H "Authorization: $CHAINMETRIC_KEY" https://api.chainmetric.io/v2/token/1/c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/statscurl -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"