Placing orders

POST /flow/v1/auth/orders/buy · trade:execute · execution key · "mode": "real" | "paper"
Live

Place, read, and cancel orders through OpenMarkets against a venue you name — for your own account (player JWT) or, with Connect, for each of your users (act-as).

Mental model

Execution turns a position you found in the read API into a fill on a specific venue. The liquidity feed for a contest returns each bettable outcome once, with a partner_liquidities[] array — one entry per venue that prices it, each carrying that venue's price, available size, and a liquidity_hash. You pick the venue you want, post its liquidity_hash and a price ceiling, and OpenMarkets places the underlying order on that partner on the acting account's behalf.

The pieces:

  • position_hash — venue-agnostic outcome key (the outcome, not a venue). To execute against it today you must also name a venue with partner_id.
  • liquidity_hash — a partner-scoped price key from partner_liquidities[]. It already names the venue, so it's the simplest thing to execute against.
  • router_order — the order we placed on that partner on the acting account's behalf.
You name the venue. Today execution is venue-directed: every leg resolves to one partner you chose — either a liquidity_hash, or a position_hash plus an explicit partner_id. Automatic best-venue routing across partners is coming soon — see below.

Auth & scope

Every execution endpoint accepts any of these caller identities:

  • Player JWT — the user acts on their own account. Send Authorization: Bearer <jwt>.
  • Org key, own account (owner_self) — a first-party desk trading its own book. Send X-API-Key with an execution-tier key and no X-OpenMarkets-Account header. The order books against the key's own account — the router_account_id reported by GET /auth/me — exactly like every /auth/* read you already make.
  • Connect org key, act-as — you act on one of your users. Send X-API-Key plus X-OpenMarkets-Account: <your-user-id> to scope the call to that user's sub-account. See the Connect integration guide.

Reads (GET orders, resting, resolution) need the account_read scope. The writes — /orders/buy and /orders/cancel — require an execution-tier key (or a player JWT acting on itself) with trade:execute for real money, or trade:practice for paper orders. A practice-only caller that touches a real-money order — buying or cancelling — gets 403 real_money_not_permitted. An account_read-only key that tries to place an order gets 403.

Regardless of who calls, the order always books against the acting account — the player's own account on a JWT, the org's own account when no X-OpenMarkets-Account is sent (owner_self), or the Connect sub-account named by X-OpenMarkets-Account. An org can never place an order against a user it doesn't own (403 account_forbidden).

Base URL

https://api.openmarkets.ai/flow/v1/auth

All examples below use Authorization: Bearer ... (player JWT). For Connect, swap it for X-API-Key + X-OpenMarkets-Account — the request and response bodies are identical.

Building a bet slip? Use the SDK

@openmarketsai/order-sheet is the bet slip on top of this API: it lists every venue quoting a position, checks each venue's rules, fees and balances before the tap (from pre-trade constraints), refines the numbers through preflight, places with an idempotency key and follows the order to fill and settlement. Headless core for any runtime, React hooks, and a styled card.

npm install @openmarketsai/order-sheet

import { createOrderSheetClient } from '@openmarketsai/order-sheet'

const om = createOrderSheetClient({ apiKey: process.env.OM_EXEC_KEY })   // or { getToken } / { auth }
const sheet = om.openSheet({ liquidityHash })        // from partner_liquidities[]
sheet.set({ stake: { amount: 5 } })                   // mode defaults to 'paper'
const out = await sheet.place()                       // 'placed' | 'blocked' (with issues) | 'confirm_required'

It sends mode on every leg, never picks a venue for the user, and keeps real money behind your opt-in and a confirm click. Everything below is what it does for you — read on if you are calling the API directly.

Since 0.2.0 the SDK also sells positions. It reads your holdings, previews the sale and sends it to the venue the position was bought on. A position that cannot be sold is shown as held, with the reason from its sell block. See Selling a position for the endpoints.

const { holdings } = await om.holdings({ status: 'open' })
const close = om.openCloseSheet({ holding: holdings[0] })
close.set({ contracts: { fraction: 0.5 } })            // or a number, or 'all'
const out = await close.sell()                          // 'placed' | 'confirm_required' | 'blocked' | 'unavailable'
// Real money: on 'confirm_required', show the user what will be sold, then on their click:
//   await close.confirm()
// sell() again is not the confirm, and confirm() right after the step opens is refused.

For React, useHoldings and useCloseSheet are in @openmarketsai/order-sheet/react, and HoldingsList and CloseSheetCard are the styled components in @openmarketsai/order-sheet/ui.

Place an order

POST /flow/v1/auth/orders/buy is the single execution entry point. It is multi-leg native — the body is an orders array and each leg is placed independently, so you can fill several positions (or the two legs of an arb) in one call. Each leg names its own venue.

The simplest form passes a liquidity_hash straight from partner_liquidities[] — it already names the venue:

curl -X POST https://api.openmarkets.ai/flow/v1/auth/orders/buy \
  -H 'Authorization: Bearer eyJhbGc...' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: 3f9c1e5a-...' \
  -d '{
    "orders": [
      {
        "liquidity_hash": "kalshi:ct_abc123:mk_ml:side_home:var_0:p_kc:tf_full",
        "amount": 50,
        "max_price": 0.52
      }
    ]
  }'

Equivalently, name the venue explicitly with a position_hash + partner_id:

{
  "orders": [
    {
      "position_hash": "ct_abc123:mk_ml:side_home:var_0:p_kc:tf_full",
      "partner_id": "kalshi",
      "amount": 50,
      "max_price": 0.52
    }
  ]
}

