Portfolio and balances
Get balance
GET /v1/balance returns the balance of one native asset or token for an address.
Endpoint
Query
chainId,address(required)token(optional) — token id in the chain's format (below); omit for nativerelatedAddresses(optional) — Gram siblings
curl -sS "https://blockchain.gray3.io/v1/balance?chainId=ethereum&address=0xYourAddress&token=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" \
-H "X-Gray-Project-Id: proj_your_project_id" \
-H "Authorization: Bearer gray_sk_your_secret"Token ids
The token value is the same string the portfolio returns as the asset address:
- EVM, TRON — contract address. Solana — mint. Sui, Aptos — coin type.
- Stellar —
CODE:ISSUER. XRP Ledger —CURRENCY:ISSUER(currency as returned by the ledger, 3-char or 40-hex). - Hedera — token id
0.0.N. Algorand — asset id. NEAR — token contract account. - Gram (TON) — jetton master address. Cardano — policy id + hex asset name. Stacks — token contract principal. Cosmos Hub — bank denom (
ibc/…,factory/…).
On Bitcoin-family chains, Polkadot, Bittensor, Kaspa, Filecoin and Monero only the native coin is available; VeChain also returns VTHO.
Response
HTTP 200 — success envelope wraps the payload in data.
{
"data": {
"chainId": "ethereum",
"address": "0xYourAddress",
"token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"asset": {
"chainId": "ethereum",
"address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"symbol": "USDC",
"name": "USD Coin",
"decimals": 6,
"balance": "250000000",
"priceUsd": "1.00",
"balanceUsd": "250.00"
},
"source": "indexer"
}
}asset is null when the token is not held (zero balance)—not an HTTP error.
Errors
Errors use HTTP { "error": { "code", "message", "retryable" } }. Branch on code, not the message text.
Every authenticated route may also return unauthorized (401), revoked_secret (401), forbidden (403), credits_exhausted (402), plan_feature_denied (403), rate_limit_exceeded (429, retryable), and invalid_argument (413) for request bodies over 256 KiB.
| Code | HTTP | When |
|---|---|---|
| invalid_argument | 400 | Missing or malformed chainId, address, or body fields |
| plan_chain_denied | 403 | chainId is not on the project plan |
| chain_disabled | 403 | Chain turned off in Console › Networks |
| unsupported_capability | 400 | Capability not offered for this chain (e.g. testnet prices) |
| portfolio_unavailable | 503 | Balance data is temporarily unavailable (retryable) |
{
"error": {
"code": "invalid_argument",
"message": "Human-readable detail (may be sanitized).",
"retryable": false
}
}