curl --request POST \
--url https://nd-326-444-187.p2pify.com/9de47db917d4f69168e3fed02217d15b \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "getTokenAccountsByOwner",
"params": [
"CEXq1uy9y15PL2Wb4vDQwQfcJakBGjaAjeuR2nKLj8dk",
{
"mint": "8wXtPeU6557ETkp9WHFY1n1EcU6NxDvbAggHGsMYiHsB"
},
{
"encoding": "jsonParsed"
}
]
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}curl --request POST \
--url https://nd-326-444-187.p2pify.com/9de47db917d4f69168e3fed02217d15b \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "getTokenAccountsByOwner",
"params": [
"CEXq1uy9y15PL2Wb4vDQwQfcJakBGjaAjeuR2nKLj8dk",
{
"mint": "8wXtPeU6557ETkp9WHFY1n1EcU6NxDvbAggHGsMYiHsB"
},
{
"encoding": "jsonParsed"
}
]
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}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.
ownerPubkey (string, required) — the base-58 encoded public key of the account owner to query.filter (object, required) — filter results by token mint or program ID. Must include exactly one of:
mint (string) — the base-58 encoded public key of a specific token mint to limit accounts to.programId (string) — the base-58 encoded public key of the Token program that owns the accounts (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA for SPL Token, TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb for Token-2022).config (object, optional) — configuration object containing:
commitment (string) — the level of commitment desired for the query.minContextSlot (integer) — the minimum slot at which the request can be evaluated.dataSlice (object) — request a slice of the account’s data with length and offset fields. Only available for non-jsonParsed encodings.encoding (string) — the format of the returned account data. Values: base58, base64, base64+zstd, jsonParsed. With jsonParsed, returns parsed token account data including mint, owner, token amount, delegate, and state.context — an object containing slot (the slot at which the data was fetched) and apiVersion.value — an array of objects, each containing:
pubkey (string) — the token account address as a base-58 encoded string.account — an object with:
lamports (u64) — number of lamports assigned to this account.owner (string) — base-58 encoded public key of the program that owns this account.data — account data. With jsonParsed encoding, returns a {program, parsed, space} object where parsed.info contains: mint, owner, tokenAmount (with amount, decimals, uiAmount, uiAmountString), delegate, delegatedAmount, state (initialized or frozen), isNative, rentExemptReserve, closeAuthority, and extensions (for Token-2022 accounts).executable (boolean) — whether the account contains a program.rentEpoch (u64) — the epoch at which this account will next owe rent.space (u64) — the data size of the account in bytes.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.Was this page helpful?