getAccountInfo
https://api.triport.ioReturns all information associated with the account of the given Solana public key.
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^[1-9A-HJ-NP-Za-km-z]{32,44}$.configobjectoptionalconfig (GetAccountInfoConfig)objectencodingstringoptionalbase58, base64, base64+zstd, jsonParsed. Defaults to base64. base58 is limited to account data under 129 bytes.commitmentstringoptionalprocessed, confirmed, or finalized.dataSliceobjectoptional{ "offset": <integer>, "length": <integer> }. Only valid with the binary encodings.minContextSlotintegeroptionalResponse
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.slotintegercontext.apiVersionstringvalueobject | nullnull if the account does not exist.value.lamportsintegervalue.ownerstring (base-58)value.executablebooleanvalue.rentEpochintegeru64).value.spaceintegervalue.dataarray | object[<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).
| Code | HTTP | Meaning | When it happens |
|---|---|---|---|
-32602 | 400 | Invalid params | pubkey is not valid base-58, or config contains an invalid value (e.g. base58 encoding on data larger than 129 bytes). |
-32002 | 403 | Tier insufficient | API key's tier/scope does not include sol_read_rpc. |
-32003 | 429 | Rate limit exceeded | More than your tier's sustained RPS (with burst) was sent. Honour the Retry-After header. |
-32601 | 404 | Method not found | Method name misspelled or not available on this chain. |
Example rate-limit envelope:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32003,
"message": "Rate limit exceeded: 20 RPS sustained on sol_read_rpc (free tier)",
"data": {
"current_tier": "free",
"category": "sol_read_rpc",
"limit_rps": 20,
"burst_capacity": 40,
"retry_after_sec": 1
}
}
}See the shared errors reference for the full envelope and retry guidance.
Examples
JavaScript (fetch)
const res = await fetch("https://api.triport.io", {
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 existTypeScript SDK (@triport/sdk)
import { Triport } from "@triport/sdk";
const client = new Triport({ apiKey: process.env.TRIPORT_API_KEY! });
const { context, value } = await client.sol.getAccountInfo(
"So11111111111111111111111111111111111111112",
{ encoding: "jsonParsed", commitment: "finalized" },
);
if (value === null) {
console.log(`account not found at slot ${context.slot}`);
} else {
console.log(value.lamports, value.owner);
}Python (triport-sdk)
import os
from triport import Triport
client = Triport(api_key=os.environ["TRIPORT_API_KEY"])
resp = client.sol.get_account_info(
"So11111111111111111111111111111111111111112",
encoding="jsonParsed",
commitment="finalized",
)
if resp.value is None:
print(f"account not found at slot {resp.context.slot}")
else:
print(resp.value.lamports, resp.value.owner)Notes
- Encoding & size:
base58only works for account data smaller than 129 bytes; usebase64orbase64+zstdfor larger accounts.base64+zstdcompresses 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 byjsonParsed.- Commitment: use
confirmedorprocessedwhen you need lower latency and can tolerate possible rollbacks;finalizedis the safest choice for settled state. - Related methods:
getBalance(lamports only),getMultipleAccounts(batch reads), andgetProgramAccounts(all accounts owned by a program — note its much strictersol_read_rpc_heavyrate limits of 2 / 5 / 20 / 80 rps).