For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

Advanced API — Query API

API reference for the Ankr Advanced API — enriched multichain JSON-RPC served from a single endpoint: https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY.

Query API


General-purpose chain query endpoints — blocks, transactions, logs, chain-level stats, account interactions.


ankr_getBlockchainStats

POST ankr_getBlockchainStats

Returns headline statistics for one or more chains: latest block number, average block time, total transactions and events since genesis, and the current native coin USD price.

Pass a blockchain array to scope the query; omit or pass an empty array for all supported chains. Useful for hero banners, homepage tiles, and basic network health checks.

Part of the Query API product (700 compute units per call, $0.00007 at base rate).

Plan availability. This method is restricted on the shared demo key (-32075 Method disabled, reason: restricted by blockchain schema). Use your own API key to call it.

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • blockchain (array of string; optional): Chains to query. Omit or pass an empty array to query all supported chains. Allowed values: arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, scroll, story_mainnet, syscoin, taiko, telos, xai, xlayer, avalanche_fuji, base_sepolia, eth_holesky, eth_sepolia, optimism_testnet, polygon_amoy, story_aeneid_testnet.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getBlockchainStats",
"params": {
"blockchain": [
"bsc",
"polygon"
]
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"stats": [
{
"blockTimeMs": 3000,
"blockchain": "bsc",
"latestBlockNumber": 24274429,
"nativeCoinUsdPrice": "245.153233940444766334",
"totalEventsCount": 11643833187,
"totalTransactionsCount": 3764960943
},
{
"blockTimeMs": 4000,
"blockchain": "polygon",
"latestBlockNumber": 37350500,
"nativeCoinUsdPrice": "0.803307052493372837",
"totalEventsCount": 8710949888,
"totalTransactionsCount": 2318753716
}
]
}
}

ankr_getBlocks

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).

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • blockchain (string; required): Target blockchain identifier. Allowed values: arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, scroll, story_mainnet, syscoin, taiko, telos, xai, xlayer, avalanche_fuji, base_sepolia, eth_holesky, eth_sepolia, optimism_testnet, polygon_amoy, story_aeneid_testnet.
    • fromBlock (integer; optional): First block (inclusive). Integer, hex string, or earliest. Max range — 30 blocks.
    • toBlock (integer; optional): Last block (inclusive). Integer, hex string, or latest. Max range — 30 blocks.
    • decodeLogs (boolean; optional; default: false): Resolve event signatures and decode log inputs.
    • decodeTxData (boolean; optional; default: false): Resolve method signatures and decode transaction inputs.
    • descOrder (boolean; optional; default: false): Sort newest first when true.
    • includeLogs (boolean; optional; default: false): Include logs inside transactions. Requires includeTxs: true.
    • includeTxs (boolean; optional; default: false): Include transaction objects in each block.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getBlocks",
"params": {
"blockchain": "eth",
"fromBlock": "latest",
"toBlock": "latest",
"decodeLogs": true,
"decodeTxData": true,
"includeLogs": true,
"includeTxs": true
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blocks": [
{
"blockchain": "eth",
"difficulty": "0x1b20c328a941b9",
"extraData": "0x486976656f6e2072752d686561767920634b4674",
"gasLimit": "0xe48bca",
"gasUsed": "0xe479c0",
"hash": "0xc652947d88fce6b290d99d6e45241e38807a3d00697d681b6bd4796ce243329e",
"logsBloom": "0x4131",
"miner": "0x1ad91ee08f21be3de0ba2ba6918e714da6b45836",
"mixHash": "0x27c55ee9b24b79ba8b33f52b7411a1f7757cb7c4ab66b1d604609cf2c1953ca2",
"nonce": "0xbf2230abdb929ebb",
"number": "0xc016d9",
"parentHash": "0x3323200e478c0c47d88d4e9d9ae8c3da02dfa88ee897eda0042477ee03c0c6f5",
"receiptsRoot": "0xfd445d3c0de66f9e1a66f031d7242da2a9f1d6fde10d11f96ed526f40e90b51e",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0xea61",
"stateRoot": "0xe154e45862394ac2a4218d3d8b725764ae98bb6e1ffb1f1b0b46e62e74b4cbab",
"timestamp": "0x60be5a40",
"totalDifficulty": "0x57be0653966d6abf487",
"transactions": [],
"transactionsRoot": "0x1729c1795404e9291ef12556fdf2ed61a2ad228cc29b76ef5d04c3e9f35f3ade",
"uncles": []
}
]
}
}

ankr_getInteractions

POST ankr_getInteractions

Returns the set of supported blockchains on which the given address has any indexed activity — tokens, NFTs, or transactions. Useful for cross-chain wallet dashboards or address-lookup UIs that want to avoid hitting every chain.

