Skip to main content

getTokenAccountBalance

POST

Returns the token balance of an SPL Token account.
param[0]
pubkeyOfTokenAccountstringrequired
Pubkey of Token account to query, as base-58 encoded string
param[1]
configurationObjectobjectrequired
commitmentstring
The commitment describes how finalized a block is at that point in time.
  • finalized - the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized
  • confirmed - the node will query the most recent block that has been voted on by supermajority of the cluster.
  • processed - the node will query its most recent block. Note that the block may still be skipped by the cluster.
Responses
idinteger
The request ID
jsonrpcstring
The JSON-RPC version
An object containing metadata about the current state of the Solana network at the time of the request.
apiVersionstring
The API version used for the request
slotinteger
The slot number at which the request was evaluated
amountstring
The raw balance without decimals, a string representation of u64
decimalsnumber
Number of base 10 digits to the right of the decimal place
uiAmountnumber
DEPRECATED The balance, using mint-prescribed decimals
uiAmountStringstring
The balance as a string, using mint-prescribed decimals
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Bad Request"
}
cURL
curl -X POST 'https://solana-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getTokenAccountBalance",
"params": [
"7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7",
{
"commitment": "finalized"
}
]
}'