Not available on the Developer plan
The method is available only on the Growth, Business, and Enterprise plans.
The Solana getTokenAccountsByOwner
method retrieves a list of accounts owned by a specified wallet, filtered by their associated token.
This method is useful for identifying all accounts associated with a particular owner and a specific token, allowing for a comprehensive view of token distribution and ownership.
The interactive example fetches the GME tokens owned by an account on Solana mainnet.
Get you own node endpoint today
Start for free and get your app to production levels immediately. No credit card required.
You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
delegatePubkey
— the base-58 encoded string representing the public key of the account delegate to query.filters
— a JSON object with one of the following fields:mint
— the base-58 encoded string of the specific token Mint to limit accounts to.programId
— the base-58 encoded string of the Token program that owns the accounts.
config
(optional) — configuration object containing the following fields:commitment
(optional) — the level of commitment desired for the query.minContextSlot
(optional) — te minimum slot that the request can be evaluated at.dataSlice
(optional) — request a slice of the account's data, specifyinglength
(number of bytes to return) andoffset
(byte offset from which to start reading).encoding
(optional) — the format of the returned account data. Possible values arebase58
,base64
,base64+zstd
, orjsonParsed
.
Response
value
— an array of JSON objects, each containing:pubkey
— the account Pubkey as a base-58 encoded string.account
— a JSON object with subfields:lamports
— number of lamports assigned to this account, as a u64.owner
— base-58 encoded Pubkey of the program to which this account has been assigned.data
— token state data associated with the account as encoded binary data or in JSON format.executable
— boolean indicating if the account contains a program (and is strictly read-only).rentEpoch
— the epoch at which this account will next owe rent, as a u64.size
— the data size of the account.
Use Case
A practical use case for getTokenAccountsByOwner
is for wallet interfaces or financial tracking applications to list all accounts associated with a particular owner and token type. This can be especially useful for assessing the distribution of tokens across different accounts and for transaction history analysis.
Try the getTokenAccountsByOwner
RPC Method Yourself
getTokenAccountsByOwner
RPC Method Yourself