Errors

{ "error": { "code", "message", "details?" } }

Standard HTTP status codes and one error envelope on every endpoint. Branch on the code; the message is for people.

Error envelope

Every non-2xx response is an object with a single top-level key:

{
  "error": {
    "code": "invalid_api_key",
    "message": "API key is invalid, revoked, or expired",
    "details": { }
  }
}

Always branch on error.code rather than the English message. Messages may be refined over time; codes are stable. The AI pass-through is the one exception: it returns errors in the provider's own shape, so the provider SDK raises its own typed errors.

Status codes

StatusWhen
200 OKSuccessful response. A rejected order leg is still a 200 — read results[i].rejected_code.
201 CreatedSomething was made: a model, a practice deposit, a link session, an app token.
202 AcceptedQueued, not done: a notification send, an AI inference still running past wait_seconds.
400 Bad RequestInvalid parameters, bad JSON, a malformed cursor, an unknown field on a strict body.
401 UnauthorizedMissing, invalid, revoked or expired credential.
402 Payment RequiredOut of reasoning credits on a managed AI call.
403 ForbiddenAuthenticated, but the plan, key scopes or the user's consent do not cover this — or the account is not yours.
404 Not FoundThe resource does not exist, or is not yours (the two are indistinguishable by design).
409 ConflictState disagrees: an archived model, an already-listed app, a linked AI key the provider rejected.
413 Payload Too LargeAn AI request body over 32 MB.
429 Too Many RequestsThe per-minute or per-day budget, or a user's monthly AI token cap.
500 Internal Server ErrorUnexpected server error. Safe to retry with backoff.
503 Service UnavailableAn upstream dependency is down. Retry with backoff.

Codes you will meet everywhere

CodeMeaning
missing_credentialsNeither X-API-Key nor Authorization: Bearer was sent.
invalid_api_keyThe key is unknown, revoked or past its expiry.
invalid_jwtThe session token failed verification or expired.
entitlement_requiredYour plan or key scopes lack a code; details.missing lists which.
scope_not_grantedAn install key whose user declined the scope, or a Connect user who withheld a venue permission.
account_forbiddenX-OpenMarkets-Account names a user your organization does not own.
rate_limit_exceededPer-minute or per-day quota hit. details.window says which; Retry-After says how long.
unknown_parameterA field outside a strict contract (orders, models) was sent.
not_foundThe addressed league, contest, market or position does not exist.
invalid_position_hashThe position_hash is not a 6-part colon-separated string.
internal_errorUnexpected server-side failure. Safe to retry.

Each page lists the codes specific to its surface — orders, models, AI Connect, Connect and notifications all have their own.

Sell codes

Selling a position (POST /orders/sell and /orders/sell/preview) has its own list of leg codes. Like a rejected buy leg, a refused sell leg is a 200 with the code in results[i].rejected_code. Each leg also carries message_user, written for an end user, and fix, a hint a UI can act on. The list is closed; treat an unlisted value as unknown.

CodeMeaningfix
sell_not_supportedThe venue cannot sell this position, or selling is off for it. It is held until it settles. The position's sell block says which.none
unsupported_order_typeThe venue does not take that order_type for a sell.none
position_not_foundNo open contracts for this position. Missing and not yours are the same answer.none
position_route_ambiguousThe position is held on more than one market at the venue. Send partner_market_id; details.partner_market_ids lists the choices.name_route
insufficient_positionNot enough sellable contracts. details has held, reserved and sellable, and venue_position when the venue's own count was read. Also returned when the venue holds fewer contracts than our books show and the sell filled nothing.lower_contracts, or none when the venue holds none
sell_in_progressAnother sell on the position is still working, or mixes a model scope with an unscoped one. Wait for it or cancel it.retry
position_settlingThe contest is no longer open. The position will settle instead.none
no_bidNobody is bidding on the position.use_limit where the venue takes a limit sell, else none
bid_below_min_priceThe best bid is under your min_price, so a market sell would not fill.lower_price
no_live_bid_for_paperNo venue gives a bid for the practice position, so the practice sell has no price.none
venue_disabledThe venue account is not connected, or signing in to it failed.connect_venue
contracts_not_wholeThe venue sells whole contracts only.lower_contracts
venue_location_checkThe venue needs to confirm the user's location. The user opens the venue's app, signs in and allows location access, then the sell is sent again. Nothing was sold. details.venue_url is set when the venue has a link for it.retry
venue_location_blockedThe venue does not allow trading from the user's location. Opening the app does not change it.none
unknownAnything not classified. On a pending leg the venue did not answer, and on a failed leg the sell could not be confirmed: do not retry, check your orders.retry, or none when the outcome is unknown

Failures that apply to the whole request are HTTP errors with the usual envelope. The sell endpoints add one code of their own and share the rest with /orders/buy:

CodeHTTPMeaning
sell_not_enabled403Selling is not available for this environment. Nothing was placed.
real_money_not_permitted403A leg sells a real-money position and the caller lacks trade:execute. Nothing is placed, practice legs included.
connect_scope_required403Acting for a Connect user who has not granted trade:execute for a venue named on a real-money leg.
environment_unresolved403The credential carries no recognised environment. Mint a new key.
model_not_found404A model_id that does not exist or is not yours. An archived model is allowed.
bad_request400Invalid body: orders is not 1 to 10 legs, a bad liquidity_hash, contracts, min_price or order_type.
unknown_parameter400A field outside the strict sell contract was sent.
internal_error500Unexpected failure. Check your orders before you retry a sell.

Location refusals

A venue can refuse an order because it must confirm where the user is. The same two codes appear on a buy leg (POST /orders/buy) and on a sell leg, in results[i].rejected_code. Nothing was spent or sold. Today only Novig and BettorEdge classify these refusals; other venues return their usual codes. The refusal can only be known when the venue answers the order, not at preflight.

CodeMeaningfix
venue_location_checkThe user can fix it. They open the venue's app, sign in and allow location access, then you send the order again as a new confirmation. message_user names the venue's app. details.venue_url is set when the venue has a link for it.retry
venue_location_blockedThe venue does not allow trading from the user's location. There is nothing to fix.none

Retrying

Safe to retry: 429 (after Retry-After), 500, 503. Use exponential backoff with jitter. On a write, send the same Idempotency-Key so a retry cannot double-place.

Not safe to retry without changes: 400, 404, 409 — fix the input or the state first.

Never retry: 401 and 403. A second attempt with the same credential fails the same way.