查询特定代币#
查询钱包账户下某些指定代币的余额。
请求路径#
POST https://web3.okx.com/api/v5/wallet/asset/token-balances 
请求参数#
| Parameter | Type | Required | Description | 
|---|---|---|---|
| accountId | String | Yes | 账户唯一标识 | 
| tokenAddresses | Array | Yes | 代币列表。列表的上限是20 | 
| >chainIndex | String | Yes | 链唯一标识 | 
| >tokenAddress | String | Yes | 代币地址。 1:传""代表查询对应链的主链币。2:传具体的代币合约地址,代表查询对应的代币。3:不同铭文代币按如下格式入参:FBRC-20: 使用fbtc_fbrc20_name,如 fbtc_fbrc20_babymuskBRC-20: 使用btc-brc20-tick(name),如 btc-brc20-ordiRunes: 使用 btc-runesMain-tickId,如 btc-runesMain-840000:2SRC-20:使用btc-src20-name,如 btc-src20-utxo | 
响应参数#
| Parameter | Type | Description | 
|---|---|---|
| tokenAssets | Array | 代币余额列表 | 
| >chainIndex | String | 链唯一标识 | 
| >tokenAddress | String | 代币地址。为空 "" 代表返回结果是相关链,主链币的数据 | 
| >symbol | String | 代币简称 | 
| >balance | String | 代币数量 | 
| >rawBalance | String | 代币的原始数量。更多的链即将被支持。对于不支持的链,该字段为空 | 
| >tokenPrice | String | 币种单价价值,以美元计价 | 
| >tokenType | String | 币种类型: 1:token2:铭文 | 
| >isRiskToken | Boolean | true: 命中风险空投币false: 未命中风险空投币 | 
请求示例#
shell
curl --location --request POST 'https://web3.okx.com/api/v5/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": "4686531e-3adb-469a-8000-8fd1c2097f68",
    "tokenAddresses": [
        {
            "chainIndex": "1",
            "tokenAddress": ""
        },
        {
            "chainIndex": "0",
            "tokenAddress": "btc-brc20-psat"
        }
    ]
}'
响应示例#
200
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "tokenAssets": [
                {
                    "chainIndex": "1",
                    "tokenAddress": "",
                    "symbol": "ETH",
                    "balance": "0.07210371955388872",
                    "rawBalance": "",
                    "tokenPrice": "2650.43",
                    "tokenType": "1",
                    "isRiskToken": false
                },
                {
                    "chainIndex": "0",
                    "tokenAddress": "btc-brc20-psat",
                    "symbol": "psat",
                    "balance": "1",
                    "rawBalance": "",
                    "tokenPrice": "140",
                    "tokenType": "2",
                    "isRiskToken": false
                }
            ]
        }
    ]
}
