Skip to content
Alchemy Logo

getBalanceByOwnerAtSlot

POST
/{apiKey}
CUs40

Returns a wallet's total balance of a single SPL Token or Token-2022 mint as of a specific slot, already summed across every token account the wallet held of that mint. It returns a single figure rather than the list of accounts returned by getTokenAccountsByOwnerAtSlot.

A wallet can own more than one token account for the same mint. The optional scope parameter selects which of them the result covers: all (default) sums every token account the wallet held of that mint at that slot, ata returns the balance of the wallet's canonical Associated Token Account only (derived from (wallet, token program, mint), with the token program selected from the mint so Token-2022 mints resolve correctly). When a wallet holds exactly one token account of the mint, both scopes return the same value.

Available on Solana mainnet only. The request may also be sent as a positional array [wallet, mint, slot, scope], and owner is accepted as an alias for wallet.

Path Parameters

stringrequireddefaults to docs-demo

For higher throughput, create your own API key

Request

stringrequired

Base-58 encoded pubkey of the wallet whose balance you want. owner is accepted as an alias.

stringrequired

Base-58 encoded pubkey of the token mint. SPL Token and Token-2022 mints are both supported.

integerrequired

The slot to reconstruct the balance at. There is no "latest slot" default; omitting slot is an error.

enumoptionaldefaults to all

Which of the wallet's token accounts the balance covers. all (default) sums every token account the wallet held of that mint at that slot; ata returns the balance of the wallet's canonical Associated Token Account only. Case-sensitive.

Defaults to "all".

Allowed values:

Responses

200

The wallet's total token balance for that mint at the requested slot, with the slot the balance was computed at.

Errors

-32602Invalid params. Common causes include a missing or malformed `wallet` / `mint` (each must be a 32-byte base58 pubkey), a missing or non-integer `slot`, an unknown `scope` value (only `all` and `ata` are accepted, case-sensitive), or a mint that is not present in the index.
-32600Unsupported method. Returned when the method is called against a chain other than Solana mainnet.
-32603Internal error. Retry the request; if it persists, contact support.
Was this page helpful?