Skip to main content
Returns every account owned by the specified program. Use filters to narrow results by account data size or specific byte values — this is especially useful when querying token programs.
getProgramAccounts can return very large result sets. Use filters to limit the response size, or the request may time out on your plan’s rate limit.

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getProgramAccounts",
  "params": [
    "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
    {
      "encoding": "base64",
      "filters": [{ "dataSize": 165 }]
    }
  ]
}

Parameters

programId
string
required
Base-58 encoded public key of the program whose accounts you want to fetch.
encoding
string
Encoding for account data. One of base58, base64, base64+zstd, or jsonParsed. Defaults to base64.
filters
array
Array of filter objects. Each filter is one of:
  • { "dataSize": <usize> } — only return accounts whose data length equals the specified size.
  • { "memcmp": { "offset": <usize>, "bytes": "<base-58 string>" } } — only return accounts whose data matches bytes at the given offset.
commitment
string
Commitment level for the query. One of processed, confirmed, or finalized.

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY",
      "account": {
        "data": ["KQAAAAAAAA==", "base64"],
        "executable": false,
        "lamports": 15298080,
        "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
        "rentEpoch": 28,
        "space": 165
      }
    }
  ]
}
result
array
Array of matching account objects.
result[].pubkey
string
Base-58 encoded address of the account.
result[].account.lamports
number
Account balance in lamports.
result[].account.owner
string
Base-58 encoded program address that owns the account.
result[].account.executable
boolean
Whether the account is executable.
result[].account.data
array | object
Account data, encoded per the requested encoding.
result[].account.space
number
Size of the account data in bytes.

Example

curl "https://rpc.solami.fast/sol?api_key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getProgramAccounts",
    "params": [
      "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
      {
        "encoding": "base64",
        "filters": [{ "dataSize": 165 }]
      }
    ]
  }'