TriportRPC

getTokenAccounts

POSThttps://api.triport.io

Digital Asset Standard (DAS) lookup that returns the token accounts associated with a mint or owner in a single call.

Solanasol_dasbasic+ (DAS category)

getTokenAccounts is part of the Digital Asset Standard (DAS) family of methods. It is intended to return the SPL token accounts tied to a given mint or owner, combining the token-account enumeration that would otherwise require multiple getTokenAccountsByOwner / getTokenAccountsByDelegate calls into a single DAS-indexed query.

Use it when you need to enumerate token holdings without first knowing the exact program-account filters, or when you want the DAS index's faster, paginated view of large account sets. Because DAS methods are served from an index rather than the validator directly, they require at least the basic tier.

This is a scaffold entry (summary: "scaffold — described by api.2.2/2.3/2.4"). The parameter list is currently empty in the spec and the result is typed as an open object ({ "type": "object", "additionalProperties": true }). The parameters and response fields documented below reflect the intended DAS contract and the shape used by the related getTokenAccountsByOwner / getTokenAccountsByDelegate methods. Do not rely on field names until the api.2.2+ schema is finalized.

Parameters

JSON-RPC named/object parameters (intended contract — subject to change at api.2.2+):

mintstring (base-58 pubkey)optional
Mint address to enumerate token accounts for.
ownerstring (base-58 pubkey)optional
Owner address to enumerate token accounts for.
pageintegeroptional
1-based page number for paginated results.
limitintegeroptional
Maximum number of token accounts to return per page.

Response

The finalized result is expected to follow the DAS token-account shape used by the sibling read methods — a context slot plus a value array of { pubkey, account } entries:

result.context.slotinteger
Slot at which the data was read.
result.valuearray
List of matching token accounts.
result.value[].pubkeystring
Base-58 address of the token account.
result.value[].accountobject
The decoded account (lamports, owner, data, executable, rentEpoch, space).

Errors

CodeMeaningWhen it happens
401UnauthorizedMissing or invalid Authorization: Bearer API key.
403Forbidden / tier too lowYour plan is below the basic tier required for sol_das methods.
429Rate limitedYou exceeded the requests-per-second allowance for your tier (RPS + burst; there is no daily quota).
-32601Method not foundThe method is unavailable on the connected spec version.
-32602Invalid paramsParameters did not match the (finalized) schema.

See the shared errors reference for the full error envelope.

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getTokenAccounts",
    params: {
      owner: "4Nd1mYpQ8Z3vR2sK9bXcW7gH5fT6jL1aP0eU8nQ2dVx",
      page: 1,
      limit: 100,
    },
  }),
});


const { result } = await res.json();
console.log(result.value);

TypeScript SDK (@triport/sdk)

import { TriportClient } from "@triport/sdk";


const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY! });


// Scaffold method: pass params as an object; result is typed as `unknown`
// until the api.2.2+ schema is released.
const result = await client.solana.rpc("getTokenAccounts", {
  owner: "4Nd1mYpQ8Z3vR2sK9bXcW7gH5fT6jL1aP0eU8nQ2dVx",
  page: 1,
  limit: 100,
});


console.log(result);

Python (triport-sdk)

import os
from triport import TriportClient


client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])


result = client.solana.rpc(
    "getTokenAccounts",
    {
        "owner": "4Nd1mYpQ8Z3vR2sK9bXcW7gH5fT6jL1aP0eU8nQ2dVx",
        "page": 1,
        "limit": 100,
    },
)


print(result)

Notes

  • Scaffold status: params and result are deferred to spec api.2.2 / 2.3 / 2.4. Pin your client to a spec version and re-check this page when the finalized schema ships before depending on specific field names.
  • Tier: sol_das methods require the basic tier or higher. The free tier cannot call this method (403).
  • Pagination: DAS lookups are expected to be paginated via page / limit; iterate pages until the returned value array is shorter than limit.
  • Related methods: for the validator-direct (non-DAS, free-tier) equivalents see getTokenAccountsByOwner and getTokenAccountsByDelegate. Other DAS methods in the same category include getAsset, getAssetProof, getAssetsByGroup, and getAssetsByOwner.