GET
/
v0
/
token
/
balance
/
get
from compassapisdk import CompassAPISDK, models


with CompassAPISDK(
    api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api_sdk:

    res = compass_api_sdk.token.balance(chain=models.TokenBalanceChain.ARBITRUM_MAINNET, user="0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B", token="<value>")

    # Handle response
    print(res)
{
  "amount": 1.5,
  "decimals": 18,
  "token_symbol": "WETH",
  "token_address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Query Parameters

chain
enum<string>
default:arbitrum:mainnet
required

The chain to use.

Available options:
base:mainnet,
ethereum:mainnet,
arbitrum:mainnet
user
string
default:0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B
required
token
default:USDC
required

A class representing the token.

This class is used to represent the token in the system. Notice individual endpoints' documentation where per chain tokens are presented.

Available options:
1INCH,
AAVE,
BAL,
cbBTC,
cbETH,
CRV,
crvUSD,
DAI,
ENS,
ETHx,
FRAX,
FXS,
GHO,
KNC,
LDO,
LINK,
LUSD,
MKR,
osETH,
PYUSD,
rETH,
RPL,
rsETH,
sDAI,
SNX,
STG,
sUSDe,
tBTC,
UNI,
USDC,
USDe,
USDS,
USDT,
WBTC,
weETH,
WETH,
wstETH,
ARB,
EURS,
MAI,
USDCe,
AERO,
EUR,
VIRTUAL

Response

200
application/json
Successful Response

Response model for token balance information.

amount
string
required

Amount of tokens a particular address holds

Examples:

1.5

decimals
integer
required

Number of decimals of the token

Examples:

18

token_symbol
required

Symbol of the token.

Available options:
1INCH,
AAVE,
BAL,
cbBTC,
cbETH,
CRV,
crvUSD,
DAI,
ENS,
ETHx,
FRAX,
FXS,
GHO,
KNC,
LDO,
LINK,
LUSD,
MKR,
osETH,
PYUSD,
rETH,
RPL,
rsETH,
sDAI,
SNX,
STG,
sUSDe,
tBTC,
UNI,
USDC,
USDe,
USDS,
USDT,
WBTC,
weETH,
WETH,
wstETH,
ARB,
EURS,
MAI,
USDCe,
AERO,
EUR,
VIRTUAL
Examples:

"WETH"

token_address
string
required

Address of the token

Examples:

"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"