Pass a single address (wallet or contract). The response is a string array of chain identifiers; pair with downstream calls (e.g. ankr_getAccountBalance, ankr_getTransactionsByAddress) for the actual data.

Part of the Query API product (700 compute units per call, $0.00007 at base rate).

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • address (string; required): Wallet or contract address.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getInteractions",
"params": {
"address": "0xF977814e90dA44bFA03b6295A0616a897441aceC"
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockchains": [
"bsc",
"fantom",
"polygon",
"arbitrum",
"optimism",
"avalanche",
"eth"
]
}
}

ankr_getLogs

POST ankr_getLogs

Returns indexed contract logs (events) for the requested chain and block range. Standard eth_getLogs semantics, plus multi-chain dispatch, pagination, and optional event-signature decoding via decodeLogs: true.

Pass blockchain and either a block range (fromBlock / toBlock) or a time range (fromTimestamp / toTimestamp). Scope by address (single or array of contracts) and / or topics (nested arrays matching eth_getLogs topic filter semantics). Paginate with pageSize (default 1000, max 10000) and pageToken.

Part of the Query API product (700 compute units per call, $0.00007 at base rate).

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • blockchain (array of string; optional): Chains to query. Omit or pass an empty array to query all supported chains. Allowed values: arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, scroll, story_mainnet, syscoin, taiko, telos, xai, xlayer, avalanche_fuji, base_sepolia, eth_holesky, eth_sepolia, optimism_testnet, polygon_amoy, story_aeneid_testnet.
    • address (array of string; optional): Contract address(es) to scope logs to.
    • fromBlock (integer; optional): Start block (integer, hex, or earliest).
    • toBlock (integer; optional): End block (integer, hex, or latest).
    • fromTimestamp (integer; optional): UNIX timestamp lower bound.
    • toTimestamp (integer; optional): UNIX timestamp upper bound.
    • topics (array of array of string; optional): Topic filter — array of arrays of 32-byte topic hashes, matching eth_getLogs semantics.
    • decodeLogs (boolean; optional; default: false): Resolve event signatures and decode inputs.
    • descOrder (boolean; optional; default: false): Sort newest first when true.
    • pageSize (integer; optional; default: 1000): Entries per page. Default 1000, max 10000.
    • pageToken (string; optional): Opaque page token from a prior response's nextPageToken.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getLogs",
"params": {
"blockchain": [
"eth"
],
"address": [
"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
],
"fromBlock": "earliest",
"toBlock": "latest",
"topics": [
[
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
],
"pageSize": 1
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"logs": [
{
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"blockHash": "0x76fe73c4d2a66bb0cba343482521c8cd44f0ef824e97493f3c4f3e5140422ea5",
"blockNumber": "0xdaf6b4",
"blockchain": "eth",
"data": "0x00000000000000000000000000000000000000000000000000787f498b5b22b7",
"event": {
"anonymous": false,
"id": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"name": "Transfer",
"signature": "Transfer(address,address,uint256)",
"string": "event Transfer(address indexed _from, address indexed _to, uint256 _value)",
"verified": false
},
"logIndex": "0x49",
"removed": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000def1c0ded9bec7f1a1670819833240f027b25eff",
"0x0000000000000000000000003dd49f67e9d5bc4c5e6634b3f70bfd9dc1b6bd74"
],
"transactionHash": "0x6f11297b0964a0fb0630e6667093a6c9cee4b383495c94e99becc6b88aed8f14",
"transactionIndex": "0x3f"
}
]
}
}

ankr_getTransactionsByAddress

POST ankr_getTransactionsByAddress

Returns transactions in which the specified wallet(s) appear as sender or recipient — with full transaction objects including gas, value, and (optionally) nested logs.

Pass an address array. Scope by blockchain, block range (fromBlock / toBlock), or wall-clock range (fromTimestamp / toTimestamp). Enable includeLogs: true to embed each transaction's log array. Paginate with pageSize (default 100, max 10000) and pageToken.

Part of the Query API product (700 compute units per call, $0.00007 at base rate).

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • address (array of string; required): Wallet address(es) to query.
    • blockchain (array of string; optional): Chains to query. Omit or pass an empty array to query all supported chains. Allowed values: arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, scroll, story_mainnet, syscoin, taiko, telos, xai, xlayer, avalanche_fuji, base_sepolia, eth_holesky, eth_sepolia, optimism_testnet, polygon_amoy, story_aeneid_testnet.
    • fromBlock (integer; optional): Start block (integer, hex, or earliest).
    • toBlock (integer; optional): End block (integer, hex, or latest).
    • fromTimestamp (integer; optional): UNIX timestamp lower bound.
    • toTimestamp (integer; optional): UNIX timestamp upper bound.
    • descOrder (boolean; optional; default: false): Sort newest first when true.
    • includeLogs (boolean; optional; default: false): Embed each transaction's log array.
    • pageSize (integer; optional; default: 100): Entries per page. Default 100, max 10000.
    • pageToken (string; optional): Opaque page token from a prior response's nextPageToken.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getTransactionsByAddress",
