> ## Documentation Index
> Fetch the complete documentation index at: https://docs.solanatracker.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana RPC quickstart: make your first request

> Call Solana Tracker RPC with curl and Node.js, authenticate with an API key, and handle HTTP and JSON-RPC errors.

This guide reads an account's SOL balance over HTTP. Use a server-side script and an RPC API key from the [dashboard](https://www.solanatracker.io/solana-rpc).

## Call getBalance

Set your API key, then run:

```bash theme={null}
export SOLANA_RPC_API_KEY="YOUR_API_KEY"
curl "https://rpc-data.solanatracker.io/?api_key=${SOLANA_RPC_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"getBalance","params":["So11111111111111111111111111111111111111112",{"commitment":"confirmed"}]}'
```

Replace the example address with a wallet or account public key. The response contains `result.context.slot` and `result.value`. The value is in **lamports**, where 1 SOL equals 1,000,000,000 lamports; this method does not return SPL token holdings.

## Use Node.js

Use Node.js 20 or later. Save this as `balance.mjs` and run it with the same environment variable. The helper checks both HTTP errors and JSON-RPC errors, which can be returned with HTTP 200.

```javascript balance.mjs theme={null}
const apiKey = process.env.SOLANA_RPC_API_KEY;
if (!apiKey) throw new Error("Set SOLANA_RPC_API_KEY before starting");
const endpoint = new URL("https://rpc-data.solanatracker.io/");
endpoint.searchParams.set("api_key", apiKey);

async function rpc(method, params = []) {
  const response = await fetch(endpoint, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
    signal: AbortSignal.timeout(15_000),
  });
  if (!response.ok) throw new Error(`HTTP ${response.status}`);
  const body = await response.json();
  if (body.error) {
    throw new Error(`RPC ${body.error.code}: ${body.error.message}`);
  }
  return body.result;
}

const balance = await rpc("getBalance", [
  "So11111111111111111111111111111111111111112",
  { commitment: "confirmed" },
]);
console.log({ slot: balance.context.slot, lamports: balance.value });
```

```bash theme={null}
node balance.mjs
```

Keep API keys in server-side environment variables. Avoid putting the endpoint URL, including its key, into client bundles or logs.

## Choose commitment

* `processed`: the node's most recent processed state; it can be rolled back.
* `confirmed`: state voted on by a supermajority of stake. This example uses it for current reads.
* `finalized`: state at the strongest commitment level, further behind the chain tip.

Choose the same commitment when comparing related reads. Calls made separately can still return different context slots. Use [getMultipleAccounts](/solana-rpc/http/getmultipleaccounts) when you need several account values in one response.

## Handle failures

For HTTP 429, reduce concurrency and retry reads with bounded backoff and jitter. Invalid parameters and authentication errors need a request or configuration fix. If a transaction submission times out, check its signature status before deciding how to retry; rebuilding and signing creates a different transaction.

## Next steps

* [Read token accounts](/solana-rpc/http/gettokenaccountsbyownerv2).
* [Subscribe to changes](/solana-rpc/subscriptions).
* [Check request costs and rate limits](/solana-rpc/credits-and-rate-limits).