Each leg:

  • Exactly one of position_hash or liquidity_hash.
  • partner_id — the venue to fill on. Required with a bare position_hash today; already implied by a liquidity_hash. (Omitting it to let OpenMarkets pick the best venue is coming soon.)
  • Exactly one of amount (stake in USD) or shares (contract count). Must be positive.
  • max_price — price ceiling, strictly between 0 and 1. The order won't fill above it.
  • mode (optional) — "real" (default) or "paper" for a practice fill against the internal book.
  • order_type (optional) — "market" (default) or "limit". market fills immediately against resting liquidity up to your max_price and cancels any remainder — it never rests. limit posts a resting order at max_price that stays on the book until it fills or you cancel it — including below the current best price (a limit priced under the ask rests and waits; it is not rejected for lack of takeable liquidity, unlike a market order). Not every venue supports limit — see each venue's supported_order_types.
The body is strict. Any field outside this contract — a typo, an extra key, a stray leg field — returns 400 unknown_parameter and nothing is placed. There is no silent ignore.
Asking a venue for an order type it can't honor (e.g. order_type: "limit" on an immediate-only venue) returns 400 unsupported_order_type and nothing is placed — on both /orders/buy and /orders/preflight, so you can check support before charging the user.
Optional verify_liquidity: true (top-level). Before routing, confirm each named venue's live orderbook when its cached liquidity is stale or thin. If the book has moved away, that leg comes back status: "rejected" with rejected_code: "insufficient_live_depth" — declined before it fires, rather than sent as an order that fails to fill. Fresh, deep venues skip the extra check.

This declines the one leg; it does not stop the others. On a multi-leg request the remaining legs still place unless you also send check_all_first: true and on_leg_failure: "halt" — see multi-leg behavior. To preview all of this (routing + fees) without placing anything, use /orders/preflight below.
Group orders with opportunity_id (top-level). By default every request opens its own opportunity. Pass an existing one and these orders join it — which is what you want when a hedge came out one-legged and you're placing the offsetting order: it has to sit beside the leg that created the exposure, not read as an unrelated position. The response returns the opportunity_id each request landed in. Must be an opportunity you own (404 opportunity_not_found), match its currency (400 currency_mismatch — a real order can't be filed into a practice one), and belong to the same model as the request (400 model_mismatch).

Attribute with model_id (top-level). Records the model on every order and on the opportunity. Must be a model you own (404 model_not_found) and not archived (409 model_archived). See Models & attribution.

Both ids are validated before any venue is called — a bad one never costs a live orderbook check or a balance move.

The response reports each leg by index, with its realized fill on the named venue:

Response.data
{
  "results": [
    {
      "index": 0,
      "status": "completed",           // "completed" (filled) | "failed" (placed/blocked, no fill) | "rejected" (planner refused)
      "sor_decision_id": "sor_...",     // execution audit id
      "requested_partner_id": "kalshi", // the venue you named (from partner_id, or the liquidity_hash's first segment)
      "filled_notional": 1.89,          // USD ACTUALLY booked (whole-contract venues round down)
      "filled_shares": 9,               // contracts/shares actually filled
      "unfilled_notional": 0.11,        // requested minus booked (0 on a clean full fill)
      "avg_price": 0.21,
      "rejected_reason": null,          // human-readable reason when not "completed"
      "rejected_code": null,            // machine code: "venue_disabled" | "execution_limit_exceeded"
                                        //   | "above_max_price" | "insufficient_size"
                                        //   | "insufficient_live_depth" | "insufficient_balance"
                                        //   | "halted_upstream"  (never placed — see Multi-leg)
      "venues": [
        {
          "partner_id": "kalshi",
          "success": true,
          "router_order_id": "ro_...",  // the placed order — read it back via GET /orders
          "error": null
        }
      ]
    }
  ],
  "halted_at_index": null,             // index that stopped the request under
                                       // on_leg_failure:"halt"; null = ran to completion
  "opportunity_id": "opp_...",         // pass back on later buys to group more orders here;
                                       // null when no leg wrote an order
  "model_id": null                     // the model_id you sent, echoed
}
filled_notional / filled_shares are the ACTUAL booked fill, matching the order in GET /orders — not your requested stake. On whole-contract venues (Kalshi, Polymarket) the venue rounds down to whole contracts, so a $2 request at 21¢ books 9 contracts = $1.89, and unfilled_notional reports the un-buyable 0.11 remainder. A leg can also partially fill; either way, use unfilled_notional to tell a full fill from a rounded-down/partial one without a second request. By default legs are independent — one can complete while another is failed. See multi-leg requests to stop at the first failure instead.

The status values are distinct:

  • completed — the leg reached the venue and filled (fully, or — for a market order — partially with the remainder killed; check filled_notional). Terminal.
  • resting — a limit order placed with an unfilled remainder live on the book (unfilled_notional > 0).Non-terminal — this 200 is the initial state; watch for the fill on the orders WebSocket channel (or poll GET /orders/resting/me). Cancel it with /orders/cancel.
  • failed — the leg was placed or blocked but did not fill: a venue error, a fill-or-kill that found no liquidity at your max_price, or an execution-control block (see below — carries a rejected_code).
  • rejected — the router refused to plan the leg before dispatch (no viable venue for the position, or an invalid amount). Carries a free-text rejected_reason only.

Multi-leg requests

orders takes as many legs as you need. They are attempted one at a time, in the order you send them — orders[0] fully completes (reaching the venue and returning a fill) before orders[1] starts. results comes back index-aligned with your request.

Array order is your lever. If one leg should be attempted first, put it first — there is no other way to express priority. This matters most with on_leg_failure: "halt", where the first leg is the one that decides whether the rest happen at all: lead with the leg you most expect to fail (the thinner book, the flakier venue, the tighter price) so you find out before committing capital to the others.

Two intents, one field:

  • Maximize fills (default, on_leg_failure: "continue") — every leg is attempted regardless of what happened to the others. What you want when the legs stand on their own: a model firing several independent positions, where a miss on one shouldn't cost you the rest.
  • Stop at the first failure (on_leg_failure: "halt") — no further leg is placed. What you want when a later leg only makes sense if the earlier one landed: an arbitrage pair, a hedge, a staged entry.
