TriportRPC

getMultipleAccounts

Last updated:

`getMultipleAccounts` fetches the current on-chain state of several accounts at once, identified by their base-58 public keys. It is the batched counterpart of [`getAccountInfo`](./getAccountInfo.md): instead of one request per account, you pass up to **100** public keys and receive one `AccountInfo` entry per key, in the same order you requested them.

Use it whenever you would otherwise loop over `getAccountInfo` — for example to read a set of token accounts, several PDAs, or a basket of mints — to cut latency and stay well within your rate limit. All accounts are read at the same slot, so the returned values are mutually consistent.

The `value` array is positional and the same length as the `pubkeys` you sent. Any account that does not exist comes back as a `null` entry at that position (the surrounding array and `context` are still populated). The shape of each account's `data` field depends on the `encoding` you request, exactly as for `getAccountInfo`.

Parameters

getMultipleAccounts parameters
NameTypeRequiredDescription
pubkeysarrayYes
configGetAccountInfoConfigNo

Returns

getMultipleAccounts return value
FieldType
resultobject

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"getMultipleAccounts","params":[["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"],{"encoding":"base64"}]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "getMultipleAccounts",
  "params": [
    [
      "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
    ],
    {
      "encoding": "base64"
    }
  ],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getMultipleAccounts","params":[["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"],{"encoding":"base64"}],"jsonrpc":"2.0"})
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet, devnet, testnet.
  3. Credit cost: 1 per call.

FAQ

What does getMultipleAccounts do?
Returns the account information for a list of Solana public keys in a single round-trip.
How many credits does getMultipleAccounts cost?
getMultipleAccounts costs 1 credit(s) per call on Triport by default.
Is getMultipleAccounts available over WebSocket?
getMultipleAccounts is an HTTP JSON-RPC method.