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 — Token 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.

Token API


ERC-20 and native-token enrichment endpoints — wallet balances, USD prices, holder rosters, transfer history, and chain currencies.


ankr_getAccountBalance

POST ankr_getAccountBalance

Returns the total native + ERC-20 balance of a wallet across one or more supported EVM chains, with USD valuations computed by Ankr's pricing service. Each asset includes contract address, decimals, raw integer balance, and a normalized human-readable balance.

Pass walletAddress (hex address, or ENS name on Ethereum). Scope to specific chains with the blockchain array, or omit it to query all supported chains. Filter by onlyWhitelisted: true (default) to limit results to tokens indexed on CoinGecko, or set to false for the full ERC-20 inventory the wallet has touched.

Pagination via pageSize + pageToken. The endpoint is part of the Token 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):

    • walletAddress (string; required): Wallet to query. Hex address (0x…) or ENS name on Ethereum (e.g. vitalik.eth).
    • blockchain (array of string; optional): Optional. One or more chains to query. Omit for 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.
    • nativeFirst (boolean; optional; default: false): Sort native tokens first when true.
    • onlyWhitelisted (boolean; optional; default: true): Restrict to tokens listed on CoinGecko. Defaults to true; set false for the full ERC-20 inventory.
    • pageSize (integer; optional): Number of assets per page. Default is no pagination.
    • 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_getAccountBalance",
"params": {
"walletAddress": "0x18b2a687610328590bc8f2e5fedde3b582a49cda",
"blockchain": [
"eth",
"bsc",
"polygon"
]
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"totalBalanceUsd": "398857.927815440716633863",
"totalCount": 3,
"assets": [
{
"blockchain": "bsc",
"tokenName": "Binance Smart Chain",
"tokenSymbol": "BNB",
"tokenDecimals": 18,
"tokenType": "NATIVE",
"holderAddress": "0x18b2a687610328590bc8f2e5fedde3b582a49cda",
"balance": "1608.434310817656690616",
"balanceRawInteger": "1608434310817656690616",
"balanceUsd": "394175.866488091069305026",
"tokenPrice": "245.068053968402063819",
"thumbnail": "https://www.ankr.com/protocol/static/media/bsc.e1bfba92.svg"
},
{
"blockchain": "eth",
"tokenName": "Ethereum",
"tokenSymbol": "ETH",
"tokenDecimals": 18,
"tokenType": "NATIVE",
"holderAddress": "0x18b2a687610328590bc8f2e5fedde3b582a49cda",
"balance": "1.106063312048596845",
"balanceRawInteger": "1106063312048596845",
"balanceUsd": "1339.617032917654314456",
"tokenPrice": "1211.157641994725049028",
"thumbnail": "https://www.ankr.com/protocol/static/media/eth.3ee8ddd4.svg"
},
{
"blockchain": "polygon",
"tokenName": "Minereum Polygon",
"tokenSymbol": "MNEP",
"tokenDecimals": 8,
"tokenType": "ERC20",
"holderAddress": "0x18b2a687610328590bc8f2e5fedde3b582a49cda",
"contractAddress": "0x0b91b07beb67333225a5ba0259d55aee10e3a578",
"balance": "300000",
"balanceRawInteger": "30000000000000",
"balanceUsd": "1244.852927117672699968",
"tokenPrice": "0.004149509757058909",
"thumbnail": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x426CA1eA2406c07d75Db9585F22781c096e3d0E0/logo.png"
}
]
}
}

ankr_getCurrencies

POST ankr_getCurrencies

Returns the catalog of currencies (native coin + indexed ERC-20 tokens) for a single blockchain, including symbol, decimals, contract address, and a thumbnail URL.

Pass blockchain to scope the catalog. Useful for building asset pickers, populating token dropdowns, or mapping unknown contract addresses to known token metadata.

Part of the Token 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.
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_getCurrencies",
"params": {
"blockchain": "polygon"
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"currencies": [
{
"address": "0x2727ab1c2d22170abc9b595177b2d5c6e1ab7b7b",
"blockchain": "polygon",
"decimals": 18,
"name": "Cartesi Token (PoS)",
"symbol": "CTSI",
"thumbnail": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/polygon/assets/0x2727Ab1c2D22170ABc9b595177B2D5C6E1Ab7B7B/logo.png"
},
{
"address": "0x580a84c73811e1839f75d86d75d88cca0c241ff4",
"blockchain": "polygon",
"decimals": 18,
"name": "Qi Dao",
"symbol": "QI",
"thumbnail": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/polygon/assets/0x580A84C73811E1839F75d86d75d88cCa0c241fF4/logo.png"
}
]
}
}

ankr_getTokenHolders

POST ankr_getTokenHolders

Returns wallet addresses that hold the specified ERC-20 token, with each holder's human-readable balance and the raw integer balance (value × 10^decimals). Holders are returned ranked by balance, descending.

Pass contractAddress of the token plus the blockchain it lives on. Paginate with pageSize (default 10000, max 10000) and the nextPageToken echoed in each response.

