getProgramAccountsV2
Last updated:
`getProgramAccountsV2` is the next-generation form of [`getProgramAccounts`](./getProgramAccounts.md): it returns the accounts owned by a given program Pubkey, with the same filtering and encoding controls, and is designed to handle large result sets more gracefully than the original.
Like its predecessor, this is one of the two **heavy** Solana read methods (`sol_read_rpc_heavy`). Scanning all accounts owned by a program is expensive for the node, so it is throttled far more aggressively than ordinary reads — just **2 rps on the free tier**, rising to 80 rps on business. Budget your calls accordingly, cache results where you can, and always narrow the scan with `filters` (a `dataSize` and/or `memcmp` filter) rather than fetching every account a program owns.
> The precise V2 additions (for example, server-side pagination of large > result sets) are defined in the pending `api.2.2`+ spec and are intentionally > **not enumerated here** to avoid documenting field names that may change. > Treat the parameter and response tables below as the inherited > `getProgramAccounts` contract that V2 builds on.
Parameters
This method takes no parameters.
Returns
| Field | Type |
|---|---|
| result | object |
Examples
curl https://<your-endpoint>/ \
-X POST -H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"getProgramAccountsV2","params":[]}'const res = await fetch("https://<your-endpoint>/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"id": 1,
"method": "getProgramAccountsV2",
"params": [],
"jsonrpc": "2.0"
}),
});
const data = await res.json();import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getProgramAccountsV2","params":[],"jsonrpc":"2.0"})
print(resp.json())Usage
- Transport: HTTP (JSON-RPC).
- Networks: mainnet, devnet, testnet.
- Credit cost: 5 per call.
FAQ
- What does getProgramAccountsV2 do?
- Enhanced variant of `getProgramAccounts` for listing every account owned by a program — its full parameter and result schema is still being finalized.
- How many credits does getProgramAccountsV2 cost?
- getProgramAccountsV2 costs 5 credit(s) per call on Triport by default.
- Is getProgramAccountsV2 available over WebSocket?
- getProgramAccountsV2 is an HTTP JSON-RPC method.