getTokenAccountBalance
Last updated:
`getTokenAccountBalance` returns the balance held by one **SPL Token account**: the raw integer `amount`, the token's `decimals`, and the human-readable `uiAmount` / `uiAmountString` already scaled by those decimals.
The `pubkey` you pass must be the address of a **token account** — not the wallet that owns it, and not the token mint. A token account is the per-mint holding account derived for an owner (commonly the associated token account). Passing a wallet or a mint address yields an invalid-params error rather than a balance. To go from a wallet to its token accounts, resolve them first with `getTokenAccountsByOwner`, then call this method on the resulting account addresses.
The balance is reported relative to a particular slot, returned in the `context` object. Use the optional `commitment` config to control how finalized that slot must be, and `minContextSlot` to require the node has reached at least a given slot before serving the request.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| pubkey | Pubkey | Yes | |
| config | CommitmentConfig | No |
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getTokenAccountBalance","params":["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "getTokenAccountBalance",
"params": [
"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getTokenAccountBalance","params":["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- Credit cost: 1 per call.
FAQ
- What does getTokenAccountBalance do?
- Returns the token balance of a single SPL Token account.
- How many credits does getTokenAccountBalance cost?
- getTokenAccountBalance costs 1 credit(s) per call on Triport by default.
- Is getTokenAccountBalance available over WebSocket?
- getTokenAccountBalance is an HTTP JSON-RPC method.