Skip to main content

0.01 credits per call

getTokenAccountBalance on Solana: Returns the token balance of an SPL token account.

Endpoint

https://rpc.goldrushdata.com/v1/solana-mainnet
Authenticate with Authorization: Bearer <GOLDRUSH_API_KEY>. See authentication.

Parameters

NameTypeRequiredDescriptionExample
accountstringyesBase-58 encoded SPL token account address."7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7"
configobjectno{commitment?}.{"commitment":"finalized"}

Returns

object: {context, value: {amount, decimals, uiAmount, uiAmountString}}.
{"context":{"slot":372877175},"value":{"amount":"1000000","decimals":6,"uiAmount":1.0,"uiAmountString":"1"}}

Examples

curl https://rpc.goldrushdata.com/v1/solana-mainnet \
  -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTokenAccountBalance",
    "params": ["7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7", {"commitment":"finalized"}]
  }'

Errors

CodeMessage
-32602Account is not an SPL token account.
Plus standard JSON-RPC errors: -32600 invalid request, -32601 method not found, -32602 invalid params.