Wallet API

Total Token Balances#

Query the token balance list for a wallet account across multiple chains or a specified chain. Balance query supports:

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

Additionally, this interface supports filtering out risky airdrop tokens.

Request Path#

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

Request Parameters#

ParameterTypeRequiredDescription
accountIdStringYesUnique identifier for the account.
chainsArrayNoWhen filtering the chains for querying asset details, multiple chains should be separated by commas (,). A maximum of 50 chains is supported.
filterStringNo0: Filter risk tokens
1: Do not filter risk tokens
default is to filter

Response Parameters#

ParameterTypeDescription
tokenAssetsArrayToken balances
>chainIndexStringUnique identifier for the chain
>tokenAddressStringContract address
>symbolStringToken symbol
>balanceStringToken amount
>tokenPriceStringToken value in USD
>tokenTypeStringToken type:
1: token
2: inscription
>isRiskTokenBooleantrue: Risk token
false: Not a risk token
timeStampStringTimestamp when the token was retrieved, Unix timestamp in milliseconds

Request Example#

shell
curl --location --request GET 'https://www.okx.com/api/v5/wallet/asset/wallet-all-token-balances?filter=&chains=1&accountId=31f55853-d430-42c5-b4c6-710d39848cd1' \
--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": [
        {
            "tokenAssets": [
                {
                    "chainIndex": "1",
                    "tokenAddress": "0xf4d2888d29d722226fafa5d9b24f9164c092421e",
                    "symbol": "LOOKS",
                    "balance": "0.6908810093750312",
                    "tokenPrice": "0.035834243057603148",
                    "tokenType": "1",
                    "isRiskToken": false
                },
                {
                    "chainIndex": "1",
                    "tokenAddress": "",
                    "symbol": "ETH",
                    "balance": "8",
                    "tokenPrice": "2650.43",
                    "tokenType": "1",
                    "isRiskToken": false
                }
            ],
            "timeStamp": "1724153197342"
        }
    ],
    "msg": "success"
}