Get Token Balance Details By Address#

Get Token Balance Detail for an address to get information about the balance of all tokens on that address.

Request Path#

GET
https://web3.okx.com/api/v5/xlayer/address/token-balance

Request Parameters#

ParameterTypeRequiredDescription
chainShortNameStringYesThe abbreviated name of the blockchain network, e.g, XLAYER
addressStringYesAddress
protocolTypeStringYesContract protocol Type token_20 token_721 token_1155
tokenContractAddressStringNoToken Contract Address
pageStringNoPage
limitStringNoThe number of results returned per request. The maximum is 50. The default is 20.

Response Parameters#

ParameterTypeDescription
pageStringCurrent page number
limitStringThe amount of data
totalPageStringTotal number of pages
tokenListArrayToken list
> symbolStringSymbol of the token
> tokenContractAddressStringToken Contract Address
> holdingAmountStringThe holding amount of the token
> priceUsdStringToken price in USD
> valueUsdStringTotal token value in USD
> tokenIdStringNFT token ID

Request Example#

shell
curl --location --request GET 'https://web3.okx.com/api/v5/xlayer/address/token-balance?chainShortName=xlayer&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d&protocolType=token_20&limit=1' \
--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#

json
{
    "code": "0",
    "msg": "",
    "data": [
        {
            "limit": "1",
            "page": "1",
            "totalPage": "2",
            "tokenList": [
                {
                    "symbol": "USDT",
                    "tokenContractAddress": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
                    "tokenType": "ERC20",
                    "holdingAmount": "614.05118",
                    "priceUsd": "1.00062",
                    "valueUsd": "614.4318917316",
                    "tokenId": ""
                }
            ]
        }
    ]
}