getProgramAccounts
Returns all accounts owned by a given program. This method is useful for finding all accounts associated with a specific program, such as all token accounts for a particular token mint or all accounts created by a custom program. You can apply filters to narrow down the results.
SPL/SPL2022 Token Program Requirements: When querying SPL or SPL2022 token programs, the configuration object must include:
filters(array, required): An array of filters to apply to the accounts.Must contain the
dataSizefilter. Must be one of the known lengths for SPL/SPL2022 program accounts (mint=82, token=165) or a larger value when filtering for SPL2022 accounts with extensions. When filtering for multisig accounts, the size must be355for accounts of both programs.When filtering for token accounts: Must contain at least one
memcmpfilter. Only the mint (offset=0,32bytes data length) and the owner (offset=32,32bytes data length) filters are supported.
JSON-RPC protocol version
2.0Possible values: Request identifier that will be returned in the response
1The RPC method name
getProgramAccountsPossible values: Successful Response
Unauthorized
Forbidden
Too Many Requests
Internal Server Error
curl -X POST https://public.rpc.solanavibestation.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
{
"encoding": "jsonParsed",
"commitment": "confirmed",
"filters": [
{
"dataSize": 165
}
]
}
]
}'
{
"jsonrpc": "2.0",
"result": [
{
"account": {
"data": [
"",
"base58"
],
"executable": false,
"lamports": 1000000000,
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"rentEpoch": 361,
"space": 165
},
"pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"
},
{
"account": {
"data": [
"SGVsbG8gV29ybGQ=",
"base64"
],
"executable": false,
"lamports": 2000000000,
"owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"rentEpoch": 361,
"space": 165
},
"pubkey": "7yUkNBCqAJjvjpHnKpWvWtjxdz2zAcGGcXS4Pk5PbvCx"
}
],
"id": 1
}Last updated