# getProgramAccounts

Returns all accounts owned by the provided program address.

#### Parameters required for this RPC call

* The address of the program whose accounts we are trying to fetch, as base-58 encoded string.
* **configuration** : This contains the following parameters, all are optional fields.
  * **commitment**: The commitment describes how finalized a block is at that point in time. Only <mark style="color:yellow;">confirmed</mark> and <mark style="color:yellow;">finalized</mark> are supported, defaults to <mark style="color:yellow;">finalized</mark>.
  * **encoding**: Encoding format for each returned transaction. The supported options are *json*, *jsonParsed*, <mark style="color:yellow;">base58</mark> and <mark style="color:yellow;">base64</mark>. You can know more about [Parsed responses](https://solana.com/docs/rpc#parsed-responses) more on Solana docs.
  * **minContextSlot**: The minimum slot that the request can be evaluated at. This is a number.
  * **withContext**: Wrap the result in an RpcResponse JSON object.
  * **filters**: Filter results using up to 4 filter objects.
  * **dataSlice**:  Request a slice of the account's data.
    * `length: <usize>` - number of bytes to return
    * `offset: <usize>` - byte offset from which to start reading

{% tabs %}
{% tab title="cURL" %}

<pre class="language-bash"><code class="lang-bash">curl https://rpc.shyft.to?api_key=YOUR-API-KEY -s -X \
<strong>  POST -H "Content-Type: application/json" -d ' 
</strong>   {
     "jsonrpc": "2.0",
     "id": 1,
     "method": "getMultipleAccounts",
     "params": [
       [
         "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
         "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
       ],
       {
         "encoding": "base58",
         "commitment": "finalized"
       }
     ]
   }
 '
</code></pre>

{% endtab %}

{% tab title="Web3.js" %}

```javascript
import {
  Connection,
  PublicKey,
  clusterApiUrl,
  type GetMultipleAccountsConfig,
} from "@solana/web3.js";

const connection = new Connection("https://rpc.shyft.to?api_key=YOUR-API-KEY", "confirmed");

let addresses = [
  new PublicKey("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"),
  new PublicKey("4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"),
];

let config: GetMultipleAccountsConfig = {
  commitment: "finalized",
};

let accounts = await connection.getMultipleAccountsInfo(addresses, config);

console.log(accounts);
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": { "apiVersion": "2.0.15", "slot": 341197247 },
    "value": [
      {
        "data": ["", "base58"], //data associated with the account, in order.
        "executable": false,
        "lamports": 88849814690250,
        "owner": "11111111111111111111111111111111",
        "rentEpoch": 18446744073709551615,
        "space": 0
      },
      {
        "data": ["", "base58"],
        "executable": false,
        "lamports": 998763433,
        "owner": "2WRuhE4GJFoE23DYzp2ij6ZnuQ8p9mJeU6gDgfsjR4or",
        "rentEpoch": 18446744073709551615,
        "space": 0
      }
    ]
  },
  "id": 1
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shyft.to/solana/rpc-calls/http/getprogramaccounts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
