getProgramAccountsV2

getProgramAccounts, paged with a cursor, with an exact total and a changedSince filter.

1 credit a call. Free plan includes 500,000 credits a month.

What it returns

Same filters as getProgramAccounts: dataSize, memcmp and dataSlice. Results come in pages of up to 10,000 with a cursor for the next page and a totalCount.

changedSince returns only accounts modified at or after a slot, so an indexer can sync deltas instead of rescanning.

What you can build

  • Full program scans

    Read every pool or market of a program without a timeout.

  • Incremental indexers

    Pull only what changed since your last slot.

  • Counts

    Count a program’s accounts from totalCount, without fetching them all.

  • Holder lists

    Filter the Token program by mint to list a token’s accounts.

Call it

Replace the URL with your endpoint from the dashboard.

getProgramAccountsV21 credit

Request

curl "$SOLANA_RPC_URL" \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getProgramAccountsV2",
  "params": [
    "SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy",
    {
      "encoding": "base64",
      "limit": 3,
      "dataSlice": {
        "offset": 0,
        "length": 33
      }
    }
  ]
}'

Response shape

{
  "accounts": [
    {
      "pubkey": "…",
      "account": {
        "lamports": "…",
        "owner": "SPoo1Ku8WFXoNDMHPsrGSTSG1Y47rzgn41SLUNakuHy",
        "data": [
          "…",
          "base64"
        ]
      }
    }
  ],
  "cursor": "…",
  "totalCount": "…"
}

Parameters

programIdstring
First positional parameter.
filtersarray
dataSize and memcmp, as in getProgramAccounts.
limitnumber
1 to 10,000 a page.
cursorstring
From the previous page, with the same filters.
changedSincenumber
Only accounts modified at or after this slot.
excludeZeroboolean
Skip empty accounts.
encoding / dataSlicestring / object
As in getProgramAccounts.

Good to know

  • A short page does not mean the end; stop when no cursor comes back.

Start calling getProgramAccountsV2.

Free to start. Paid plans from €39 a month.