getTokenAccountsByOwnerV2 — Solana JSON-RPC

Status: Available

Enhanced, paginated version of getTokenAccountsByOwner that returns the SPL token accounts owned by a given address.

POSThttps://triport.io/sol
Network
Solana
Scope
sol_read_rpc
Auth
x-token: $TRIPORT_API_KEY (or Authorization: Bearer)
Rate limit
free+ — 20 / 60 / 200 / 600 RPS sustained · short burst 40 / 120 / 400 / 1200 (free / basic / pro / business); Burst capacity

Endpoint and plans: Solana RPC endpoint.

getTokenAccountsByOwnerV2 returns the SPL token accounts owned by a given wallet address, filtered by either a specific mint or a token program. It is the enhanced successor to getTokenAccountsByOwner: the V2 variant adds cursor-based pagination (limit / paginationKey), so owners holding large numbers of token accounts can be enumerated reliably without hitting response-size limits.

Use it when you want to list a wallet's token balances — for example to render a portfolio view or to find the associated token account for a particular mint. For a single mint you should still pass a filter so the validator only returns the relevant accounts rather than the owner's entire token set.

This method is served directly from the validator (not the DAS index), so it is available on the Free trial and up under the sol_read_rpc category. It is not one of the heavily throttled sol_read_rpc_heavy methods, so it carries the standard 20 / 60 / 200 / 600 RPS limits.

Parameters

JSON-RPC positional parameters [owner, filter, config?]:

ownerstring (base-58 pubkey)required
Owner account whose token accounts are returned.
filterobjectrequired
Filter selecting which token accounts to return. Exactly one of mint or programId is expected.
filter.mintstring (base-58 pubkey)optional
Return only accounts holding this specific mint.
filter.programIdstring (base-58 pubkey)optional
Return all accounts owned by this token program (e.g. the SPL Token program).
configobjectoptional
Optional encoding / commitment configuration.
config.commitmentstringoptional
Commitment level: processed, confirmed, or finalized.
config.encodingstringoptional
Account-data encoding: base58, base64, base64+zstd, or jsonParsed.
config.dataSliceobjectoptional
{ offset, length } to return a slice of account data.
config.minContextSlotintegeroptional
Minimum slot at which the request can be evaluated.
config.limitintegeroptional
Maximum number of accounts to return per page (V2 pagination). Without it, a page held 1,000 accounts in our 2026-09-22 check.
config.paginationKeystringoptional
Opaque cursor returned by a prior call to fetch the next page (V2 pagination).

Response

Unlike getTokenAccountsByOwner, whose value is a bare array, V2 returns a page object under value: the accounts array, the cursor for the next page and the number of accounts in this page.

result.context.slotinteger
Slot at which the data was read.
result.value.accountsarray
Matching token accounts in this page.
result.value.accounts[].pubkeystring
Base-58 address of the token account.
result.value.accounts[].accountobject
The decoded account: lamports, owner, data, executable, rentEpoch, space.
result.value.accounts[].account.dataobject/array
Account data, encoded per config.encoding (object when jsonParsed, [<data>, <encoding>] for binary encodings).
result.value.paginationKeystring | null
Cursor for the next page — pass it back as config.paginationKey; null on the last page.
result.value.countinteger
Number of accounts in this page.

Errors

CodeMeaningWhen it happens
401UnauthorizedMissing or invalid Authorization: Bearer API key.
403Forbidden / tier too lowYour plan is below the tier this method requires.
429Rate limitedYou exceeded the requests-per-second limit for your tier (RPS + burst; there is no daily quota).
403Unknown methodMethod name misspelled — plain HTTP body {"error":"method_unknown", …}, no JSON-RPC envelope.
-32602Invalid paramsParameters did not match — e.g. missing owner or a filter with neither mint nor programId.

See the shared errors reference for the full error envelope.

Examples

JavaScript (fetch)

const res = await fetch("https://triport.io/sol", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getTokenAccountsByOwnerV2",
    params: [
      "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1",
      { mint: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" },
      { encoding: "jsonParsed", limit: 100 },
    ],
  }),
});


const { result } = await res.json();
const { accounts, paginationKey } = result.value;
console.log(accounts.length, "accounts; next page:", paginationKey); // null on the last page

Notes

  • Beta: published schema not final. The endpoint serves V2 today and the fields above are what it returns; the OpenRPC schema still declares no params and an open result object until spec api.2.2+. Re-check this page when that spec ships.
  • Tier: available on the Free trial and up under sol_read_rpc (20 / 60 / 200 / 600 RPS for free / basic / pro / business). See rate limits and tiers.
  • Filter required: as with getTokenAccountsByOwner, supply exactly one of filter.mint or filter.programId. Use mint to find a single associated token account and programId (the SPL Token program) to list all of an owner's token accounts.
  • Pagination: pass limit, then send each response's value.paginationKey back as config.paginationKey; keep requesting pages until it comes back null.
  • Related methods: getTokenAccountsByOwner (the non-paginated original), getTokenAccountBalance, and the DAS-indexed getTokenAccounts.