Wallet API
Query Balance by Address

Query Balance by Address#

Retrieve the list of token balances for an address across multiple chains or specified chains. The balance query supports:

  • Chain native tokens
  • ERC20 tokens on EVM chains
  • BRC-20, ARC-20, Runes, and SRC-20 tokens in the Bitcoin ecosystem

Additionally, this interface supports filtering out risky airdrop tokens.

Request Path#

GET https://www.okx.com/api/v5/wallet/asset/all-token-balances-by-address

Request Parameters#

ParameterTypeRequiredDescription
addressStringYesAddress
chainsArrayYesList of chainIndex, which can query the balance of address in multiple chains, maximum limit is 50.
filterStringNo0: Filter out risk airdrop tokens
1: Do not filter
Default is to filter.

Response Parameters#

ParameterTypeDescription
tokenAssetsArrayList of token balances
>chainIndexStringUnique identifier for the chain
>tokenAddressStringContract address
>symbolStringToken symbol
>balanceStringToken balance
>tokenPriceStringToken unit value, priced in USD
>tokenTypeStringToken type:
1: token
2: inscription
>isRiskTokenBooleantrue: flagged as a risk airdrop token
false: not flagged

Request Example#

shell
curl --location --request GET 'https://www.okx.com/api/v5/wallet/asset/all-token-balances-by-address?address=0x50c476a139aab23fdaf9bca12614cdd54a4244e3&chains=1&filter=1' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'

Response Example#

200
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "tokenAssets": [
                {
                    "chainIndex": "1",
                    "tokenAddress": "0xf4d2888d29d722226fafa5d9b24f9164c092421e",
                    "symbol": "LOOKS",
                    "balance": "0.6908810093750312",
                    "tokenPrice": "0.035834243057603148",
                    "tokenType": "1",
                    "isRiskToken": false
                },
                {
                    "chainIndex": "1",
                    "tokenAddress": "0x6570ffe19da7e2b425329b157d9109b87f18304b",
                    "symbol": "UNM",
                    "balance": "0.00157",
                    "tokenPrice": "5.401009128680169",
                    "tokenType": "1",
                    "isRiskToken": false
                },
                {
                    "chainIndex": "1",
                    "tokenAddress": "0x67542502245eb5df64ef7ea776199ceb79401058",
                    "symbol": "$ UniswapLR.com @ 5.75",
                    "balance": "1000",
                    "tokenPrice": "0",
                    "tokenType": "1",
                    "isRiskToken": true
                }
            ]
        }
    ]
}