Part of the Token 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.
    • contractAddress (string; required): Token contract address.
    • pageSize (integer; optional; default: 10000): Entries per page. Default 10000, 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_getTokenHolders",
"params": {
"blockchain": "eth",
"contractAddress": "0x40eb746dee876ac1e78697b7ca85142d178a1fc8",
"pageSize": 2
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockchain": "eth",
"contractAddress": "0x40eb746dee876ac1e78697b7ca85142d178a1fc8",
"holders": [
{
"balance": "15217676.432428",
"balanceRawInteger": "15217676432428000000000000",
"holderAddress": "0x000000000000000000000000000000000000dead"
},
{
"balance": "0.000000000000000001",
"balanceRawInteger": "1",
"holderAddress": "0x000000000000084e91743124a982076c59f10084"
}
],
"holdersCount": 1843,
"nextPageToken": "HUAjC8b1LGxx7soyEPoojoahpqtPaAhk6jTx35dALF6jLH85QD4oHWRA8E1Wf9MqjffsuHfg6pg5ac6Eocb",
"tokenDecimals": 18
}
}

ankr_getTokenHoldersCount

POST ankr_getTokenHoldersCount

Returns the per-day count of unique holders for the specified ERC-20 token, along with the total token amount on-chain at each snapshot. Useful for charting distribution trends or feeding token-analytics dashboards.

Pass contractAddress of the token plus the blockchain it lives on. The history is paginated; use pageSize (default 10000, max 10000) and pageToken to walk further back in time. latestHoldersCount is the most recent week's count.

Part of the Token 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.
    • contractAddress (string; required): Token contract address.
    • pageSize (integer; optional; default: 10000): Entries per page. Default 10000, 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_getTokenHoldersCount",
"params": {
"blockchain": "eth",
"contractAddress": "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852",
"pageSize": 2
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockchain": "eth",
"contractAddress": "0x0d4a11d5eeaac28ec3f61d100daf4d40471f1852",
"holderCountHistory": [
{
"holderCount": 2617,
"lastUpdatedAt": "2022-12-27T02:41:31Z",
"totalAmount": "0.148685211383143825",
"totalAmountRawInteger": "148685211383143825"
},
{
"holderCount": 2628,
"lastUpdatedAt": "2022-12-26T02:39:57Z",
"totalAmount": "0.148695704516316983",
"totalAmountRawInteger": "148695704516316983"
}
],
"latestHoldersCount": 2628,
"nextPageToken": "EmDqUkUByQeZ9jgedKukeKkJff9kFuPLMX6mubHUvKN1cRb3s78Yn",
"tokenDecimals": 18
}
}

ankr_getTokenPrice

POST ankr_getTokenPrice

Returns Ankr's current USD price for the specified token. Pass a contractAddress for an ERC-20 token, or omit it to fetch the price of the chain's native coin.

Prices are normalized to decimal strings; treat them as USD per unit token. The same call returns the queried contract address so you can round-trip the result.

Part of the Token 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.
    • contractAddress (string; optional): ERC-20 contract address. Omit to fetch the native coin price.
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_getTokenPrice",
"params": {
"blockchain": "eth",
"contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7"
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockchain": "eth",
"contractAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"usdPrice": "1"
}
}

ankr_getTokenTransfers

POST ankr_getTokenTransfers

Returns ERC-20 transfer events in which the specified wallet(s) appear as sender or recipient. Each entry includes contract address, token symbol, decimals, raw + normalized values, block height, and timestamp.

Pass an address array (single or multiple wallets). Scope by blockchain, block range (fromBlock / toBlock), or wall-clock range (fromTimestamp / toTimestamp). Paginate with pageSize (default 100, max 10000) and pageToken.

Part of the Token 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; optional): Wallet address(es) to query. ENS accepted on Ethereum.
    • 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 or earliest, or hex).
    • toBlock (integer; optional): End block (integer or latest, or hex).
    • fromTimestamp (integer; optional): UNIX timestamp lower bound.
    • toTimestamp (integer; optional): UNIX timestamp upper bound.
    • descOrder (boolean; optional; default: false): Sort newest first when true.
    • 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_getTokenTransfers",
"params": {
"address": [
"0xd8da6bf26964af9d7eed9e03e53415d37aa96045"
],
"blockchain": [
"eth",
"bsc"
],
"fromTimestamp": 1655197483,
"toTimestamp": 1671974699
}
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"transfers": [
{
"blockHeight": 4593859,
"blockchain": "eth",
"contractAddress": "0xdd974d5c2e2928dea5f71b9825b8b646686bd200",
"fromAddress": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"thumbnail": "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdd974D5C2e2928deA5F71b9825b8b646686BD200/logo.png",
"timestamp": 1511258315,
"toAddress": "0x0cfb686e114d478b055ce8614621f8bb62f70360",
"tokenDecimals": 18,
"tokenName": "Kyber Network Crystal",
"tokenSymbol": "KNC",
"transactionHash": "0xfc2192e9716490dbe46c3d59c7c99f81d3b685118b01e2812872a6aae7049c4b",
"value": "3420332",
"valueRawInteger": ""
}
]
}
}