Stop if the first leg doesn't land
{
  "on_leg_failure": "halt",
  "orders": [
    { "liquidity_hash": "kalshi:...",   "amount": 100, "max_price": 0.48 },
    { "liquidity_hash": "prophetx:...", "amount": 100, "max_price": 0.50 }
  ]
}

A leg halts the request when its status is failed or rejected. Legs that were never attempted come back status: "rejected" with rejected_code: "halted_upstream", so results stays index-aligned with your request and you can tell “never placed” from “placed and failed” without diffing your own payload. halted_at_index names the leg that stopped it.

Note what this means for the two non-terminal statuses: resting and pending are successes and do not halt. A resting limit is doing exactly what a limit order is for, so halting on it would stop nearly every request containing one.

Halt is not atomicity, and not a rollback. It stops future legs. Anything already placed stays placed and is yours to unwind — with /orders/cancel for a resting order, or an offsetting order for a filled one. To reduce the chance of getting there at all, add verify_liquidity: true AND check_all_first: true — see below. Depth-checking alone does not stop anything: a declined leg is skipped and the rest still place.

Bail before anything is placed — check_all_first: true. Runs every leg's pre-placement checks up front: live orderbook depth, and whether the batch is actually affordable at each venue. The checks run concurrently, so it costs one extra round-trip in total, not one per leg.

check_all_first does not bail on its own — it needs on_leg_failure: "halt" too. By itself it only collects the failures; on_leg_failure defaults to "continue", so the failing legs are skipped and every other leg is still placed. Sending check_all_first alone for a two-leg hedge gets you the half-hedge it looks like it prevents. If you want zero exposure, send both.
All-or-nothing entry
{
  "check_all_first": true,
  "on_leg_failure": "halt",
  "orders": [ legA, legB ]
}
// any leg fails a check → NOTHING is placed, zero exposure
// with the default "continue" → failing legs are skipped, the rest still go
This is the only setting that prevents a paired-intent failure. halt reacts to a leg that already failed — but the classic batch failure is leg A succeeding and leg B failing for depth or funds, and no amount of halt logic prevents that. Only checking every leg before committing capital does. The cost is latency before your first placement, which on a fast-moving price is its own risk — so it's a per-request choice, not a default.

Dispatch everything at once — placement: "parallel". Legs go simultaneously instead of one at a time, minimizing the window where one leg is filled and another isn't. Legs on different venues run genuinely concurrently; same-venue, paper and market-making legs still serialize where they share account state. Pair it with check_all_first AND on_leg_failure: "halt" for the tightest arbitrage entry available: verify every leg, abort the whole batch if any fails, otherwise fire them together.

placement: "parallel" with on_leg_failure: "halt" and NO check_all_first returns 400 conflicting_parameters. Once every leg is dispatched there is nothing left to halt — we reject it rather than silently ignore half of what you asked for.

With check_all_first: true the combination is allowed — that halt fires before any leg is dispatched, so there is nothing parallel about it to defeat. This is the recommended shape for a hedge.
“Parallel” changes dispatch, not the response. The HTTP call is synchronous either way — you always get every leg's result in the 200. There is no fire-and-forget or 202 mode. What placement controls is whether legs are sent to their venues one after another or all at once. The only genuinely asynchronous thing here is a resting limit leg, whose later fills arrive on the orders WebSocket channel regardless of which mode you chose.
The balance check is a filter, not a guarantee. It compares your batch against the account's last-known balance at each venue, summing legs per venue since they draw on one balance. It fails open: if we have no synced balance for a venue, the batch proceeds and the venue remains the source of truth. It catches the obvious footgun — sending five orders you can only afford three of — not every funding failure.
pending carries real risk under halt. On async-fill venues (Polymarket, PolymarketUS) a market order is accepted and its fill confirms a beat later via reconcile, so the leg reports pending rather than completed. Halt treats that as success and places the following legs. If that fill never lands, the later legs were placed against a leg that never filled. Watch the orders WebSocket channel to confirm, and be ready to unwind.

Choosing a combination. Three independent props, but only a few pairings are worth reaching for. A blank cell means “leave it out”:

You wantplacementon_leg_failurecheck_all_first
Max fills — legs stand alone———
Stop if a leg misses—halt—
Fire everything at once, monitor yourselfparallel——
Zero exposure on any pre-check failure—halttrue
Arbitrage / hedge — zero exposure AND tightest entryparallelhalttrue

The last row is what a hedge wants, and it is worth being precise about what each prop buys you. check_all_first + halt decides whether to enter at all — nothing is placed if any leg fails its check. placement: "parallel" then decides how fast the legs go out once that decision is yes, minimizing the window where one has filled and the other hasn't. They are independent, and you want both.

None of this is atomic across venues. Every combination above still allows leg A to fill and leg B to be rejected at the venue, after the checks passed. The pre-placement checks shrink that window; they cannot close it, because two venues cannot be made to commit together. Always confirm the actual fills on the orders WebSocket channel or GET /orders, and be ready to unwind. A leg reporting pending or resting has not filled yet — only completed, failed and rejected are final.

Pre-trade constraints

GET /flow/v1/auth/orders/constraints answers, before any order: which money modes can this account use, at which venues, under which rules? One call, stake-independent, for the acting account. Read it when a slip opens (cache it for a minute, and again after a balance.update frame) and validate locally against it; then let preflight confirm the exact order. It is own-account data, so it is not metered.

