Get the Token Balance of an Address (ERC-20 or compatible)
You can retrieve the Token balance (ERC-20, BEP-20 or compatible) of an address via the following methods:
- Get token balance from an address (by Smart Contract): v3 REST API endpoint
- Get balances from an address: v4 DATA API endpoint
Request Example:
curl --location 'https://api.tatum.io/v4/data/balances?chain=celo-testnet&addresses=0xa57628beccedc2089acd8ed5399398cb74d856f0&pageSize=50&offset=0' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
"result": [
{
"chain": "celo-testnet",
"address": "0xa57628beccedc2089acd8ed5399398cb74d856f0",
"balance": "10",
"tokenAddress": "0x2f25deb3848c207fc8e0c34035b3ba7fc157602b",
"lastUpdatedBlockNumber": 24734253,
"type": "fungible"
},
{
"chain": "celo-testnet",
"address": "0xa57628beccedc2089acd8ed5399398cb74d856f0",
"balance": "1.5",
"tokenAddress": "0xf194afdf50b03e69bd7d057c1aa9e10c9954e4c9",
"lastUpdatedBlockNumber": 24734270,
"type": "fungible"
}
],
"prevPage": "",
"nextPage": ""
}
Good to Know
- Tatum endpoints provide token balances from "
finalized
" blocks. - Tatum endpoints return values at an average of 20 blocks behind the tip.
- If you need immediate token balance, irregardless of a finalized block, use the RPC
balanceOf()
.- Additional information is available in the following article.
Updated 6 months ago