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#
Parameter | Type | Required | Description |
---|---|---|---|
address | String | Yes | Address |
tokenContractAddresses | Array | Yes | List of tokens addresses to query. Maximum of 20 items. |
>chainIndex | String | Yes | Unique identifier for the chain. e.g., 1 : Ethereum. See more here. |
>tokenContractAddress | String | Yes | Token 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. |
excludeRiskToken | String | No | Option to filter out risky airdrop & honeypot tokens. Default is to filter 0 : Filter out 1 : Do not filter outIt supports only ETH 、BSC 、SOL 、BASE for honeypot tokens, more chains will be supported soon. |
Response Parameters#
Parameter | Type | Description |
---|---|---|
tokenAssets | Array | List for token balances |
>chainIndex | String | Unique identifier for the chain |
>tokenContractAddress | String | Token address.If the return is an empty string "" , it means the query is for the native token of the corresponding blockchain. |
>address | String | Address |
>symbol | String | Token symbol |
>balance | String | Token balance. |
>rawBalance | String | Raw balance of token address. For unsupported chains, this field is empty. More chains will be supported soon. |
>tokenPrice | String | Token price in USD |
>isRiskToken | Boolean | true : 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": ""
}
]
}
]
}