Response.data
{
  "constraints_version": "2026-10-13.1",   // bumps when this SHAPE changes; compare to re-fetch or warn
  "account": {
    "router_account_id": "acct_…",
    "environment": "live",                  // "test" keys can only place paper orders
    "is_fiduciary": false,                  // true when acting for a Connect user (X-OpenMarkets-Account)
    "can_execute": true,                    // real money allowed (trade:execute)
    "can_practice": true,
    "money_modes": ["paper", "real"],       // what this account can place RIGHT NOW
    "issues": [],                           // why a mode is missing, e.g. real_money_not_permitted
    "practice_wallet": {
      "partner_id": "…",                    // the internal book every paper order fills on
      "currency": "ATLAS",
      "balance": 812.5,
      "order_types": ["market", "limit"],   // a paper limit rests and fills when the market crosses it
      "cancel_supported": true              // a resting paper limit can be cancelled (stake refunded)
    },
    "policy": { "practice_only": false, "max_stake_per_order": null, "venue_allowlist": null }
  },
  "venues": [                               // every active venue, connected or not
    {
      "partner_id": "kalshi", "name": "Kalshi", "logo_url": "https://…",
      "orders_allowed": true,               // false = quotes-only
      "connectable": true,
      "cancel_supported": true,
      "order_types": ["market", "limit"],
      "sell": { "supported": true, "order_types": ["market"], "reason": null },   // venue-level: can a position held here be sold; the position's own sell block wins
      "fill_semantics": { "zero_fill_market": "failed" },   // what a 0-fill market order means here: failed | pending | resting
      "account": {
        "connected": true, "status": "active", "credential_status": "connected",
        "currency": "USD", "balance": 120.0,
        "expected_balance": 104.5,          // net of holds — prefer this
        "pending": 15.5, "is_stale": false, "balance_version": 42,
        "scope_trade_execute": true         // Connect: did the user allow trading here?
      },
      "eligibility": {                      // per mode, for THIS account, right now
        "paper": { "ok": true, "issues": [] },
        "real":  { "ok": true, "issues": [] }
      },
      "size": {
        "min_usd": 1, "max_usd": null, "increment_usd": null,
        "whole_contracts": true,            // amount / price floors to whole contracts; the remainder is reported
        "min_contracts": 1,
        "full_fill_bypasses_min": false     // P2P venues: taking the whole posted offer skips min_usd
      },
      "price": {
        "submitted": true,                  // false = accept-by-id: max_price is only a ceiling
        "format": "cents",
        "tick": 0.01,                       // null = non-linear ladder; send any price, the server snaps
        "min": 0.01, "max": 0.99,           // probability units
        "native": { "tick": 1, "min": 1, "max": 99 }
      },
      "fees": {
        "direction": "on_top",              // or "from_payout"; null = no fee model
        "sample": { "stake_usd": 100, "price": 0.5, "taker_fee": 1.75, "maker_fee": 0.44, "taker_price": 0.5175, "maker_price": 0.5044 }
      }
    }
  ]
}

Every issues[] entry is the same object preflight and buy return: { code, severity, message, detail, fix, scope }. code is one closed set shared by all three endpoints, message is written for the end user, and fix is what a button can do about it (raise_stake, switch_venue, connect_venue, upgrade_plan, …).

The fee sample is a display figure at a $100 stake and 50¢. The exact fee for an order comes from preflight.

Preflight — dry-run routing + expected fees

POST /flow/v1/auth/orders/preflight is a dry run of /orders/buy — identical request body, but it places nothing. It runs the router against live liquidity (pinned to the venue you name, exactly like /buy) and tells you, per leg: whether the depth is there, the expected fill price, and the expected taker/maker fees for your actual amount — plus the all-in cost. Use it to show a confirm screen before charging the user.

Preflight vs check_all_first. They answer the same question at different moments, and you want different ones for different jobs. /preflight is a separate call — use it to show a user what an order will cost, or to explore, with a human deciding in between. The price can move between it and your /buy. check_all_first is the same class of check inside the buy request, so there is no gap for a human or a market to move in — but it reports nothing back unless a leg is declined. Fee previews and confirm screens → preflight. Automated all-or-nothing entry → check_all_first.
Response.data
{
  "results": [
    {
      "index": 0,
      "requested_partner_id": "kalshi",
      "accepted": true,                 // can it fill as planned?
      "rejected_code": null,            // closed union, the same one /buy returns (e.g. "below_min_order")
      "rejected_reason": null,          // developer text when it can't
      "message_user": null,             // plain language for the end user when it can't
      "fix": null,                      // e.g. "raise_stake", "switch_venue"
      "warnings": [],                   // non-blocking: amount_off_increment, price_off_tick, insufficient_balance
      "normalized": { "max_price": 0.55, "amount": 50.0, "contracts": 96, "price_basis": 0.52 },
      "would_rest": false,              // a limit priced below the book would rest
      "expected_fill_price": 0.52,
      "total_allocated": 50.0,          // USD notional that would fill
      "unfilled_amount": 0.0,           // notional that can't fill (thin book)
      "total_taker_fee": 1.44,          // expected fee for THIS order (not $100-canonical)
      "total_maker_fee": 0.0,
      "total_cost_taker": 51.44,        // notional + taker fee = all-in cost
      "venues": [
        {
          "partner_id": "kalshi",
          "expected_price": 0.52,
          "allocated_amount": 50.0,
          "fee_packet": { "taker_price": 0.5344, "maker_price": 0.52, "taker_fee": 1.44, "maker_fee": 0.0 }
        }
      ]
    }
  ],
  "halted_at_index": null               // where a halt would stop the batch, if it would
}
Two fee surfaces, one model. The liquidity feed's per-venue fee_packet gives you fee-adjusted rates — taker_price/maker_price are usable at any size, but its taker_fee/maker_fee are on a canonical $100 stake (a reference, not your order's fee). Preflight returns the same fee_packet shape but computed on your actual amount, so it's the number to show the user. Fees are estimates; the venue's realized fee is recorded on the order after the fill (fee / amount_with_fee).
Confirm live depth with verify_liquidity: true. By default preflight routes against our liquidity cache (seconds fresh — the same data /buy uses). Set verify_liquidity: true and, for any venue whose cached entry is stale or thin (shallower than ~3× your order), we hit that venue's live orderbook to confirm real depth — returning verified: true with the live live_available and live_price on the venue, and declining the leg (rejected_code: "insufficient_live_depth", with a plain-language message_user) if the book has moved away. Fresh, deep venues skip the extra call.

