> For the complete documentation index, see [llms.txt](https://docs.solanavibestation.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.solanavibestation.com/api-reference/solana-rpc/http-methods/getprogramaccounts.md).

# getProgramAccounts

{% hint style="warning" %}
SPL and SPL-2022 token GPA requests are served by a dedicated indexed cluster and have additional filter requirements. Requests that do not meet them are blocked — see below.
{% endhint %}

From now on, any SPL or SPL-2022 token GPA requests will be routed away from all the nodes and handled on a dedicated memory indexed server for those program accounts. This will prevent poorly formatted requests from negatively impacting the RPC node's performance. This solution is already been replicated and has redundancy built in as we have two servers running these solutions. Initial findings show an extremely faster response time for these GPA requests as opposed to before when the RPC nodes were fulfilling the requests. For those unfamiliar, this applies to the following token accounts for GPA requests:\
`TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA`\
TokenzQdYV1iJj6g9VzBzzWJPKtnP1Ez5QnhrWcvbxC

The caveat is that anyone performing a GPA request for these accounts need to adhere to the following requirements to prevent your request from getting blocked:\
Must contain a filter in the GPA request,\
Must contain a datasize filter that is one of the known lengths for SPL & SPL-2022 tokens,\
When filtering for token accounts must contain at least one memcmp filter. Only the mint and the owner filters are supported. (offset=0 or offset=32),

These restrictions only apply to the SPL token and SPL-2022 token program accounts.

## getProgramAccounts — All accounts owned by a program

> 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 dataSize filter. 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 be 355 for accounts of both programs. When filtering for token accounts : Must contain at least one memcmp filter. Only the mint ( offset = 0 , 32 bytes data length) and the owner ( offset = 32 , 32 bytes data length) filters are supported.\
> \*\*Parameters\*\*\
> \
> 0\. \`programId\` (required) — Program pubkey, base-58.\
> 1\. \`config\` (optional) — Optional configuration object. Every field is optional; omit the entire object to use defaults.<br>

```json
{"openapi":"3.0.3","info":{"title":"Solana RPC: getProgramAccounts","version":"1.0.0"},"tags":[{"name":"Account","description":"Solana RPC account method."}],"servers":[{"url":"https://public.rpc.solanavibestation.com","description":"Public endpoint (rate-limited, no auth)"},{"url":"https://lite.rpc.solanavibestation.com","description":"Lite tier"},{"url":"https://basic.rpc.solanavibestation.com","description":"Basic tier"},{"url":"https://ultra.rpc.solanavibestation.com","description":"Ultra tier"},{"url":"https://elite.rpc.solanavibestation.com","description":"Elite tier"},{"url":"https://epic.rpc.solanavibestation.com","description":"Epic tier"},{"url":"https://basic.swqos.solanavibestation.com","description":"Basic tier with Stake-Weighted QoS"},{"url":"https://ultra.swqos.solanavibestation.com","description":"Ultra tier with Stake-Weighted QoS"},{"url":"https://elite.swqos.solanavibestation.com","description":"Elite tier with Stake-Weighted QoS"}],"security":[{},{"AuthHeader":[]},{"URLParameter":[]}],"components":{"securitySchemes":{"AuthHeader":{"type":"apiKey","in":"header","name":"Authorization","description":"Pass `Authorization: <api-key>` on each request."},"URLParameter":{"type":"apiKey","in":"query","name":"api_key","description":"Pass `?api_key=<api-key>` on the URL."}},"schemas":{"Commitment":{"type":"string","enum":["processed","confirmed","finalized"],"default":"finalized","description":"How finalized a block is at query time:\n- `processed`: most recent block, may be skipped\n- `confirmed`: block confirmed by supermajority of cluster\n- `finalized`: block finalized by the cluster (>2/3 stake)"},"Encoding":{"type":"string","enum":["json","jsonParsed","base58","base64","base64+zstd"],"description":"Encoding for transaction or account data."},"JsonRpcEnvelope":{"type":"object","required":["jsonrpc","id"],"description":"Base envelope of every JSON-RPC 2.0 response.","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Echoed request id."}}},"AccountInfo":{"type":"object","description":"On-chain account state.","nullable":true,"required":["lamports","owner","executable","rentEpoch","data"],"properties":{"lamports":{"type":"integer","format":"int64","description":"Balance in lamports."},"owner":{"type":"string","description":"Base-58 program id that owns the account."},"executable":{"type":"boolean"},"rentEpoch":{"type":"integer","format":"int64"},"space":{"type":"integer","description":"Data length in bytes."},"data":{"description":"Account data; encoding depends on request encoding.","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":true}]}}},"JsonRpcErrorResponse":{"type":"object","required":["jsonrpc","id","error"],"description":"JSON-RPC 2.0 error response.","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"error":{"$ref":"#/components/schemas/JsonRpcError"}}},"JsonRpcError":{"type":"object","required":["code","message"],"description":"Structured JSON-RPC error.","properties":{"code":{"type":"integer","description":"Numeric error code per JSON-RPC 2.0 spec. Common values:\n- `-32700` Parse error\n- `-32600` Invalid Request\n- `-32601` Method not found\n- `-32602` Invalid params\n- `-32603` Internal error\n- `-32003` Unauthorized\n- `-32005` Too Many Requests\n- `-32015` Transaction version not supported\n"},"message":{"type":"string"},"data":{"type":"object","additionalProperties":true}}}},"responses":{"UnauthorizedError":{"description":"Authentication required or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcErrorResponse"}}}},"ForbiddenError":{"description":"Insufficient permissions for the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcErrorResponse"}}}},"TooManyRequestsError":{"description":"Rate limit exceeded for this tier.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcErrorResponse"}}}},"InternalServerError":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcErrorResponse"}}}}}},"paths":{"/":{"post":{"operationId":"getProgramAccounts","summary":"getProgramAccounts — All accounts owned by a program","tags":["Account"],"description":"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 dataSize filter. 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 be 355 for accounts of both programs. When filtering for token accounts : Must contain at least one memcmp filter. Only the mint ( offset = 0 , 32 bytes data length) and the owner ( offset = 32 , 32 bytes data length) filters are supported.\n**Parameters**\n\n0. `programId` (required) — Program pubkey, base-58.\n1. `config` (optional) — Optional configuration object. Every field is optional; omit the entire object to use defaults.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","id","method","params"],"properties":{"jsonrpc":{"type":"string","enum":["2.0"],"description":"JSON-RPC protocol version."},"id":{"oneOf":[{"type":"string"},{"type":"integer"}],"description":"Request identifier echoed back in the response."},"method":{"type":"string","enum":["getProgramAccounts"],"description":"Must be `getProgramAccounts`."},"params":{"type":"array","description":"Positional parameters. Each item below corresponds to one position in the array, in order.","minItems":1,"maxItems":2,"items":{"anyOf":[{"title":"programId","type":"string","description":"Program pubkey, base-58."},{"title":"config (optional)","type":"object","description":"Optional configuration object. Every field is optional; omit the entire object to use defaults.","properties":{"commitment":{"$ref":"#/components/schemas/Commitment"},"minContextSlot":{"type":"integer","format":"int64","description":"Minimum slot at which the request can be evaluated. The RPC node will reject the request with a `MinContextSlotNotReached` error if its current root is below this value. Use this for read-after-write consistency in multi-step workflows."},"encoding":{"$ref":"#/components/schemas/Encoding"},"dataSlice":{"type":"object","properties":{"offset":{"type":"integer","format":"int64"},"length":{"type":"integer","format":"int64"}}},"filters":{"type":"array","items":{"type":"object","description":"A filter that matches accounts whose data length equals `dataSize`, or whose data at `memcmp.offset` equals `memcmp.bytes`. Provide one of the two keys per filter.","properties":{"dataSize":{"type":"integer","format":"int64","description":"Exact account data size, in bytes. Match accounts whose data is exactly this many bytes long."},"memcmp":{"type":"object","description":"Match accounts whose data at `offset` equals `bytes` (encoded per `encoding`).","properties":{"offset":{"type":"integer","format":"int64","description":"Byte offset into the account data."},"bytes":{"type":"string","description":"Bytes to match against, base-58 or base-64."},"encoding":{"type":"string","description":"Encoding for the `bytes` field.","enum":["base58","base64"]}}}}},"description":"Optional list of filters. Each filter narrows the result set; the server intersects them. Use `dataSize` to filter by account data length, and `memcmp` to filter by byte-equal at a given offset."},"withContext":{"type":"boolean","description":"If true, wrap the response in a `{context, value}` envelope. Default is false (return the array directly)."}}}]}}}}}}},"responses":{"200":{"description":"Successful `getProgramAccounts` response.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/JsonRpcEnvelope"},{"type":"object","required":["result"],"properties":{"result":{"type":"array","items":{"type":"object","required":["pubkey","account"],"properties":{"pubkey":{"type":"string"},"account":{"$ref":"#/components/schemas/AccountInfo"}}},"description":"Array of {pubkey, account} pairs."}}}]}}}},"401":{"$ref":"#/components/responses/UnauthorizedError"},"403":{"$ref":"#/components/responses/ForbiddenError"},"429":{"$ref":"#/components/responses/TooManyRequestsError"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```
