钱包 API
获取指定代币余额

获取指定代币余额#

查询用户钱包或观察钱包下某些指定代币的余额。

注意
使用该接口:对于用户钱包,仅支持已添加过的币种。对于观察钱包,仅包含OKX平台币种。

请求路径#

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

请求参数#

ParameterTypeRequiredDescription
accountIdStringYes账户唯一标识
tokenAddressesArrayYes代币列表。列表的上限是20
>chainIndexStringYes链唯一标识
>tokenAddressStringYes代币地址。空字符串"",代表主网币

响应参数#

ParameterTypeDescription
chainIndexString链唯一标识
tokenAddressString合约地址
symbolString代币简称
balanceString代币数量
tokenPriceString币种单位价值,以美元计价
tokenTypeString币种类型。
1: 代币
2: 铭文
3: LP 代币

请求示例#

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": "1",
            "tokenAddress": "0xdac17f958d2ee523a2206206994597c13d831ec7"
        },
        {
            "chainIndex": "42161",
            "tokenAddress": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
        }
    ]
}'

响应示例#

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"
}