TriportRPC

getTokenAccountsByOwner

Last updated:

getTokenAccountsByOwner returns every SPL Token account held by a wallet (owner), narrowed by a required filter. You filter by exactly one of mint (return only the owner's account(s) for that specific token) or programId (return all of the owner's accounts owned by that token program, e.g. the SPL Token program). You must supply one and only one of the two — not both, and not neither.

Use it to discover a wallet's token holdings: which mints it holds, the address of each token account, and — with jsonParsed encoding — the decoded balance for each. Each entry in the result pairs the token account's pubkey with its full on-chain account state, all read at a single slot so the snapshot is internally consistent.

This is the standard Solana JSON-RPC method and works on any wallet. It is distinct from the Digital Asset Standard getTokenAccounts, which is a sol_das method (basic+ tier) with cursor pagination and a different result shape; getTokenAccountsByOwner here is sol_read_rpc and available from the free tier.

Parameters

getTokenAccountsByOwner parameters
NameTypeRequiredDescription
ownerPubkeyYes
filterTokenAccountsFilterYes
configGetTokenAccountsConfigNo

Returns

getTokenAccountsByOwner return value
FieldType
resultobject

Examples

curl https://triport.io/sol \
  -X POST -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <api-key>' \
  -d '{"id":1,"method":"getTokenAccountsByOwner","params":["<owner>","<filter>","<config>"],"jsonrpc":"2.0"}'
const res = await fetch("https://triport.io/sol", {
  method: "POST",
  headers: { "Content-Type": "application/json", Authorization: "Bearer <api-key>" },
  body: JSON.stringify({
  "id": 1,
  "method": "getTokenAccountsByOwner",
  "params": [
    "<owner>",
    "<filter>",
    "<config>"
  ],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post(
    "https://triport.io/sol",
    headers={"Authorization": "Bearer <api-key>"},
    json={"id":1,"method":"getTokenAccountsByOwner","params":["<owner>","<filter>","<config>"],"jsonrpc":"2.0"},
)
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet, devnet, testnet.
  3. Credit cost: 1 per call.

FAQ

What does getTokenAccountsByOwner do?
Returns all SPL Token accounts owned by a given wallet, filtered by a single mint or token program.
How many credits does getTokenAccountsByOwner cost?
getTokenAccountsByOwner costs 1 credit(s) per call on Triport by default.
Is getTokenAccountsByOwner available over WebSocket?
getTokenAccountsByOwner is an HTTP JSON-RPC method.