getProgramAccounts - Solana

getProgramAccounts. Fetches all accounts owned by a specified program

getProgramAccounts - solana [Value: 117CU]
Fetches all accounts owned by a specified program
Use cases

Use cases

  • Retrieve all accounts associated with a specific program
  • Analyze program accounts for operational insights
  • Monitor changes in program accounts over time
Constraints

Constraints

  • Limited to accounts of a specified program
  • Dependent on current network synchronization
  • API rate limits may affect data retrieval
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl https://solana.drpc.org \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0", "id":1, "method":"getProgramAccounts", "params": ["PROGRAM_TO_SEARCH"]}'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "result": [
    {
      "pubkey": "FhtkR4pKYQ7fM5bGY4r8mPzRmAz5k1tyczdpa53dWHTQ",
      "account": {
        "lamports": 2039280,
        "owner": "PROGRAM_TO_SEARCH",
        "data": "",
        "executable": false,
        "rentEpoch": 114
      }
    },
    {
      "pubkey": "5TJAgGy9iHVjd1S4Ad4gBb2dhS5i7kRaT1p7eyJw5Hbn",
      "account": {
        "lamports": 1000000,
        "owner": "PROGRAM_TO_SEARCH",
        "data": "",
        "executable": false,
        "rentEpoch": 114
      }
    }
  ],
  "id": 1
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray
array
accountPublicKeystring
The public key of the account to query.
minContextSlotinteger
The minimum slot at which the request can be evaluated.
withContextstring
Wraps the result in an RpcResponse JSON object.
filtersstring
Filters results using up to 4 filter objects.
dataSlicestring
Returns account data using the specified offset ('usize') and length ('usize') fields. Only available for base58, base64, or base64+zstd encodings.
encodingstring
Specifies the data encoding for the returned account information
commitmentstring
The level of commitment required for the query
  • finalized - The node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized
  • confirmed - The node will query the most recent block that has been voted on by supermajority of the cluster
  • processed - The node will query its most recent block. Note that the block may not be complete

Response

200
An RpcResponse JSON object containing details about the node and its account.

Response params

object
idinteger
jsonrpcstring
resultstring
object
accountPublicKeystring
The public key of the account to query.
valueobject
object
lamportsint64
The number of lamports (smallest unit of SOL) assigned to this account.
ownerstring
Base-58 encoded public key of the program assigned to this account
datastring
Data associated with the account, either as encoded binary data or in JSON format, depending on the specified encoding. Format: [data, encoding] or JSON object
executableboolean
dicates if the account contains a program and is read-only.
rentEpochinteger
The epoch at which this account will next owe rent.
spaceinteger
The amount of storage space required to store the token account.