API Reference

HTTP APIs available to agents and the Proof of Reserves / Token Explorer frontends. All endpoints return JSON. CORS is enabled for *.

1. Base URL

When calling from a browser on this site, use relative paths (e.g. /api/reserves). From an external agent or script, use the full origin (e.g. https://www.solanaagent.app/api/reserves).

No authentication is required for the documented read and create endpoints; they are public.

2. Reserves & proof

GET /api/reserves

Returns Bitcoin and Solana reserve addresses and balances.

Request: No parameters.

Response (200):

FieldTypeDescription
bitcoin.addressstring \| nullReserve BTC address
bitcoin.balanceBtcnumber \| nullBalance in BTC
bitcoin.balanceSatnumber \| nullBalance in satoshis
solana.addressstring \| nullReserve SOL address
solana.balanceSolnumber \| nullBalance in SOL
curl "https://www.solanaagent.app/api/reserves"

GET /api/proof

Returns a dated message and Bitcoin/Solana signatures proving ownership of the reserve keys.

Response (200): message, timestamp, bitcoin.address, bitcoin.signature, solana.address, solana.signature.

3. Transactions

GET /api/transactions/bitcoin

Recent Bitcoin transactions for the reserve address (most recent first, up to 100).

Response (200): { "transactions": [ { "txid", "blockTime", "blockHeight" }, ... ] }

GET /api/transactions/solana

Recent Solana transactions for the reserve address.

Response (200): { "transactions": [ { "signature", "blockTime", "err" }, ... ] }

4. ABSR (Arbitrage / reserve summary)

GET /api/arbitrage/summary

BTC/SOL prices (Hyperliquid) and ABSR supply (reserve sats, USD, on-chain token supply).

Response (200): btcPriceUsd, solPriceUsd, absrSupplySats, absrSupplyUsd, absrTokenSupply.

GET /api/arbitrage/transactions

ABSR-related transactions (e.g. issue on swap completion).

Response (200): { "transactions": [ { "signature", "txId", "type", "amountSats", "amountUsd", "blockTime" }, ... ] }

5. Exchange (ChangeNOW — human flow)

GET /api/exchange/min

Minimum amount for a currency pair.

Query: from, to (e.g. btc, eth, usdterc20, sol).

Response (200): { "from", "to", "minAmount": number | null }

GET /api/exchange/estimate

Estimated output amount for a given input.

Query: from, to, amount (positive number).

Response (200): { "from", "to", "amount", "estimatedAmount": number | null }

POST /api/exchange/create

Create a ChangeNOW exchange transaction. User sends from to the returned payin address and receives to at payoutAddress.

Body:

ParameterTypeRequired
fromstringYes (e.g. btc, eth, sol)
tostringYes
amountnumberYes (positive)
payoutAddressstringYes (destination for "to" currency)

Response (200): id, payinAddress, payinAmount, payinCurrency, status, statusUrl (tracker link).

curl -X POST "https://www.solanaagent.app/api/exchange/create" \
  -H "Content-Type: application/json" \
  -d '{"from":"btc","to":"eth","amount":0.01,"payoutAddress":"0x..."}'

GET /api/exchanges/transactions

Reserve SOL→BTC swap history (from Postgres).

Response (200): { "transactions": [ { "signature", "txId", "solAmount", "btcSats", "blockTime" }, ... ] }

6. Swap (reserve SOL → BTC)

GET /api/swap/min

Minimum SOL amount and current reserve SOL balance for SOL→BTC swap.

Response (200): { "minAmountSol", "balanceSol" }

GET /api/swap/estimate

Estimated BTC (sats) for a given SOL amount.

Query: amountSol (positive number).

Response (200): { "amountSol", "estimatedBtcSats" }

POST /api/swap/create

Create a reserve SOL→BTC swap: ChangeNOW transaction is created and SOL is sent from the reserve key; BTC is received at the reserve BTC address.

Body: { "amountSol": number } (positive).

Response (200): id, amountSol, expectedBtcSats, solanaSignature, status.

GET /api/swap/status/:id

Poll ChangeNOW transaction status by ID.

Response (200): { "id", "status", "amountSol", "btcSats", "payinAddress" }. status e.g. waiting, finished, failed.

7. Invoices (agent token creation)

Agent submits token details → receives an invoice (fee in SOL). After paying the invoice to the treasury, the server creates the SPL token and adds it to the listing.

POST /api/invoices

Create an invoice for token creation.

Body:

ParameterTypeRequired
namestringYes
symbolstringYes
decimalsnumber (0–9)No (default 9)
supplystringNo (default "0")
descriptionstringNo
creator_addressstringYes (SOL address to receive minted supply)
revoke_freeze_authoritybooleanNo
revoke_mint_authoritybooleanNo
revoke_update_authoritybooleanNo
metaplex_metadatabooleanNo

Response (200): invoice_id, treasury_address, fee_sol, fee_lamports, message, created_at.

GET /api/invoices/:id

Get invoice by ID (UUID).

Response (200): Full invoice fields including status (pending, completed), payment_tx_signature, token_id, paid_at, completed_at.

POST /api/invoices/confirm

Confirm payment: provide invoice ID and the Solana transaction signature that sent fee_sol to the treasury. On success, the server creates the token and lists it.

Body: { "invoice_id": string, "tx_signature": string } (or invoiceId, txSignature).

Response (200): { "ok": true, "status": "completed", "token_id", "mint_address", "message" }.

8. Tokens & listings

GET /api/tokens

List tokens. Optional query: creator (SOL address) to filter by creator.

Response (200): { "tokens": [ { "id", "name", "symbol", "decimals", "supply", "mint_address", "creator_address", ... }, ... ] }

GET /api/tokens/:id

Get a single token by numeric ID.

GET /api/listings/search

Search listed tokens. Query: q (search string, name/symbol).

GET /api/listings

Get listing(s). Query: token_id (optional).

POST /api/listings/request

Request a listing (e.g. for an existing token). Body includes token_id and other fields; response returns fee and treasury address for payment.

POST /api/listings/confirm

Confirm listing payment (tx signature). On success the token is listed.

9. Explorer

GET /api/explorer/treasury

Returns treasury SOL address and optional metadata for the Token Explorer.

10. Errors

Errors are returned with appropriate HTTP status (400, 404, 502, 503) and a JSON body such as { "error": "message" }.