Preflight needs only account_read (it's a preview — no trade:execute, no Idempotency-Key, no order placement).

Idempotency

Send an Idempotency-Key header (a UUID you generate per logical order) on every /orders/buy. Use a fresh key for each new intent to place an order, and the same key for every retry of it. Keys are scoped to your workspace and remembered for 24 hours.

  • Same key, same body, request finished — you get the original response back (header Idempotent-Replayed: true). Nothing is placed again.
  • Same key, same body, first request still running — 409 idempotency_in_progress with Retry-After. This is the normal answer when your client timed out and retried while the order was still being placed: wait, then retry with the same key to get its result.
  • Same key, different body — 409 idempotency_conflict. Nothing is placed.
So a timeout is never a reason to generate a new key. A new key means a new order.

Execution controls

Before any leg is placed, OpenMarkets enforces the acting account's controls:

  • Venue must be live — the targeted partner must be connected and active for that user. A paused or unconnected venue blocks the leg with the code venue_disabled.
  • Per-account limits — the user's execution-limit policy (max stake, per-venue, per-league, practice-only) is evaluated per leg. A violation blocks the leg with execution_limit_exceeded.

Controls run before the order reaches the venue, so a leg can never bypass the user's limits. Users set these themselves through the hosted Connect flow — you're read-only there.

A control block is not an HTTP error. The request still returns 200 — the blocked leg comes back inside results[] with status: "failed", a human-readable rejected_reason, and a machine-readable rejected_code of venue_disabled or execution_limit_exceeded. Branch on results[i].rejected_code — not the HTTP status — to detect a control block. (In a multi-leg call, one leg can be control-blocked while others fill.)

Order-constraint rejections

Each leg is also checked against the target venue's order constraints — minimum and maximum size, whole-contract sizing, and the price band — before it reaches the venue. Like a control block, a violation is a per-leg status: "failed" inside a 200 with a machine-readable rejected_code:

  • orders_not_supported — the venue doesn't accept orders.
  • below_min_order / above_max_order — the amount is outside the venue's size bounds.
  • unfillable — on a whole-contract venue, the stake rounds down to zero contracts.
  • price_out_of_band — the price is outside the venue's min/max.
  • above_max_price — the book is there, but priced above the max_price you set. Retry higher, not smaller.
  • insufficient_size — priced within your limit, but the book holds less than this order. Retry smaller, not higher.
  • insufficient_live_depth — nothing at this position at all.
  • The three above used to arrive as a single insufficient_live_depth, which told you “no depth” when the answer was usually “your price is too low”. They are reported separately as of 2026-07-29 — the fix is different in each case.

Read each venue's order_config from Venues & balances to size the order correctly up front and avoid these.

Coming soon — automatic routing

Smart Order Routing is pending regulatory licensing. Routing an order across venues on a customer's behalf — omit partner_id and OpenMarkets picks the best-priced venue, splitting a single leg across partners when that improves the fill — requires an introducing-broker license we're in the process of obtaining. Until it's in place, every leg must name its venue (a liquidity_hash, or a position_hash + partner_id).

When it ships, the only change is that partner_id becomes optional:

Coming soon — best-venue routing
{
  "orders": [
    {
      "position_hash": "ct_abc123:mk_ml:side_home:var_0:p_kc:tf_full",
      "amount": 50,
      "max_price": 0.52
      // no partner_id → OpenMarkets routes to the best venue(s)
    }
  ]
}

The response already carries the shape for it — venues[] can list more than one partner, and sor_decision_id records the routing decision — so code you write against the venue-directed API today keeps working unchanged.

Real vs. paper

mode selects the funding source per leg. "real" places on the named connected exchange (money at the venue). "paper" books against the OpenMarkets internal book (the practice wallet, denominated in the ATLAS play currency) so you can exercise the full path — placement, fills, settlement — without real money.

The two currencies are distinct wallets and are never summed:

  • USD — real money (is_real_money: true), held across your connected venues. Real orders book in USD.
  • ATLAS — play money (is_real_money: false), an auto-provisioned practice wallet on the OpenMarkets internal book. Paper orders draw down ATLAS.

How a paper order is priced. A paper fill takes the whole amount at the best live price across real venues — it does not walk the book or honour depth. Only quotes with at least $1 available count as a live price, so a placeholder book (a lone 1¢ bid, a few cents behind an ask) cannot price a practice bet. When no venue has such a quote the leg is rejected, and paper_bettable on the position reads false.

Every money surface is partitioned by currency — balances (see Venues & balances), order history (currency on each order), and performance roll-ups. A total that blends the two is always a bug: real P&L and practice P&L are reported in separate buckets.

A paper order books against the internal book, not the venue you named. A leg with mode: "paper" still requires a liquidity_hash (or position_hash + partner_id), but the named venue only anchors the outcome and its reference price — the fill is always placed on the OpenMarkets internal book. So the returned venues[].partner_id will be the internal book, notthe partner you named, and the order reads back with partner.internal_book: true (and currency: "ATLAS"). Always treat the returned venues[].partner_id as authoritative — don't assume the fill landed on the venue you passed in.

Paper market orders fill immediately on the internal book, priced at the best live price across real venues, and are rejected with no_live_price_for_paper when no venue quotes the position.

Paper limit orders rest. A paper leg with order_type: "limit" uses max_price as its limit. If any live venue already quotes the position at or below it, it fills now, exactly like a paper market order. Otherwise it comes back status: "resting" and the full stake is reserved from the practice wallet. It fills — in full, at your limit price — once the best live price across real venues drops to the limit, and you get an order.update on the orders stream. A resting paper order is cancelled and refunded automatically when its contest closes, or after 7 days unfilled. Cancel it yourself with /orders/cancel and the stake comes back. A paper limit still needs at least one live venue pricing the position when you place it. Check account.practice_wallet.order_types on GET /auth/orders/constraints to see what the practice book supports.

Topping up paper money

Every practice wallet starts with 1,000 ATLAS. When it runs low — or you run several models on one account and want each to have room — add more. A deposit is free: it is recorded as a deposit entry in the practice ledger and nothing else. It can only ever credit ATLAS; no parameter reaches a real-money wallet.

POST /flow/v1/auth/account/paper/deposit      (trade:execute — the same scope as a paper order)
Idempotency-Key: <uuid>

{ "amount": 5000, "description": "optional note" }

→ 201 { "data": { "currency": "ATLAS", "amount": 5000, "balance": 6000, "om_ledger_id": "..." } }

Up to 100,000 ATLAS per deposit, and a wallet holds at most 10,000,000. Send an Idempotency-Key so a retried request cannot deposit twice. With an org key, X-OpenMarkets-Account tops up that Connect user's practice wallet.

Read the balance with GET /flow/v1/auth/account/paper (account:read) → { "currency": "ATLAS", "balance": 6000, "max_deposit": 100000, "balance_cap": 10000000 }. The same number is the ATLAS bucket of GET /flow/v1/auth/account/balances.

The full history — deposits, paper bets and payouts, each with the balance after it — is at GET /flow/v1/auth/account/paper/ledger?limit=50 (account:read).

List orders

GET /flow/v1/auth/orders returns the acting account's orders, newest first, cursor-paginated. Filter by status, contest, settlement, currency, and more.

curl 'https://api.openmarkets.ai/flow/v1/auth/orders?status=open&limit=50' \
  -H 'Authorization: Bearer eyJhbGc...'

Common query params:

  • status — pending · open · closed (see status and result values).
  • contest_id — scope to one contest.
  • settled=true · result=<win|lose|push|cancelled> — only settled orders.
  • currency — USD (real) or ATLAS (paper).
  • mm=true · model_id · opportunity_type — provenance filters.
  • sort=settled — order by settlement time instead of creation.
  • from · to (ISO-8601) — date range on the active sort column: creation time by default, or settlement time with sort=settled (so ?sort=settled&from=…&to=… is a settled-in-window / calendar-day query). settled_after · settled_before filter settlement time regardless of sort.
  • cursor · limit — pagination (default 50, max 200).

Each item is a router_order (shape below). Use the top-level pagination.next_cursor to page.

Resting orders

GET /flow/v1/auth/orders/resting/me returns just the acting account's working (unfilled / partially-filled) orders — the live book you'd render on a "my open orders" screen. Filled orders drop off automatically.

curl https://api.openmarkets.ai/flow/v1/auth/orders/resting/me \
  -H 'Authorization: Bearer eyJhbGc...'
Response.data
{
  "orders": [
    {
      "router_order_id": "ro_...",
      "title": "Kansas City Chiefs — Moneyline",
      "partner_id": "kalshi",
      "partner_name": "Kalshi",
      "amount": 50,
      "price": 0.52,
      "fill_status": "partially_filled",   // "unfilled" | "partially_filled"
      "filled_amt": 20,
      "unfilled_amt": 30,
      "placed_at": "2026-07-09T18:04:11Z",
      "seconds_since_placed": 42
    }
  ],
  "count": 1
}
For real-time updates instead of polling, subscribe to the orders WebSocket channel — it pushes an order.update the moment a resting order fills, partially fills, or cancels, and an order.settled when it resolves. Poll resting/me on reconnect to re-sync, then resubscribe.

Cancel orders

POST /flow/v1/auth/orders/cancel cancels one or more resting orders by id. The body is a non-empty router_order_ids array.

curl -X POST https://api.openmarkets.ai/flow/v1/auth/orders/cancel \
  -H 'Authorization: Bearer eyJhbGc...' \
  -H 'Content-Type: application/json' \
  -d '{ "router_order_ids": ["ro_abc...", "ro_def..."] }'

There are two distinct failure modes, and they behave very differently:

  • Ownership failure → the whole batch fails with 403 forbidden. Every id is ownership-checked against the acting account first. If even one id isn't yours, nothing is cancelled and you get a 403 — no partial effect.
  • Uncancellable id → a soft, per-id entry inside a 200. An id you own but that can't be cancelled (already closed, or the venue didn't acknowledge the cancel) does not fail the request. It comes back as an entry in skipped[] or errors[] while the rest still cancel.

