Market API

Get Specific Token Balance#

Query the balance of a specific token under an address.

Request URL#

POST https://web3.okx.com/api/v5/dex/balance/token-balances-by-address

Request Parameters#

ParameterTypeRequiredDescription
addressStringYesAddress
tokenContractAddressesArrayYesList of tokens addresses to query. Maximum of 20 items.
>chainIndexStringYesUnique identifier for the chain.
e.g., 1: Ethereum.
See more here.
>tokenContractAddressStringYesToken address.
1: Pass an empty string "" to query the native token of the corresponding chain.
2: Pass the specific token contract address to query the corresponding token.
excludeRiskTokenStringNoOption to filter out risky airdrop & honeypot tokens. Default is to filter
0: Filter out
1: Do not filter out
It supports only ETHBSCSOLBASE for honeypot tokens, more chains will be supported soon.

Response Parameters#

ParameterTypeDescription
tokenAssetsArrayList for token balances
>chainIndexStringUnique identifier for the chain
>tokenContractAddressStringToken address.If the return is an empty string "", it means the query is for the native token of the corresponding blockchain.
>addressStringAddress
>symbolStringToken symbol
>balanceStringToken balance.
>rawBalanceStringRaw balance of token address. For unsupported chains, this field is empty. More chains will be supported soon.
>tokenPriceStringToken price in USD
>isRiskTokenBooleantrue: flagged as a risky airdrop & honeypot token
false: not flagged as a risky airdrop & honeypot token

Request Example#

shell
curl --location --request POST 'https://web3.okx.com/api/v5/dex/balance/token-balances' \
--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' \
--data-raw '{
    "address": "0x50c476a139aab23fdaf9bca12614cdd54a4244e3",
    "tokenContractAddresses": [
        {
            "chainIndex": "1",
            "tokenContractAddress": ""
        }
    ]
}'

Response Example#

200
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "tokenAssets": [
                {
                    "chainIndex": "1",
                    "tokenContractAddress": "",
                    "symbol": "eth",
                    "balance": "0",
                    "tokenPrice": "3640.43",
                    "isRiskToken": false,
                    "rawBalance": "",
                    "address": ""
                }
            ]
        }
    ]
}