Solana RPC · Accounts & balances
POST getTokenAccountBalance
Token balance of an SPL token account.
Endpoint
POST https://solrpc.infinityblocks.io/<API_KEY>
Standard Solana JSON-RPC 2.0 over HTTP POST. The API key is part of the URL path.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
account | string | yes | Base-58 SPL token account pubkey. |
config | object | no | commitment. |
Request
curl -s https://solrpc.infinityblocks.io/<API_KEY> \
-X POST -H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getTokenAccountBalance","params":["<TOKEN_ACCOUNT>",{"commitment":"confirmed"}]}'
With @solana/web3.js
const bal = await rpc.getTokenAccountBalance(new PublicKey("<TOKEN_ACCOUNT>"));
Response
{ "jsonrpc": "2.0", "id": 1, "result": { "context": { "slot": 423214981 }, "value": { "amount": "41152213702243", "decimals": 6, "uiAmount": 41152213.702243, "uiAmountString": "41152213.702243" } } }
Try it
Run getTokenAccountBalancelive · POST
Replace placeholders (e.g. <ADDRESS>) with real values. Your key is stored only in this browser.
—