HTTP errors
HTTP status codes and the two error shapes.
Status codes
400
Bad request
Invalid pubkey, missing field, bad enum, trigger/limit validation failure
404
Not found
Account/pool not found; price symbol not in the config
429
Too many requests
Per-owner WebSocket connection limit (5) exceeded
500
Internal server error
Compute failure, blockhash fetch failed, unexpected state
503
Service unavailable
Price data missing (market closed); global WebSocket limit reached
Two error shapes
// HTTP-level failure (400, 404, 500, …)
{ "error": "descriptive message" }
// Compute failure returned inside a 200 body (quote endpoints)
{ "err": "descriptive message" }The API uses "error" for HTTP/transport failures and "err" for domain/compute failures on trading/preview quote endpoints. Trigger-order and limit-order builders return validation failures as 400 { "error": "…" }. Always check for both.
Handling pattern
const res = await fetch(`${FLASH_API_URL}/transaction-builder/open-position`, {
method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(req),
});
if (!res.ok) {
const { error } = await res.json(); // 4xx / 5xx
if (res.status === 404) console.error("Market or symbol not found");
if (res.status === 503) console.error("Price unavailable (market closed?)");
throw new Error(error);
}
const data = await res.json();
if (data.err) throw new Error(data.err); // compute error in a 200 body
// else sign & submit data.transactionBase64For submitted-transaction failures (the program rejects a signed tx), see On-chain error codes.
Last updated
Was this helpful?

