getMultipleAccounts
Returns the account information for a list of Pubkeys.
Common use cases
| Portfolio balance display | Fetch 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 validation | Retrieve 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 results | After 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 batching | Fetch 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 collection | Retrieve 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 atdataSlice(object): Request a slice of the account's data.length: <usize>- number of bytes to returnoffset: <usize>- byte offset from which to start reading Data slicing is only available forbase58,base64, orbase64+zstdencodings.
encoding(string): Encoding format for the returned Account database58is slow and limited to less than 129 bytes of Account data.base64will return base64 encoded data for Account data of any size.base64+zstdcompresses the Account data using Zstandard and base64-encodes the result.jsonParsedencoding attempts to use program-specific state parsers to return more human-readable and explicit account state data.- If
jsonParsedis requested but a parser cannot be found, the field falls back tobase64encoding, detectable when thedatafield is type<string>.
Request
- cURL
- JavaScript
- Python
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"
}
]
}'
// Using fetch
const response = await fetch('https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getMultipleAccounts",
"params": [
[
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
"4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
],
{
"encoding": "base58",
"commitment": "finalized"
}
]
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = 'https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "getMultipleAccounts",
"params": [
[
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
"4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
],
{
"encoding": "base58",
"commitment": "finalized"
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
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.
Related Methods
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.