Conventions
Rules shared by every endpoint — base URL, units, errors, enums.
These apply across the whole API and aren't repeated on each endpoint page.
Base URL
https://flashapi.tradeNo API key. Reads are plain HTTP; every transaction-builder endpoint returns an unsigned transaction you sign client-side. See Signing & submitting.
Units
UI units — human-readable decimal strings (e.g.
"100.0"USDC,"148.52"price). Request bodies and*Uiresponse fields use these. The server converts to native using each token's decimals (including Token-2022 scaling).Native units — raw integers (e.g.
price+exponent). Applyvalue × 10^exponent.
Position identity
Trading and preview endpoints identify a position by (owner, marketSymbol, side) — e.g. "SOL" + "LONG". No position pubkeys. See The Basket model.
Error shapes
Two keys, two surfaces — always check both:
{ "error": "…" } // HTTP-level failure (4xx / 5xx)
{ "err": "…" } // compute failure returned inside a 200 body (quote endpoints)Status codes
200
Success
101
WebSocket upgrade
400
Bad request / validation error / invalid pubkey
404
Resource not found (account, price symbol, pool)
429
Too many requests (per-owner WebSocket limit)
500
Internal server error / compute error / blockhash fetch failed
503
Service unavailable (price missing, global connection limit)
Full recovery guidance: Errors.
Enums
TradeType (SCREAMING_SNAKE_CASE) — LONG, SHORT. SWAP is not supported.
OrderType — MARKET (executes immediately), LIMIT (executes at trigger price).
MarginAction — ADD, REMOVE.
Transaction responses
transactionBase64
Unsigned v0 transaction. null in preview-only mode
receipt
Receipt PDA to poll (withdrawal/settlement builders)
err
Set when a quote computation failed
Last updated
Was this helpful?

