Contents
Pagination & caching
Feeds come newest first in pages; time windows decide how far back; ETags make polling cheap.
Cursor pagination
Pass meta.nextCursor back as cursor until it is null. Keep every other parameter unchanged.
# first page, then repeat with the cursor until meta.nextCursor is null
curl -s -H "Authorization: Bearer $BLOCKMETRIC_API_KEY" \
"https://api.blockmetric.io/v1/liquidations?sinceMinutes=1440&limit=500" | jq '{n: (.data | length), next: .meta.nextCursor}'
curl -s -H "Authorization: Bearer $BLOCKMETRIC_API_KEY" \
"https://api.blockmetric.io/v1/liquidations?sinceMinutes=1440&limit=500&cursor=<meta.nextCursor>"- Paginated endpoints:
/liquidations,/positions/top,/whales/feed,/traders,/tape,/radar/events,/security/incidents,/security/wallets,/movements.meta.nextCursoris always present there andnullon the last page. - Cursors are opaque and signed. Do not build or edit them: an edited cursor or one from another endpoint answers
400 invalid_param. - Paging stops at your plan's history. Older rows are never returned, also not through a cursor;
meta.accesssays where your window starts. - limit sets the page size; values outside the allowed range are clamped and reported in
meta.warnings.
Time windows
Each endpoint takes the window that fits its data. All times are ISO 8601 in UTC.
| Parameter | Meaning | Endpoints |
|---|---|---|
sinceMinutes | Look back this many minutes from now. | /liquidations, /tape |
hours | Look back this many hours from now (or from end). | /liquidations/summary, /heatmap/{coin}, /heatmap/{coin}/open-interest, /orderbook/{coin}, /flow/{coin}, /exchange-flows |
since | Only rows after this ISO 8601 time, the natural polling cursor of a feed. | /whales/feed, /radar/events, /movements |
from | Start of a fixed window (ISO 8601). | /liquidations, /candles/{coin}, /tape |
to | End of a fixed window (ISO 8601). | /liquidations, /candles/{coin}, /tape |
end | End of the window instead of now (ISO 8601). | /heatmap/{coin}, /heatmap/{coin}/open-interest |
after | Forward polling: only rows newer than this id (pass meta.nextAfter from the previous poll). | /liquidations, /tape |
Polling for new rows
Ask only for what is new, and let the server tell you when nothing changed.
- Feeds: remember the newest time you have seen and pass it as
since(whale feed, movements), or the newest id asafterwhere the endpoint offers it. - Snapshots (liquidation map, order book, screener) change at most every minute. Poll once a minute with
If-None-Match. - Alerts: instead of polling, receive events the moment they happen with webhooks or the live stream.
Caching with ETag
Every 200 has an ETag. Send it back as If-None-Match: while nothing changed you get 304 without a body.
# 1st call: note the ETag header
curl -si -H "Authorization: Bearer $BLOCKMETRIC_API_KEY" "https://api.blockmetric.io/v1/liqmap/BTC" | grep -i etag
# later: 304 Not Modified (no body) while nothing changed
curl -si -H "Authorization: Bearer $BLOCKMETRIC_API_KEY" \
-H 'If-None-Match: "<etag>"' "https://api.blockmetric.io/v1/liqmap/BTC" | head -1A 304 still counts as a request against your limits, but transfers nothing. Responses are private to your key; never cache them in a shared CDN.
Smaller answers: compression, fields and CSV
Large lists shrink a lot when you ask for compression and only the fields you need.
- Compression: send
Accept-Encoding: gzip(or br, zstd). Browsers, Node fetch, Python requests and curl with--compresseddo it for you; JSON lists are often 5 to 8 times smaller. - fields: only the named fields of every row, e.g.
?fields=coin,mark,fundingApr. Unknown names answer 400 with the list of fields. - format=csv or format=ndjson: only the rows. The next page is in
Link: rel="next"andX-Blockmetric-Next-Cursor; the cursor of a JSON page works too. Errors stay JSON.
# three fields of every market as CSV; --compressed asks for gzip
curl -s --compressed -H "Authorization: Bearer $BLOCKMETRIC_API_KEY" "https://api.blockmetric.io/v1/markets?fields=coin,mark,fundingApr&format=csv"Row lists: /markets, /funding, /liquidations, /positions/top, /whales/feed, /radar/events, /coins, /candles/{coin}, /long-short, /whales, /traders, /tape, /screener, /funding/predicted, /funding/spreads, /security/incidents, /security/wallets, /movements. Your plan, its history and the licence apply exactly as for JSON; only the encoding changes.
Code snippets in these docs are licensed under MIT-0: copy them into your own code without attribution. The SDKs, CLI and MCP server will be, once published, Apache-2.0; the name Blockmetric is not licensed (forks must be renamed). Data from the API is governed by the API terms; third-party exchange data by the exchange’s terms.