Wallet API
Query Balance by Watch-only Account

Query Balance by Watch-only Account#

Query the token balance list of multiple chains or specified chains held by the wallet account.

Balance query supports:

  • Main chain coins
  • ERC20 tokens on EVM chains
  • BRC-20, ARC-20, Runes, and SRC-20 tokens in the Bitcoin ecosystem
Note
For wallet accounts, the queried tokens need to be added first through the Add Token interface.

Request Path#

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

Request Parameters#

ParameterTypeRequiredDescription
accountIdStringYesUnique identifier of the account.
chainsArrayNoList of chainIndex, can filter the token display by chains. The maximum number of elements in the list is 20.
limitStringNoNumber of entries per query, default is 50, maximum is 100
cursorStringNoCursor position, default is the first

Response Parameters#

ParameterTypeDescription
cursorStringCursor position
tokenAssetsArrayToken assets
>chainIndexStringUnique identifier of the chain
>tokenTypeStringToken type:
1: token
2: inscription
3: LP token
>tokenAddressStringContract address
>symbolStringAbbreviation of the token
>balanceStringBalance of the token
>tokenPriceStringPrice of the token in USD

Request Example#

shell
curl --location --request GET 'https://www.okx.com/api/v5/wallet/asset/all-token-balances?accountId=44486e05-3235-2f8e-5fe2-a8ab46217863&chains=1,2' \
--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",
    "data": [
        {
            "cursor":"23",
            "tokenAssets":[
                {
                    "chainIndex": "1",
                    "tokenType": "0",
                    "tokenAddress": "",
                    "symbol":"ETH",
                    "balance":"1.2",
                    "tokenPrice": "3899.00",
                },
                {
                    "chainIndex": "1",
                    "tokenType": "2",
                    "tokenAddress": "0xe466b8eaa1851e27047ba0f956e5110cf4d27f19",
                    "symbol":"pufETH",
                    "balance":"1.2",
                    "tokenPrice": "3899.00",
                },
                {
                    "chainIndex": "0",
                    "tokenType": "1",
                    "tokenAddress": "",
                    "symbol":"ordi",
                    "balance":"58909090",
                    "tokenPrice": "21834.85",
                }
            ]
        }
    ]
    "msg": "success"
}