getMultipleAccounts

Returns the account information for a list of public keys. This is a batched version of getAccountInfo that reduces network round-trips and improves performance when you need data for multiple accounts simultaneously. It is particularly useful for loading token portfolios, fetching multiple program accounts, and building complex UIs that display data from several accounts at once. Up to 100 accounts can be queried per request.

Parameters

#TypeRequiredDescription
1array[string]YesArray of base-58 encoded public keys to query (max 100)
2objectNoConfiguration object

Configuration object fields:

FieldTypeDescription
commitmentstringCommitment level: processed, confirmed, or finalized
encodingstringData encoding: base58, base64, base64+zstd, or jsonParsed
dataSliceobjectRequest a slice: { offset: number, length: number }
minContextSlotnumberMinimum slot at which the request can be evaluated

Response

Returns an RpcResponse with an array of account objects (or null for missing accounts):

FieldTypeDescription
context.slotu64The slot at which the value was read
value[]`objectnull`

Code Examples

cURL

1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2  "jsonrpc": "2.0",
3  "id": 1,
4  "method": "getMultipleAccounts",
5  "params": [
6    [
7      "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
8      "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
9    ],
10    { "encoding": "base64" }
11  ]
12}'

TypeScript

1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2  method: "POST",
3  headers: { "Content-Type": "application/json" },
4  body: JSON.stringify({
5    jsonrpc: "2.0",
6    id: 1,
7    method: "getMultipleAccounts",
8    params: [
9      [
10        "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
11        "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
12      ],
13      { encoding: "base64" }
14    ]
15  }),
16});
17const { result } = await response.json();
18result.value.forEach((a, i) => console.log(`Account ${i}:`, a ? a.lamports : "not found"));

Python

1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4    "jsonrpc": "2.0",
5    "id": 1,
6    "method": "getMultipleAccounts",
7    "params": [
8        [
9            "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
10            "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
11        ],
12        {"encoding": "base64"}
13    ]
14})
15result = response.json()["result"]
16for i, a in enumerate(result['value']):
17    print(f"Account {i}: {a['lamports'] if a else 'not found'}")

Rust

1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    let client = Client::new();
7    let res = client.post("http://[IP_ADDRESS]:[PORT]")
8        .json(&json!({
9            "jsonrpc": "2.0",
10            "id": 1,
11            "method": "getMultipleAccounts",
12            "params": [
13                [
14                "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
15                "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
16            ],
17                {"encoding": "base64"}
18            ]
19        }))
20        .send().await?
21        .text().await?;
22    println!("{}", res);
23    Ok(())
24}

Example Response

1{
2  "jsonrpc": "2.0",
3  "result": {
4    "context": { "slot": 123456789 },
5    "value": [
6      {
7        "data": ["", "base64"],
8        "executable": false,
9        "lamports": 1000000000,
10        "owner": "11111111111111111111111111111111",
11        "rentEpoch": 361,
12        "space": 0
13      },
14      null
15    ]
16  },
17  "id": 1
18}