curl -X GET "https://api.chipipay.com/v1/chipi-wallets/token-balance?externalUserId=user_123&chainToken=USDC&chain=STARKNET" \
-H "Authorization: Bearer sk_prod_xxxx" \
-H "x-api-key: pk_xxxx"
const params = new URLSearchParams({
externalUserId: "user_123",
chainToken: "USDC",
chain: "STARKNET"
});
const response = await fetch(
`https://api.chipipay.com/v1/chipi-wallets/token-balance?${params}`,
{
headers: {
"Authorization": "Bearer sk_prod_xxxx",
"x-api-key": "pk_xxxx",
}
}
);
const balance = await response.json();
// balance.balance is a raw integer string — use BigInt for precision
const raw = BigInt(balance.balance);
const scale = 10n ** BigInt(balance.decimals);
const whole = raw / scale;
const fraction = (raw % scale).toString().padStart(balance.decimals, "0").replace(/0+$/, "");
const humanReadable = fraction ? `${whole}.${fraction}` : `${whole}`;
import requests
from decimal import Decimal
response = requests.get(
"https://api.chipipay.com/v1/chipi-wallets/token-balance",
params={
"externalUserId": "user_123",
"chainToken": "USDC",
"chain": "STARKNET"
},
headers={
"Authorization": "Bearer sk_prod_xxxx",
"x-api-key": "pk_xxxx",
}
)
balance = response.json()
human_readable = Decimal(balance["balance"]) / (Decimal(10) ** balance["decimals"])
{
"chain": "STARKNET",
"chainToken": "USDC",
"chainTokenAddress": "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
"decimals": 6,
"balance": "15000000"
}
Wallets
Get Token Balance
Get the balance of a specific token for a wallet
GET
/
chipi-wallets
/
token-balance
curl -X GET "https://api.chipipay.com/v1/chipi-wallets/token-balance?externalUserId=user_123&chainToken=USDC&chain=STARKNET" \
-H "Authorization: Bearer sk_prod_xxxx" \
-H "x-api-key: pk_xxxx"
const params = new URLSearchParams({
externalUserId: "user_123",
chainToken: "USDC",
chain: "STARKNET"
});
const response = await fetch(
`https://api.chipipay.com/v1/chipi-wallets/token-balance?${params}`,
{
headers: {
"Authorization": "Bearer sk_prod_xxxx",
"x-api-key": "pk_xxxx",
}
}
);
const balance = await response.json();
// balance.balance is a raw integer string — use BigInt for precision
const raw = BigInt(balance.balance);
const scale = 10n ** BigInt(balance.decimals);
const whole = raw / scale;
const fraction = (raw % scale).toString().padStart(balance.decimals, "0").replace(/0+$/, "");
const humanReadable = fraction ? `${whole}.${fraction}` : `${whole}`;
import requests
from decimal import Decimal
response = requests.get(
"https://api.chipipay.com/v1/chipi-wallets/token-balance",
params={
"externalUserId": "user_123",
"chainToken": "USDC",
"chain": "STARKNET"
},
headers={
"Authorization": "Bearer sk_prod_xxxx",
"x-api-key": "pk_xxxx",
}
)
balance = response.json()
human_readable = Decimal(balance["balance"]) / (Decimal(10) ** balance["decimals"])
{
"chain": "STARKNET",
"chainToken": "USDC",
"chainTokenAddress": "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
"decimals": 6,
"balance": "15000000"
}
curl -X GET "https://api.chipipay.com/v1/chipi-wallets/token-balance?externalUserId=user_123&chainToken=USDC&chain=STARKNET" \
-H "Authorization: Bearer sk_prod_xxxx" \
-H "x-api-key: pk_xxxx"
const params = new URLSearchParams({
externalUserId: "user_123",
chainToken: "USDC",
chain: "STARKNET"
});
const response = await fetch(
`https://api.chipipay.com/v1/chipi-wallets/token-balance?${params}`,
{
headers: {
"Authorization": "Bearer sk_prod_xxxx",
"x-api-key": "pk_xxxx",
}
}
);
const balance = await response.json();
// balance.balance is a raw integer string — use BigInt for precision
const raw = BigInt(balance.balance);
const scale = 10n ** BigInt(balance.decimals);
const whole = raw / scale;
const fraction = (raw % scale).toString().padStart(balance.decimals, "0").replace(/0+$/, "");
const humanReadable = fraction ? `${whole}.${fraction}` : `${whole}`;
import requests
from decimal import Decimal
response = requests.get(
"https://api.chipipay.com/v1/chipi-wallets/token-balance",
params={
"externalUserId": "user_123",
"chainToken": "USDC",
"chain": "STARKNET"
},
headers={
"Authorization": "Bearer sk_prod_xxxx",
"x-api-key": "pk_xxxx",
}
)
balance = response.json()
human_readable = Decimal(balance["balance"]) / (Decimal(10) ** balance["decimals"])
{
"chain": "STARKNET",
"chainToken": "USDC",
"chainTokenAddress": "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
"decimals": 6,
"balance": "15000000"
}
Notes
- The
balancefield is a raw integer string. Divide by10^decimalsto get the human-readable amount. In the example above,15000000 / 10^6 = 15.0 USDC. - You can identify the wallet by either
externalUserIdorwalletPublicKey. At least one is required.
Authorizations
Bearer token — use your secret key (sk_prod_xxx) for server-side calls, or the user's JWT for client-side calls
Your Chipi public API key (pk_xxx)
Query Parameters
Your application's user identifier (provide this or walletPublicKey)
The wallet's public key / address (provide this or externalUserId)
The token to query Token identifier
Available options:
USDC, USDC_E, USDT, DAI, ETH, STRK, SLINK, ALF, BROTHER, ARB, DOC, MXNB, WLD, WBTC, OTHER The blockchain network Blockchain network identifier
Available options:
STARKNET, BASE, ARBITRUM, OPTIMISM, ROOTSTOCK, SCROLL, WORLDCHAIN Response
Token balance
Blockchain network identifier
Available options:
STARKNET, BASE, ARBITRUM, OPTIMISM, ROOTSTOCK, SCROLL, WORLDCHAIN Token identifier
Available options:
USDC, USDC_E, USDT, DAI, ETH, STRK, SLINK, ALF, BROTHER, ARB, DOC, MXNB, WLD, WBTC, OTHER The token's contract address on the chain
Number of decimal places for the token
The raw balance (divide by 10^decimals for human-readable amount)
Was this page helpful?
⌘I