The 200 response sorts every id into one of three arrays:

Response.data
{
  "cancelled": [
    { "router_order_id": "ro_abc...", "status": "closed", "result": "cancelled" /* full order */ }
  ],
  "skipped": [
    { "router_order_id": "ro_def...", "reason": "Status is 'closed', not cancellable" }
  ],
  "errors": [
    { "router_order_id": "ro_ghi...", "error": "Partner did not acknowledge cancel" }
  ]
}
  • cancelled[] — successfully cancelled at the venue and closed (full order objects).
  • skipped[] — not cancellable to begin with (already closed, not found); each carries a reason.
  • errors[] — the venue cancel failed; each carries an error. These orders are left unchanged so you can retry.

A resting sell cancels the same way, by its own router_order_id. Only a resting practice sell can be cancelled. A sell on a real venue is immediate, so there is nothing resting to cancel: it comes back in skipped[] with the reason Cancelling a sell on this venue is not supported yet, and a sell that is still being placed comes back skipped as Sell is still being placed. Cancelling a practice sell moves no money, because a sell holds back contracts, not funds.

A 200 is only a full success when errors is empty. Always inspect errors[] (and skipped[]) before treating a cancel as complete — the HTTP status alone doesn't tell you every id was cancelled.

Selling a position

POST /flow/v1/auth/orders/sell

A sell closes all or part of a position you bought through OpenMarkets. Whether a position can be sold is decided per venue. The answer is the sell block on the position from GET /auth/account/positions: sell.supported says whether it can be sold now, sell.order_types lists the order types it takes, and sell.reason says why not when it cannot (sell_disabled, venue_unsupported or not_open). Read it from the position, not from a list in these docs. A position that cannot be sold is held until it settles. GET /auth/orders/constraints carries a sell block per venue too, but that one is venue-level; the position's block wins when they differ. Where selling is unavailable for the environment, both endpoints answer 403 sell_not_enabled.

