ankr_getBlocks
Get a range of blocks with optional decoded transactions and logs
POST/?ankr_getBlocks
Returns details for the requested range of blocks on a single chain: header fields, the full transaction list (optional), and per-transaction logs (optional). Use the decodeTxData and decodeLogs flags to receive resolved method/event signatures and decoded inputs.
Pass blockchain, then fromBlock and toBlock as either integers, hex strings, or the keywords earliest / latest. Maximum range is 30 blocks per call. includeLogs requires includeTxs to also be true.
Part of the Query API product (700 compute units per call, $0.00007 at base rate).
Request
Responses
- 200
- 400
- 401
- 429
- 500
Success. JSON-RPC result contains the blocks array. JSON-RPC errors are returned with HTTP 200; check the response body for an error key.
Bad Request — malformed JSON-RPC envelope or invalid params. The gateway rejects before the JSON-RPC layer processes the call.
Unauthorized — missing or invalid API key in the server URL path. Verify that {API_KEY} is set to a valid project key.
Too Many Requests — the API key has exceeded its rate or quota limits. Back off and retry; consider upgrading the Premium tier for higher limits.
Server error — unexpected condition. Retry with exponential backoff; if it persists, file a ticket at https://www.ankr.com/support/.