Skip to main content
Returns all SPL token accounts owned by a given wallet. Filter by mint address to get accounts for a specific token, or by program ID to get all token accounts for a given token program.

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getTokenAccountsByOwner",
  "params": [
    "A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd",
    { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" },
    { "encoding": "jsonParsed" }
  ]
}

Parameters

owner
string
required
Base-58 encoded public key of the wallet to query.
filter
object
required
Exactly one of the following filter fields must be provided:
  • mint (string) — return only token accounts for this specific mint address.
  • programId (string) — return all token accounts owned by this token program (e.g. TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA for SPL Token).
encoding
string
Encoding for account data. Use jsonParsed to get human-readable token data. Defaults to base64.
commitment
string
Commitment level for the query. One of processed, confirmed, or finalized.

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": { "slot": 1114 },
    "value": [
      {
        "pubkey": "BGocb4GEpbTFm8UFV2RkDSinaGPGVVfH1aBqN97dZ3ZR",
        "account": {
          "lamports": 1726080,
          "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
          "data": {
            "program": "spl-token",
            "parsed": {
              "info": {
                "tokenAmount": {
                  "amount": "4900",
                  "decimals": 2,
                  "uiAmount": 49.0,
                  "uiAmountString": "49"
                },
                "mint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
                "owner": "A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd",
                "state": "initialized"
              },
              "type": "account"
            }
          },
          "executable": false,
          "rentEpoch": 0
        }
      }
    ]
  }
}
value
array
Array of token account objects.
value[].pubkey
string
Base-58 encoded address of the token account.
value[].account.data.parsed.info.mint
string
The mint address for the token held in this account.
value[].account.data.parsed.info.owner
string
The wallet address that owns this token account.
value[].account.data.parsed.info.tokenAmount
object
Token balance details: amount, decimals, uiAmount, and uiAmountString.
value[].account.data.parsed.info.state
string
Account state: initialized, frozen, or uninitialized.

Example

curl "https://rpc.solami.fast/sol?api_key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getTokenAccountsByOwner",
    "params": [
      "A1TMhSGzQxMr1TboBKtgixKz1sS6REASMxPo1qsyTSJd",
      { "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" },
      { "encoding": "jsonParsed" }
    ]
  }'