Skip to main content

getMultipleAccounts

Returns the account information for a list of Pubkeys.

Common use cases
Portfolio balance displayFetch multiple token account balances in one call for wallet portfolio UIs. More efficient than repeated getTokenAccountBalance when displaying 5+ token holdings, reduces RPC calls by ~95% for typical 20-token portfolios.
Transaction pre-flight validationRetrieve before-state of all writable accounts in a transaction to validate sufficient balances and detect account changes. Wallets use this to display transaction impact before user approval.
Batch getProgramAccounts resultsAfter getProgramAccounts returns addresses (data-less for speed), use getMultipleAccounts to fetch full account data in efficient 100-account chunks. Common pattern for indexing or filtering large account sets.
Oracle price feed batchingFetch multiple Pyth or Switchboard oracle accounts simultaneously for consistent multi-asset price snapshots. Critical for DEX UIs requiring atomic price data across trading pairs.
NFT metadata collectionRetrieve metadata accounts for NFT collection displays. Fetching 100 NFT metadata accounts takes one RPC call vs 100 individual calls, essential for gallery views and collection explorers.

Parameters

pubkey (array, required)

An array of Pubkeys to query, as base-58 encoded strings (up to a maximum of 100)

config (object, optional)

Configuration object containing the following fields:

Fields:

  • commitment (string): The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.
  • minContextSlot (number): The minimum slot that the request can be evaluated at
  • dataSlice (object): Request a slice of the account's data.
    • length: <usize> - number of bytes to return
    • offset: <usize> - byte offset from which to start reading Data slicing is only available for base58, base64, or base64+zstd encodings.
  • encoding (string): Encoding format for the returned Account data
    • base58 is slow and limited to less than 129 bytes of Account data.
    • base64 will return base64 encoded data for Account data of any size.
    • base64+zstd compresses the Account data using Zstandard and base64-encodes the result.
    • jsonParsed encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data.
    • If jsonParsed is requested but a parser cannot be found, the field falls back to base64 encoding, detectable when the data field is type <string>.

Request

curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getMultipleAccounts",
"params": [
[
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
"4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
],
{
"encoding": "base58",
"commitment": "finalized"
}
]
}'
Network Selection

Replace mainnet with devnet in the URL to query devnet instead.

Response

{
"jsonrpc": "2.0",
"result": {
"context": { "apiVersion": "2.0.15", "slot": 341197247 },
"value": [
{
"data": ["", "base58"],
"executable": false,
"lamports": 88849814690250,
"owner": "11111111111111111111111111111111",
"rentEpoch": 18446744073709551615,
"space": 0
},
{
"data": ["", "base58"],
"executable": false,
"lamports": 998763433,
"owner": "2WRuhE4GJFoE23DYzp2ij6ZnuQ8p9mJeU6gDgfsjR4or",
"rentEpoch": 18446744073709551615,
"space": 0
}
]
},
"id": 1
}

Response Fields

Return value: array

The result will be an array containing either: - null - if the account at that Pubkey doesn't exist, or - Account objects with the following fields:

FAQ and Troubleshooting

What's the maximum number of accounts I can fetch in one call?

100 accounts per request. This limit is enforced at the RPC level via --rpc-max-multiple-accounts config. For larger sets, chunk into batches of 100 and make multiple calls.

Why does getMultipleAccounts return null for some accounts?

Null indicates the account doesn't exist at the queried pubkey, or the account state hasn't committed to your specified commitment level yet. Check pubkey validity and try increasing commitment from processed to confirmed.

Should I use getMultipleAccounts or parallel getAccountInfo calls?

Use getMultipleAccounts for 5+ accounts. For fewer than 12 accounts, parallel getAccountInfo may be faster due to lower per-call overhead. getMultipleAccounts optimizes network roundtrips but has slightly higher processing cost per request.

Does getMultipleAccounts support jsonParsed encoding?

Yes, but client library support varies. Official RPC supports jsonParsed encoding, but older web3.js versions don't expose it via connection.getMultipleAccounts. Use connection.getMultipleParsedAccounts or raw RPC if available.

How do I handle getMultipleAccounts exceeding the 100 account limit?

Chunk your pubkey array: for (const chunk of chunks(pubkeys, 100)) \{ await connection.getMultipleAccounts(chunk); \}. Most production code uses batch size 100 with Promise.all for parallel execution across chunks.

getAccountInfo
Returns single account data including lamports, owner, and data. Use getMultipleAccounts when fetching 5+ accounts to reduce RPC calls; use getAccountInfo for single-account lookups or when you need immediate individual results.

getProgramAccounts
Returns all accounts owned by a program with optional filtering. Common pattern: getProgramAccounts(dataSlice: {length: 0}) for addresses only, then getMultipleAccounts in 100-account batches to fetch full data efficiently.

getTokenAccountsByOwner
Fetches all token accounts for a wallet filtered by mint or program. Returns full account data; use getMultipleAccounts afterward if you need to fetch additional related accounts (like mint metadata).

accountSubscribe (WebSocket)
WebSocket subscription for real-time account updates. After initial getMultipleAccounts snapshot, subscribe to individual accounts for live updates rather than polling getMultipleAccounts repeatedly.

getBalance
Returns SOL lamports for a single account. For checking multiple wallet balances, getMultipleAccounts is more efficient; parse lamports field from results instead of separate getBalance calls.

External Resources