As of 2026-11-18: practice positions (currency: "ATLAS") can be sold with market and limit sells. Kalshi and Polymarket US positions can be sold at market only: the sell is immediate-or-cancel, and anything that does not fill is not left resting. Positions on every other venue are held until they settle.

Positions and P&L reflect orders placed through OpenMarkets. Trades made directly at a venue are not included. If contracts bought through OpenMarkets are later sold in the venue's own app, the position here still shows them as held. The sell preview reports the venue's own count as holding.venue_position_contracts where the venue provides one. A sell that fills nothing because the venue holds fewer contracts than we show comes back as insufficient_position, with the venue's count in details.venue_position. A venue's own count can lag for a short time after a buy.

Two endpoints, with the same request body. POST /orders/sell places the sells. POST /orders/sell/preview runs the same checks, writes nothing and tells you what the sell would do.

POST /orders/sell needs an execution-tier credential with trade:practice or trade:execute. The preview needs one of the two entitlements. Selling a real-money position needs trade:execute on both.

Sell part of a position
curl -X POST https://api.openmarkets.ai/flow/v1/auth/orders/sell \
  -H 'Authorization: Bearer eyJhbGc...' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: 8d2b6a40-...' \
  -d '{
    "orders": [
      {
        "partner_id": "pt_...",
        "liquidity_hash": "kalshi:ct_abc123:mk_ml:side_home:var_0:p_kc:tf_full",
        "contracts": 10,
        "min_price": 0.55
      }
    ]
  }'

partner_id and liquidity_hash are the partner_id and position_key the position reports. Send them exactly as given. Each leg takes:

  • contracts — a number above 0, or "all". Required.
  • min_price — a number strictly between 0 and 1. Required.
  • order_type — "market" (default) or "limit".
  • partner_market_id, model_id, quote_id — optional; see the rules below.

The body is strict: an unknown field is 400 unknown_parameter. A request carries 1 to 10 legs under orders.

Response.data
{
  "results": [
    {
      "index": 0,
      "status": "completed",
      "router_order_id": "ro_...",
      "partner_id": "pt_...",
      "requested_contracts": 10,
      "filled_contracts": 10,
      "avg_price": 0.58,
      "proceeds": 5.8,
      "fee": 0,
      "realized_pnl": 0.8,
      "remaining_contracts": 10,
      "rejected_code": null,
      "message_user": null,
      "fix": null
    }
  ]
}

proceeds is gross, fee is what the venue charged on the sale, and realized_pnl is the profit or loss on the contracts sold, after that fee. remaining_contracts is what you still hold in the scope you sold from.

Preview first. The preview takes the same body and answers per leg without placing anything. It needs no Idempotency-Key.

POST /flow/v1/auth/orders/sell/preview · Response.data
{
  "results": [
    {
      "index": 0,
      "ok": true,
      "holding": {
        "contracts": 20,
        "reserved_contracts": 0,
        "sellable_contracts": 20,
        "venue_position_contracts": null,
        "avg_price": 0.5,
        "cost_basis": 10,
        "currency": "ATLAS",
        "partner_market_id": "pm_..."
      },
      "exit": {
        "bid": 0.58,
        "bid_available_contracts": null,
        "source": "paper_best_bid",
        "as_of": "2026-11-16T18:04:11.000Z"
      },
      "quote": { "floor_price": 0.55, "expires_at": null, "quote_id": null },
      "estimate": {
        "contracts": 20,
        "fill_price": 0.58,
        "fillable_contracts": 20,
        "proceeds": 11.6,
        "fee": 0,
        "net_proceeds": 11.6,
        "cost_basis": 10,
        "realized_pnl": 1.6,
        "realized_pnl_pct": 16,
        "would_rest": false,
        "remaining_contracts": 0
      },
      "rejected_code": null,
      "message_user": null,
      "fix": null,
      "warnings": []
    }
  ]
}
  • ok: false means the sell would be refused. Then rejected_code, message_user and fix say why and what to change, and estimate is null.
  • exit is the best bid right now. null when there is none to read.
  • estimate.would_rest is true when a limit sell would not fill now and would wait.
  • warnings carries notes. None appears on a practice sell.exit_quote_unavailable — the venue gave no book to read; the result is ok but has no estimate. venue_position_below_request — the venue shows fewer contracts than you asked to sell. venue_position_unavailable — the venue's own count could not be read; this never fails the preview. fee_is_estimate — estimate.fee is the venue's formula, not a booked fee; the fee on the sell is what the venue reports on the fill. fee_not_estimated — estimate.fee is null because there is no estimate for that venue; the fee is known only after the fill, and net_proceeds and realized_pnl leave it out.

Rules that surprise people:

  • Sizes are in contracts, not dollars. A position's contracts is what you can size against.
  • "all" sells everything sellable right now, which excludes contracts held back by a sell that is still working. On a venue that can report its own position, it is the smaller of that and our sellable count; if the venue read fails, our count is used. When none are sellable the leg is insufficient_position.
  • min_price is a floor, in the frame of the side you hold. A bid below it does not fill a market sell.
  • A sell never routes to another venue. It goes where the position was bought.
  • There is no mode on a sell. Whether it is practice or real is a fact about the position, and a real-money position needs trade:execute.
  • partner_market_id is only needed after a leg comes back position_route_ambiguous. Its details.partner_market_ids lists the choices.
  • model_id scopes the sell to that model's lots. Without it, the sell draws from every lot of the position.
  • Always send an Idempotency-Key on /orders/sell, for the same reasons as on /orders/buy.
  • Some refusals apply to the whole request, not one leg. A leg on a real-money position without trade:execute answers 403 real_money_not_permitted and places none of the legs, practice legs included.

