getAccountInfo — Solana JSON-RPC

Status: Available

Returns all information associated with the account of the given Solana public key.

POSThttps://triport.io/sol
Network
Solana
Scope
sol_read_rpc
Auth
x-token: $TRIPORT_API_KEY (or Authorization: Bearer)
Rate limit
free+ — 20 rps (free) / 60 rps (basic) / 200 rps (pro) / 600 rps (business), with burst

Endpoint and plans: Solana RPC endpoint.

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; to read many accounts in a single round-trip, use getMultipleAccounts.

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

Positional params array: [pubkey, config?].

pubkeystring (base-58 Pubkey)required
Public key of the account to query. Must match ^[1-9A-HJ-NP-Za-km-z]{32,44}$.
configobjectoptional
Optional configuration object (see below).
config (GetAccountInfoConfig)object
encodingstringoptional
One of base58, base64, base64+zstd, jsonParsed. Defaults to base64. base58 is limited to account data under 129 bytes.
commitmentstringoptional
Confirmation level: processed, confirmed, or finalized.
dataSliceobjectoptional
Limits the returned data to a byte slice: { "offset": <integer>, "length": <integer> }. Only valid with the binary encodings.
minContextSlotintegeroptional
Minimum slot the request must be evaluated at. The request fails if the node has not yet reached this slot.

Response

When the account does not exist, value is null:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "context": { "slot": 348392041, "apiVersion": "2.0.18" },
    "value": null
  }
}
context.slotinteger
Slot at which the data was evaluated.
context.apiVersionstring
Version of the RPC node that served the request.
valueobject | null
Account state, or null if the account does not exist.
value.lamportsinteger
Balance of the account in lamports.
value.ownerstring (base-58)
Public key of the program that owns the account.
value.executableboolean
Whether the account holds a loaded program.
value.rentEpochinteger
Epoch at which this account will next owe rent (u64).
value.spaceinteger
Size of the account data in bytes.
value.dataarray | object
Account data. For binary encodings: [<data>, <encoding>]. For jsonParsed: a decoded object, or the binary tuple if no parser matched.

Errors

Errors use the standard JSON-RPC envelope (error.code, error.message, error.data).

CodeHTTPMeaningWhen it happens
-32602400Invalid paramspubkey is not valid base-58, or config contains an invalid value (e.g. base58 encoding on data larger than 129 bytes).
—403Tier insufficientAPI key's tier/scope does not include sol_read_rpc. Rejected before the RPC layer: plain HTTP body {"error":"tier_insufficient", …} with an X-Required-Tier header — there is no JSON-RPC error object.
—429Rate limit exceededMore than your tier's sustained RPS (with burst) was sent. Plain HTTP body {"error":"rate_limited", …} with limit_rps, burst_capacity and retry_after_sec; honour Retry-After and X-RateLimit-Reset.
-32601404Method not foundMethod name misspelled or not available on this chain.

Example rate-limit response — HTTP 429 with a plain body, not a JSON-RPC envelope:

{
  "error": "rate_limited",
  "message": "Rate limit reached: your free plan allows 20 requests/s for sol_read_rpc. Retry in 1s (see the Retry-After header) or upgrade for a higher limit at https://triport.io/app/pricing",
  "current_tier": "free",
  "category": "sol_read_rpc",
  "limit_rps": 20,
  "burst_capacity": 40,
  "retry_after_sec": 1,
  "upgrade_url": "https://triport.io/app/pricing",
  "docs_url": "https://triport.io/errors/http-429-rate-limit"
}

See the shared errors reference for the full envelope and retry guidance.

Examples

JavaScript (fetch)

const res = await fetch("https://triport.io/sol", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getAccountInfo",
    params: [
      "So11111111111111111111111111111111111111112",
      { encoding: "jsonParsed", commitment: "finalized" },
    ],
  }),
});


const { result } = await res.json();
console.log(result.value); // null if the account does not exist

Notes

  • Encoding & size: base58 only works for account data smaller than 129 bytes; use base64 or base64+zstd for larger accounts. base64+zstd compresses the bytes before base-64 encoding, which is worth it for large accounts.
  • dataSlice: combine with a binary encoding to fetch only a window of the account's bytes — handy for reading a single field out of a large account without transferring the whole thing. It is ignored by jsonParsed.
  • Commitment: use confirmed or processed when you need changes sooner and can tolerate possible rollbacks; finalized is the safest choice for settled state.
  • Related methods: getBalance (lamports only), getMultipleAccounts (batch reads), and getProgramAccounts (all accounts owned by a program — note its much stricter sol_read_rpc_heavy rate limits of 2 / 5 / 20 / 80 rps).