TriportRPC

getAccountInfo

Last updated:

`getAccountInfo` fetches the current on-chain state of a single account, identified by its base-58 public key. It is the canonical way to read an account's lamport balance, owning program, and raw or decoded data in one call.

Use it when you need the full picture of one account — for example to read a token mint, a program-derived address (PDA), or a config account. If you only need the SOL balance, prefer the lighter [`getBalance`](./getBalance.md); to read many accounts in a single round-trip, use [`getMultipleAccounts`](./getMultipleAccounts.md).

The shape of the returned `data` depends on the `encoding` you request. Binary encodings (`base58`, `base64`, `base64+zstd`) return the raw account bytes as a `[data, encoding]` tuple. With `jsonParsed`, well-known program accounts (System, SPL Token, etc.) are decoded into structured JSON; if no parser is available the response falls back to the binary tuple. When the account does not exist, `value` is `null` while `context` is still populated.

Parameters

getAccountInfo parameters
NameTypeRequiredDescription
pubkeyPubkeyYesPubkey of account to query, as base-58 encoded string
configGetAccountInfoConfigNo

Returns

getAccountInfo return value
FieldType
resultobject

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"getAccountInfo","params":["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",{"encoding":"base64"}]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "getAccountInfo",
  "params": [
    "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    {
      "encoding": "base64"
    }
  ],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getAccountInfo","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 getAccountInfo do?
Returns all information associated with the account of the given Solana public key.
How many credits does getAccountInfo cost?
getAccountInfo costs 1 credit(s) per call on Triport by default.
Is getAccountInfo available over WebSocket?
getAccountInfo is an HTTP JSON-RPC method.