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`](./getTokenAccounts.md), 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
| Name | Type | Required | Description |
|---|---|---|---|
| owner | Pubkey | Yes | |
| filter | TokenAccountsFilter | Yes | |
| config | GetTokenAccountsConfig | No |
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getTokenAccountsByOwner","params":["<owner>","<filter>","<config>"]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
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://<your-endpoint>/", json={"id":1,"method":"getTokenAccountsByOwner","params":["<owner>","<filter>","<config>"],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- 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.