The terminal is a client of a small HTTP API on the same origin. Market data and pool state are public. Anything that acts for a wallet needs that wallet's session, and nothing here can move funds without a transaction the wallet signs.
Conventions
JSON in, JSON out, same origin as the site. Request bodies are application/json and at most 4 KiB.
Amounts are decimal strings, never floats. Token amounts are raw tokens to eight places, USDC to six.
Requests that change anything must carry this site's own Origin.
Responses are never cached: Cache-Control: no-store.
Errors always have the same shape: { "error": { "code", "message" } }. The message is written for people.
Public data
Method
Path
Returns
GET
/api/market-data
Every market: reference price, its source and age, session and calendar, mint, decimals, multiplier, mint verification, OPEN or STALE with the reason, and price history. Add ?chart= and a market ID to receive only that market's history.
GET
/api/settlement
The OPmode markets: network, program, market account and readiness for each, with the reason when a market is not ready, and the current Pyth reference price with its source time. Adding ?market={id} also asks for a fresh on-chain reference for that market.
GET
/api/settlement/liquidity?market={id}
One pool's vault balances, total shares and fee share, read at a slot. Signed in, it adds your shares and balances.
GET
/api/health
Whether the database and the pricing engine are up, and how many markets have a usable reference. 503 when the database or engine is down.
Market IDs are lower-case tickers without the x, and without the dot for BRK.Bx (brkb). The ten OPmode markets are nvda, spy, qqq, gld, tsla, aapl, msft, meta, coin and crcl.
Wallet session
Method
Path
Purpose
POST
/api/wallet/nonce
Body: address. Returns a sign-in challenge, valid five minutes, usable once.
POST
/api/wallet/verify
Body: challengeId, address, publicKey, signedMessage, signature (bytes as base64). Opens a seven-day session.
SOL, USDC and stock tokens for the signed-in address, read at one slot.
POST
/api/wallet/logout
Revokes the session.
Quick orders
Method
Path
Purpose
POST
/api/live/orders
Body: marketId, side (buy or sell), cash (USDC or SOL, the side that is not the stock; default USDC), inputAmount, requestKey (UUID), slippageBps (1 to 300; the terminal sends 50). Returns an estimated output, minimum received and unsigned transaction.
POST
/api/live/orders/{id}/execute
Body: signedTransaction (base64). Submits the saved order's wallet-signed transaction.
GET
/api/live/orders/{id}
Refreshes status, signature and explorer link.
GET
/api/live/orders
The wallet's saved Quick orders.
OPmode orders
Check /api/settlement first. A market whose readiness is not READY cannot be quoted.
Method
Path
Purpose
POST
/api/settlement/orders
Body: marketId, side (BUY or SELL), inputAmount, requestKey (a UUID you generate). Returns a firm quote and the unsigned transaction.
POST
/api/settlement/orders/{id}/execute
Body: signedTransaction (base64). Submits exactly those bytes.
GET
/api/settlement/orders/{id}
Current status, signature, receipt address and explorer link.
POST
/api/settlement/orders/{id}/recover
Re-checks an order whose outcome is unknown.
GET
/api/settlement/orders
The wallet's recent orders, newest first.
Pool deposits and withdrawals
Method
Path
Purpose
POST
/api/settlement/liquidity/orders
Body: marketId, kind (DEPOSIT or WITHDRAW), inputAmount (USDC for a deposit, shares for a withdrawal), requestKey. Returns the estimated amounts, the minimums and maximums written into the transaction, and the unsigned transaction.
POST
/api/settlement/liquidity/orders/{id}/execute
Body: signedTransaction (base64).
GET
/api/settlement/liquidity/orders/{id}
Current status and explorer link.
POST
/api/settlement/liquidity/orders/{id}/recover
Re-checks a transaction whose outcome is unknown.
GET
/api/settlement/liquidity/orders
The wallet's deposits and withdrawals.
requestKey makes order creation safe to retry. Sending the same key with the same body returns the same order; sending it with a different body is refused. Statuses are QUOTED, SUBMITTING, CONFIRMED, FINALIZED, FAILED, EXPIRED and UNKNOWN, with the meanings given in Receipts and history.
The OPmode pool cannot quote this order now: paused, reference refreshing, over a limit, short of inventory, or outside the band. OPmode's wallet balance checks also answer 503.
OPmode's underlying Pyth reference cannot be used now: it is being prepared or confirmed on chain, the US session is closed or unverified, the source is too old, too uncertain or has too few publishers, or the USDC parity check failed.
Quick cannot route this market right now. Retry later; there is no fallback.
Polling and reservations
An OPmode quote reserves real pool inventory until it expires, so request one only when you intend to use it. For display, poll /api/market-data no faster than once every two seconds; references refresh every few seconds, so polling harder gets you the same answer.