getMultipleAccounts
Returns account state and metadata for multiple addresses, in request order.
Request
Send a JSON-RPC 2.0 POST request with method: "getMultipleAccounts". The params array takes an array of base-58 encoded public keys (up to 100) and an optional configuration object.
curl · JSON-RPCjson
{ "jsonrpc": "2.0", "id": 1, "method": "getMultipleAccounts", "params": [ [ "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg", "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA" ], { "encoding": "base64", "commitment": "finalized" } ]}@solana/kit
kit.tsts
import { address, createSolanaRpc } from "@solana/kit"; const rpc_url = "https://rpc.openinfra.sh";const rpc = createSolanaRpc(rpc_url); let addresses = [ address("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"), address("4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA")]; let config = { encoding: "base64", commitment: "finalized"}; let accounts = await rpc.getMultipleAccounts(addresses, config).send(); console.log(accounts);@solana/web3.js
web3.tsts
import { Connection, PublicKey, type GetMultipleAccountsConfig} from "@solana/web3.js"; const connection = new Connection("https://rpc.openinfra.sh", "confirmed"); let addresses = [ new PublicKey("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"), new PublicKey("4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA")]; let config: GetMultipleAccountsConfig = { commitment: "finalized"}; let accounts = await connection.getMultipleAccountsInfo(addresses, config); console.log(accounts);Rust
main.rsrs
use anyhow::Result;use solana_account_decoder::UiAccountEncoding;use solana_client::{nonblocking::rpc_client::RpcClient, rpc_config::RpcAccountInfoConfig};use solana_commitment_config::CommitmentConfig;use solana_sdk::pubkey; #[tokio::main]async fn main() -> Result<()> { let client = RpcClient::new_with_commitment( String::from("https://rpc.openinfra.sh"), CommitmentConfig::confirmed(), ); let addresses = [ pubkey!("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"), pubkey!("4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"), ]; let config = RpcAccountInfoConfig { encoding: UiAccountEncoding::Base64.into(), data_slice: None, commitment: CommitmentConfig::finalized().into(), min_context_slot: None, }; let accounts = client .get_multiple_accounts_with_config(&addresses, config) .await?; println!("{:#?}", accounts); Ok(())}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| pubkeys | array | Yes | Array of Pubkeys to query, as base-58 encoded strings. Maximum 100 entries. |
| config | object | No | Optional configuration object. See fields below. |
| config.commitment | string | No | Desired finality level. Accepted values: processed, confirmed, finalized (default). |
| config.encoding | string | No | Encoding for returned account data. Accepted values: base64 (default), base58, base64+zstd, jsonParsed, binary (deprecated). |
| config.dataSlice | object | No | Request a slice of account data: { offset, length }. Only available for base58, base64, base64+zstd, and binary encodings. |
| config.minContextSlot | number | No | The minimum slot at which the request may be evaluated. |
commitment values
| Value | Description |
|---|---|
| processed | Return data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks. |
| confirmed | Return data from the highest slot that at least two-thirds of active stake has directly voted to confirm. More stable than processed, but a weaker guarantee than finalized. |
| finalized | Return data from the highest slot that the cluster recognizes as finalized. The slot has reached maximum vote lockout in validators' vote towers and is recognized by at least two-thirds of active stake. This is the strongest commitment level. |
encoding values
| Encoding | Data format | Notes |
|---|---|---|
| base64 | [data, "base64"] | Recommended. |
| base58 | [data, "base58"] | Slow. The account's data field must be 128 bytes or fewer. |
| base64+zstd | [data, "base64+zstd"] | Zstandard compressed. |
| jsonParsed | {program, parsed, space} | Falls back to base64 if no parser is found for the owning program. |
| binary | string | Deprecated. Same base58 encoding as base58 with the same 128-byte limit, but returns data as a plain string. Use base64 instead. |
jsonParsed program values
When encoding is jsonParsed, the program field in the returned account object identifies the parser used:
| program value | Parsed account type |
|---|---|
| address-lookup-table | Address lookup table accounts |
| bpf-upgradeable-loader | Upgradeable loader program and buffer accounts |
| config | Config accounts |
| nonce | Durable nonce accounts |
| spl-token | SPL Token accounts |
| spl-token-2022 | SPL Token 2022 accounts |
| stake | Stake accounts |
| sysvar | Sysvar accounts |
| vote | Vote accounts |
dataSlice example
Examplejson
{ "offset": 0, "length": 32 }minContextSlot example
Examplejson
{ "minContextSlot": 341197000 }Response
response.jsonjson
{ "jsonrpc": "2.0", "result": { "context": { "apiVersion": "3.1.8", "slot": 341197247 }, "value": [ { "data": ["", "base64"], "executable": false, "lamports": 88849814690250, "owner": "11111111111111111111111111111111", "rentEpoch": 18446744073709551615, "space": 0 }, { "data": ["", "base64"], "executable": false, "lamports": 998763433, "owner": "2WRuhE4GJFoE23DYzp2ij6ZnuQ8p9mJeU6gDgfsjR4or", "rentEpoch": 18446744073709551615, "space": 0 } ] }, "id": 1}The result is an RpcResponse object. Each entry in value corresponds positionally to the requested pubkey and is either null (account does not exist) or an account object.
| Field | Type | Description |
|---|---|---|
| context | object | Slot and API version the node used to answer this request. |
| context.slot | u64 | Slot at which the node evaluated this request. |
| context.apiVersion | string | RPC API version reported by the node. May be omitted by older nodes. |
| value | array | Array of account objects (or null) in the same order as the requested pubkeys. |
| value[n].data | string | array | object | Account data. Format depends on encoding: plain base-58 string for binary; [data, encoding] for base58, base64, or base64+zstd; { program, parsed, space } for jsonParsed. |
| value[n].executable | bool | Whether the account contains a program and is therefore read-only. |
| value[n].lamports | u64 | Lamports assigned to this account. |
| value[n].owner | string | Program owner pubkey, as a base-58 encoded string. |
| value[n].rentEpoch | u64 | Epoch at which this account next owes rent. |
| value[n].space | u64 | null | Account data size in bytes. |
jsonParsed data object fields
When encoding is jsonParsed and a parser is available, the data field is an object with the following shape:
| Field | Type | Description |
|---|---|---|
| program | string | Name of the parser that produced the decoded account data. |
| parsed | object | Parser-specific JSON payload. Structure depends on the owning program and account type. |
| space | u64 | Account data size in bytes. |