RPC MethodsHTTPgetProgramAccounts

Account

getProgramAccounts

Returns all accounts owned by the provided program Pubkey.

Parameters

pubkeystring required

Pubkey of program, as base-58 encoded string.

configobject optional

Configuration object.

commitmentstring

Commitment level.

encodingstring

Encoding for account data.

dataSliceobject

Limit the returned account data.

filtersarray

Filter results using memcmp and/or dataSize.

withContextbool

Wrap the result in an RpcResponse JSON object.

minContextSlotnumber

The minimum slot.

changedSinceSlotnumber

Only return accounts that were modified after the specified slot.

cursorFilterobject

Allows paginating gPA requests by specifying a cursor (public key) and a limit (uint).

Result

array

Array of JSON objects with pubkey (base-58 string) and account (object).

Examples

1. Filter by changed accounts since slot

Request
JSON
curl "https://eu.fluxrpc.com?key=<your-API-key>" -s -X POST -H "Content-Type: application/json" -d '
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getProgramAccounts",
  "params": [
    "FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X",
    { "commitment": "finalized", "encoding": "jsonParsed",
    "changedSinceSlot": 406846134,
    "filters": [{ "dataSize": 324 }] }
  ]
}'

2. Paginate results with cursor and limit

Request
JSON
curl "https://eu.fluxrpc.com?key=<your-API-key>" -s -X POST -H "Content-Type: application/json" -d '
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getProgramAccounts",
  "params": [
    "FLUXubRmkEi2q6K3Y9kBPg9248ggaZVsoSFhtJHSrm1X",
    { "commitment": "finalized", "encoding": "jsonParsed",
    "cursorFilter": {
            "limit": 5,
            "cursor": "11ab4iuDV1cuSdX4UK3thiKqM8P4CacSQMPr47g8SGp"
      },
    "filters": [{ "dataSize": 324 }] }
  ]
}'