getTokenAccountBalance
Returns the token balance of an SPL Token account.

Parameters

  • <base-58 encoded string> - Pubkey of queried token account
  • <object> - (optional) Config object:
    • commitment: <object> - (optional) Configures the commitment level of the blocks queried Accepts one of the following strings: ["finalized", "confirmed", "processed"] For more info, refer to this doc.

Results

  • amount: <u64 string> - the raw balance without decimals
  • decimals: <u8> - number of base 10 digits to the right of the decimal place
  • uiAmountString: <string> - the balance as a string, using mint-prescribed decimals

Example

Request

cURL
1
curl --location --request POST 'https://solana-mainnet.g.alchemy.com/v2/alch-demo/' \
2
--header 'Content-Type: application/json' \
3
--data-raw '{
4
"method": "getTokenAccountBalance",
5
"jsonrpc": "2.0",
6
"params": [
7
"3Lz6rCrXdLybFiuJGJnEjv6Z2XtCh5n4proPGP2aBkA1"
8
],
9
"id": "017a141e-9a15-4ce3-b039-865e7dc7da00"
10
}'
Copied!

Response

1
{
2
"jsonrpc": "2.0",
3
"result": {
4
"context": {
5
"slot": 137567036
6
},
7
"value": {
8
"amount": "301922375078",
9
"decimals": 6,
10
"uiAmount": 301922.375078,
11
"uiAmountString": "301922.375078"
12
}
13
},
14
"id": "017a141e-9a15-4ce3-b039-865e7dc7da00"
15
}
Copied!