Wallet API
Get Specified Token Balances

Get Specified Token Balances#

Query the balances of certain specified tokens under a user wallet or watch-only wallet.

Note
To use this API:For user wallet account, only added tokens are supported. For watch-only wallet accounts, only default tokens included in Wallet API are supported.

Request Path#

GET https://www.okx.com/api/waas/wallet/asset/token-balances

Request Parameters#

ParameterTypeRequiredDescription
accountIdStringYesUnique identifier of the account
tokenAddressesArrayYesList of tokens. The maximum number of items in the list is 20
>chainIndexStringYesUnique identifier of the chain
>tokenAddressStringYesToken address. An empty string "" represents the native token

Response Parameters#

ParameterTypeDescription
chainIndexStringUnique identifier of the chain
tokenAddressStringContract address
symbolStringAbbreviation of the token
balanceStringBalance of the token
tokenPriceStringPrice of the token (USD)
tokenTypeStringToken type:
1: token
2: inscription
3: LP token

Request Example#

shell
curl --location --request POST 'https://www.okx.com/api/v5/waas/wallet/asset/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 '{
    "accountId":"",
    "tokenAddresses": [
        {
            "chainIndex": "5",
            "tokenAddress": "0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2"
        },
        {
            "chainIndex": "7",
            "tokenAddress": "0xdf444b6c6195ea4d948d04cfd818d365cf175cee3"
        }
    ]
}'

Response Example#

200
{
    "code": "0",
    "data": [
        {
            "chainIndex": "1",
            "tokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7",
            "symbol": "USDT",
            "balance": "0.688467",
            "tokenPrice": "0.99977",
            "tokenType": "1"
        },
        {
            "chainIndex": "42161",
            "tokenAddress": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
            "symbol": "USDT",
            "balance": "0.026782",
            "tokenPrice": "0.99977",
            "tokenType": "1"
        }
    ],
    "msg": "success"
}