"params": {
"address": [
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
],
"blockchain": [
"eth"
],
"pageSize": 10,
"descOrder": true
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"transactions": [
{
"blockHash": "0x8ffa5d490184c95c830bb4fb47b76e1fd69eb35d100f93d36d7db131837c938f",
"blockNumber": "0xf823ad",
"blockchain": "eth",
"cumulativeGasUsed": "0x68f589",
"from": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"gas": "0xbe98",
"gasPrice": "0x2babee650",
"gasUsed": "0xbd8d",
"hash": "0x9a70ccd1f8e0d5ddf8e78f68b477d4d5c15ddd17c66f05f820b4c67f5eb6f85a",
"input": "0xa9059cbb000000000000000000000000fe97e32a873aa2f926fbfc560abeef01f753c1280000000000000000000000000000000000000000000000000000002e90edd000",
"nonce": "0x3c4",
"r": "0xe5c2731e3a85d048b4adb0cf9c06cb51013728627525ce80e96c4f1317007104",
"s": "0x3a22f49130b59d832a6c9db79880b313e9ca2536a3fd5f10b8080e2e1c3bda97",
"status": "0x1",
"timestamp": "0x63a85033",
"to": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"transactionIndex": "0x3c",
"type": "0x2",
"v": "0x0",
"value": "0x0"
}
]
}
}

ankr_getTransactionsByHash

POST ankr_getTransactionsByHash

Returns the transaction(s) matching a single hash. Optionally embeds logs and resolves method/event signatures to human-readable form.

Pass transactionHash. Multi-chain dispatch is automatic — Ankr will search across supported chains and return the transaction with its blockchain field populated. Use includeLogs, decodeTxData, and decodeLogs for richer responses; you can optionally scope the search with the blockchain array.

Part of the Query API product (700 compute units per call, $0.00007 at base rate).

Parameters

  • id (integer; required): a request ID (example: 1).

  • jsonrpc (string; required): a JSON RPC spec used (example: 2.0).

  • method (string; required): a method used for the request.

  • params (object; required):

    • transactionHash (string; required): Transaction hash to look up.
    • blockchain (array of string; optional): Chains to query. Omit or pass an empty array to query all supported chains. Allowed values: arbitrum, avalanche, base, bsc, eth, fantom, flare, gnosis, linea, optimism, polygon, scroll, story_mainnet, syscoin, taiko, telos, xai, xlayer, avalanche_fuji, base_sepolia, eth_holesky, eth_sepolia, optimism_testnet, polygon_amoy, story_aeneid_testnet.
    • decodeLogs (boolean; optional; default: false): Resolve event signatures and decode log inputs.
    • decodeTxData (boolean; optional; default: false): Resolve method signatures and decode transaction inputs.
    • includeLogs (boolean; optional; default: false): Embed the transaction's log array.
Request example
curl -X POST https://rpc.ankr.com/multichain/YOUR_ANKR_API_KEY \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"jsonrpc": "2.0",
"method": "ankr_getTransactionsByHash",
"params": {
"blockchain": [
"eth"
],
"transactionHash": "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060",
"decodeTxData": true,
"decodeLogs": true
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"transactions": [
{
"blockHash": "0x1e7b69036e5de4094839e186facabe2e3fb3586f52888bdb22f96e265f77aaeb",
"blockNumber": "0xf85b14",
"blockchain": "eth",
"cumulativeGasUsed": "0x57b86",
"from": "0x77223f67d845e3cbcd9cc19287e24e71f7228888",
"gas": "0x3012f",
"gasPrice": "0x298c22300",
"gasUsed": "0x200ca",
"hash": "0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060",
"input": "0x0372e988016462e1719eb1692cb7af7016172262cb287f37aa000d4f",
"nonce": "0x1182",
"r": "0x3857d29f619e161e00141abecf5f3420dfbda34dfaf7e10cac20758c5cdd2d0f",
"s": "0x7843a450a5f1224e9d6e10e7518b9aba67e6dd1b442c11b3e8926eaca3b72546",
"status": "0x1",
"timestamp": "0x63aaec8b",
"to": "0x00000000a991c429ee2ec6df19d40fe0c80088b8",
"transactionIndex": "0x5",
"type": "0x2",
"v": "0x1",
"value": "0x61321"
}
]
}
}