Mainly

Quickstart

Make your first Mainly API call in under five minutes.

1. Get an API key

Create an account and generate a key from the dashboard. Keys look like mnly_live_... for mainnet and mnly_test_... for devnet.

Note: The platform is in early access. If you don't have a key yet, this reference still tells you exactly what to expect from every endpoint.

2. Base URL and authentication

All requests are scoped by chain and network:

NetworkBase URL
Solana mainnethttps://api.sarg.am/v1/solana
Solana devnethttps://api.sarg.am/v1/solana-devnet

Authenticate with a standard bearer token header — never put keys in the URL:

Authorization: Bearer $MAINLY_API_KEY

3. Your first request

Fetch the SOL balance of any wallet:

curl https://api.sarg.am/v1/solana/wallets/9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM/balance \
  -H "Authorization: Bearer $MAINLY_API_KEY"
{
  "address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
  "lamports": 1529000000,
  "sol": 1.529
}

The same call from JavaScript — no SDK required:

const res = await fetch(
  "https://api.sarg.am/v1/solana/wallets/9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM/balance",
  { headers: { Authorization: `Bearer ${process.env.MAINLY_API_KEY}` } },
);
const { sol } = await res.json();
console.log(`Balance: ${sol} SOL`);

4. Something you can't do in one RPC call

Get every token the wallet holds — including names, symbols, logos, and USD prices — in a single request:

curl https://api.sarg.am/v1/solana/wallets/9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM/tokens \
  -H "Authorization: Bearer $MAINLY_API_KEY"

Against raw Solana RPC this takes four calls across two token programs plus a metadata service. See List wallet tokens for the full response shape.

Next steps

  1. Skim the four core concepts — units, confirmation, pagination, errors. Ten minutes, and the whole API becomes predictable.
  2. Browse the API reference for the complete endpoint catalogue.
  3. Building a transaction flow? Start at Send a transaction.

On this page