钱包 API

资产明细#

查询钱包账户持有的多个链或指定链的 token 余额列表。 余额查询支持:

  • 主链币
  • EVM 链的 ERC20 代币
  • Bitcoin 生态的 BRC-20、ARC-20、Runes 和 SRC-20 代币
  • Fractal Bitcoin 链的 BRC-20 代币

此外,该接口支持过滤风险空投代币。

请求路径#

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

请求参数#

ParameterTypeRequiredDescription
accountIdStringYes账户唯一标识。
chainsStringNo筛选需要查询资产明细的链,多条链以","分隔。最多支持 50 个
filterStringNo0: 过滤风险空投币
1: 不过滤风险空投币
默认过滤

响应参数#

ParameterTypeDescription
tokenAssetsArray代币余额
>chainIndexString链唯一标识
>tokenAddressString合约地址
>addressString钱包地址
>symbolString代币简称
>balanceString代币数量
>tokenPriceString币种单位价值,以美元计价
>tokenTypeString币种类型:
1: 代币
2: 铭文
>isRiskTokenBooleantrue: 命中风险空投币
false: 未命中风险空投币
timeStampString币种获取的时间,Unix 时间戳,用毫秒表示

请求示例#

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'

响应示例#

200
{
    "code": "0",
    "data": [
        {
            "tokenAssets": [
                {
                    "chainIndex": "1",
                    "tokenAddress": "0xf4d2888d29d722226fafa5d9b24f9164c092421e",
                    "symbol": "LOOKS",
                    "balance": "0.6908810093750312",
                    "tokenPrice": "0.035834243057603148",
                    "tokenType": "1",
                    "isRiskToken": false,
                    "address":"0xa03400e098f4421b34a3a44a1b4e571419517687"

                },
                {
                    "chainIndex": "1",
                    "tokenAddress": "",
                    "symbol": "ETH",
                    "balance": "8",
                    "tokenPrice": "2650.43",
                    "tokenType": "1",
                    "isRiskToken": false,
                    "address":"0xa03400e098f4421b34a3a44a1b4e571419517687"
                }
            ],
            "timeStamp": "1724153197342"
        }
    ],
    "msg": "success"
}