Leg status. Each leg is placed independently. Branch on the status, and on rejected_code when it is not completed:

  • completed — contracts were sold. Check filled_contracts against requested_contracts.
  • resting — a practice limit sell is waiting for the bid to reach it. Not terminal. The contracts are held back until it fills, expires or you cancel it.
  • pending — accepted, but the outcome is not final. Watch the order. If rejected_code is unknown, the venue did not say whether the sell went through: do not send a new sell with a new key. The sell may exist, and its contracts stay held back until it resolves. Re-send the same Idempotency-Key, or read the order.
  • failed — placement reached the point of trying and nothing sold, for example a market sell whose bid fell below your floor. Carries a rejected_code.
  • rejected — refused before anything was placed. Carries a rejected_code. See the sell codes.

A sell is an order. It appears in GET /orders with action: "sell", and the buy orders it reduced carry sold_contracts. Cancel a resting practice sell with /orders/cancel and its router_order_id.

Execution limits do not apply to a sell. They cap new exposure, and a sell only reduces it.

Order settlement

GET /flow/v1/auth/orders/:router_order_id/resolution returns the settlement detail for one order: OpenMarkets' own market verdict, the partner's verdict, whether they agree, and the final contest score. Use it to reconcile a settled order and to surface disagreements between our resolution and the venue's.

curl https://api.openmarkets.ai/flow/v1/auth/orders/ro_abc.../resolution \
  -H 'Authorization: Bearer eyJhbGc...'

The order object

Both GET /orders and the resolution endpoint return the full router_order shape:

router_order
{
  "router_order_id": "ro_...",
  "partner_id": "kalshi",
  "partner": { "partner_id": "kalshi", "partner_name": "Kalshi", "logo_url": null, "internal_book": false },
  "currency": "USD",
  "contest_id": "ct_abc123",
  "market_id": "mk_ml",
  "market_side_id": "side_home",

  "title": "Kansas City Chiefs — Moneyline",
  "side": "home",

  "amount": 50,
  "price": 0.52,
  "amount_with_fee": 50.4,
  "fee": 0.4,
  "potential_payout": 96.15,

  "status": "closed",
  "order_type": "fill_or_kill",
  "fill_status": "filled",
  "filled_amt": 50,
  "unfilled_amt": 0,

  "opportunity_type": "manual",
  "liquidity_hash": "kalshi:ct_abc123:mk_ml:side_home:var_0:p_kc:tf_full",

  "result": "win",
  "winnings": 96.15,
  "net_winnings": 95.75,
  "roi": 0.915,

  "placed_datetime": "2026-07-09T18:04:11Z",
  "settled_datetime": "2026-07-10T02:41:00Z",
  "created_at": "2026-07-09T18:04:10Z"
}

Fields are null until they apply — settlement fields (result, winnings, settled_datetime) populate only after the contest resolves.

winnings is the gross payout and net_winnings is that payout after fees — money returned, not profit. Profit on an order is net_winnings − amount, which is exactly how /auth/performance computes net_pl.

Every order also carries action: "buy" or "sell". On a sell, side is still the outcome side you hold, not a direction. The selling fields are null where they do not apply:

  • contracts — a sell's requested size; null on a buy.
  • filled_contracts — contracts filled so far. On a sell, contracts sold. On a buy, the exact count, null on older orders.
  • proceeds and sell_fee — a sell's gross sale proceeds and the venue's fee; null on a buy.
  • sold_contracts — contracts sold out of a buy by later sells; null on a sell.

On a sell, amount, filled_amt and unfilled_amt are 0 and price is the min_price you sent. Read sizes from the fields above.

Status and result values

These are the complete sets. Match on them exactly — treat any value not listed here as unknown rather than mapping it to the nearest one.

status — where the order is in its life:

  • pending — recorded, not yet accepted by the venue. Short-lived.
  • open — accepted: filled or resting, and waiting to settle.
  • closed — finished: settled, sold, cancelled, or failed. Read result to tell which.

fill_status — how much has matched: unfilled · partially_filled · filled.

result — the outcome, null until there is one:

  • win — the position won. net_winnings is the payout.
  • lose — the position lost. net_winnings is 0.
  • push — graded as a tie; the stake is returned.
  • cancelled — never took effect: rejected, unfilled, cancelled, or voided by the venue. failure_reason says why when we know.
  • sold — closed by a sale, never graded by the market. On a sell, it sold contracts. On a buy, all of its contracts were sold. net_winnings on that buy is what the sales returned, after fees. A sell that sold nothing closes as cancelled.
won / lost / void are not values. An earlier version of this page showed "result": "won" in the example — the value has always been win.

Errors

Execution errors use the same structured envelope as the rest of Flow:

HTTPcodeMeaning
400unknown_parameterA field outside the strict /buy contract was sent
400bad_requestInvalid hash, size, or max_price on a leg — incl. a bare position_hash with no partner_id
403account_forbiddenActing on an account the caller doesn't own (act-as ownership)
403forbiddenCancel: a router_order_id not owned by the acting account
404account_not_foundThe acting router_account no longer exists
404order_not_foundNo such order on the acting account
409idempotency_in_progressSame Idempotency-Key while the first request is still running — retry with the same key after Retry-After
409idempotency_conflictSame Idempotency-Key with a different body — nothing placed
venue_disabled and execution_limit_exceeded are not HTTP errors — a control-blocked leg returns 200 with that code in results[i].rejected_code (see Execution controls above).

End-to-end

The full loop your app runs to place and track a trade:

  • Read a position from /contests/:id/liquidity → pick a venue from its partner_liquidities[] and grab that entry's liquidity_hash.
  • POST /orders/buy with the liquidity_hash (or a position_hash + partner_id), an amount, a max_price, and a fresh Idempotency-Key.
  • Inspect results[] — fill vs. requested, and each router_order_id.
  • Render working orders from /orders/resting/me; cancel via /orders/cancel.
  • After the game, reconcile with /orders?settled=true and /orders/:id/resolution.