getTokenAccountsByDelegate

POSTTokensBlade RunnerNexus

Returns every token account that has approved a given delegate, filtered to one mint or token program.

Try itSends a real request from your browser to the selected region.
POST
/

getTokenAccountsByDelegate returns the SPL Token and Token-2022 accounts whose owner has approved the given address as delegate, narrowed by either a mint or a programId.

Answers come from a delegate index. Each account is then read from the node at the requested commitment, so the returned data is current at context.slot.

Plans & rate limitsBlade RunnerNexus
FreeNot included
OperatorNot included
Blade Runner2/s
Nexus5/s

Parameters

params is a JSON array, with values in this order: delegate, filter, config.

1delegatestringrequired

Delegate address the token accounts have approved, base-58 encoded.

2filterobjectrequired

Exactly one of mint or programId. The two are mutually exclusive.

Show one ofOne of
Option 1object
Show propertiesProperties
mintstringrequired

Restricts results to token accounts for this mint, base-58 encoded.

Option 2object
Show propertiesProperties
programIdstringrequired

Restricts results to token accounts owned by this token program, base-58 encoded: the SPL Token program or Token-2022.

3configobject

Optional configuration.

Show propertiesProperties
commitmentstringdefault: "finalized"

Bank state to read the accounts from.

Allowed values:finalizedconfirmedprocessed
encodingstringdefault: "binary"

How to encode each account's data. The default binary and base58 allow at most 128 bytes of data, and a token account is 165 bytes or more, so use base64 or jsonParsed.

Allowed values:base64base64+zstdjsonParsedbase58binary
dataSliceobject

Returns only a byte range of each account's data. Not valid with jsonParsed.

Show propertiesProperties
offsetintegerrequired

Byte offset to start reading from.

lengthintegerrequired

Number of bytes to return.

minContextSlotinteger

Minimum slot the node must have processed before answering.

Result

resultobject

Matching token accounts, wrapped with context.

Show propertiesProperties
contextobjectrequired
Show propertiesProperties
slotinteger
apiVersionstring
valueobject[]required
Show each itemEach item
pubkeystring

Token account address, base-58 encoded.

accountobject
Show propertiesProperties
lamportsinteger
ownerstring

The token program that owns this account (not the wallet that controls its tokens).

executableboolean
rentEpochinteger
spaceinteger
dataany

Same shape as getAccountInfo. With jsonParsed, data.parsed.info includes mint, owner (the wallet), state and tokenAmount.

Notes

  • Included in the Blade Runner plan (2/s per key) and the Nexus plan (5/s per key), in every region.
  • A delegate with more than 150,000 token accounts in total, across the SPL Token and Token-2022 programs, gets code -32012 and delegate has more than 150000 token accounts; getTokenAccountsByDelegate is limited to 150000. The limit applies before the mint or programId filter, so nothing is returned for such a delegate.
  • A delegate with no matching token account returns an empty value array, not an error.
  • With jsonParsed, data.parsed.info includes delegate and delegatedAmount. A Token-2022 account has program set to spl-token-2022 and lists its extensions.
  • Rows are ordered by the raw 32 bytes of the token account address. This is not the alphabetical order of the base-58 strings.
  • Errors with code -32602 (HTTP 200): Invalid param: unrecognized Token program id when programId is not a token program; Invalid param: Token mint could not be unpacked when the mint address is not a mint.
  • Free and Operator plan keys get HTTP 403 with getTokenAccountsByDelegate requires higher tier. Over the per-second rate, the response is the standard rate-limit 429. See Errors.
  • HTTP 503 with code -32005 and getTokenAccountsByDelegate is temporarily unavailable; retry shortly, or code -32005 with Node is behind by <n> slots: the delegate index cannot answer at that moment. The condition is temporary.