> ## Documentation Index
> Fetch the complete documentation index at: https://docs.limitless.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Order

> Creates a buy/sell order for prediction market positions. Requires signed order data.

> [!NOTE]
>
> Before creating orders:
>
> 1. Fetch market data via [Get Market Details](https://docs.limitless.exchange/api-reference/markets/get-market.md) to get venue and token IDs
> 2. Sign the order using [EIP-712](https://docs.limitless.exchange/developers/eip712-signing.md) with `venue.exchange` as `verifyingContract`
> 3. Ensure you have [token approvals](https://docs.limitless.exchange/developers/venue-system.md#required-token-approvals) set up, including the USDC approval to `venue.feeModule` on [new trading venues](https://docs.limitless.exchange/developers/venue-system.md#new-trading-venues)

> [!WARNING]
>
> Order creation can be temporarily restricted during maintenance. In `post_only`, only orders with `postOnly: true` are accepted. In `cancel_only` or `disabled`, new orders return `425 Too Early` with a trading-mode `code`. Check [Maintenance Mode](https://docs.limitless.exchange/developers/maintenance-mode.md) before sending orders.

## Authentication

Use a scoped API token with HMAC signing and the `trading` scope.

## Signed order rules

For client-signed orders, `signature` and `signatureType` are both required. They must either both be present or both be omitted. Omission is accepted only for [delegated server signing](#delegated-signing) with an HMAC token carrying `delegated_signing`.

`nonce` is required and must be the numeric value `0`. `expiration` may be omitted; omission is signed as zero. If supplied, it must represent zero, for example `"0"`. Non-zero expiration is not supported.

Amounts are integer raw units with 6 decimals. `makerAmount` must be at least `100` raw units; this is the API's only order-size floor and exists to reject dust. The web app applies its own, larger minimum order value before submitting, but that is a web-app rule and does not apply to orders placed through the API or the SDKs. For GTC and FAK orders, `price` is required and may have at most three decimal places, so prices run from `0.001` to `0.999`. The collateral equation must be exact. `price × contracts` must be an integer raw-unit amount, without rounding.

| Type | BUY amounts | SELL amounts | Price |
| - | - | - | - |
| `GTC` / `FAK` | `makerAmount = price × contracts`; `takerAmount = contracts` | `makerAmount = contracts`; `takerAmount = price × contracts` | Required |
| `FOK` | `makerAmount = maximum collateral to spend`; `takerAmount = 1` | `makerAmount = shares to sell`; `takerAmount = 1` | Must be omitted |

`postOnly` is supported only for GTC orders.

### Optional fields

| Field | Type | Description |
| - | - | - |
| `clientOrderId` | `string` | Optional uniqueness and deduplication key. The submitted value may contain at most 128 characters; it is then trimmed and must not be blank. Reuse returns `409 Conflict`; the API does not replay the earlier response. |
| `onBehalfOf` | `number` | Profile ID of the sub-account to place the order for. Requires a [scoped API token](https://docs.limitless.exchange/developers/authentication.md#scoped-api-tokens-hmac) with `trading` scope and a partner relationship with the target profile. The `maker` and `signer` in the order must match the sub-account's wallet address. |
| `postOnly` | `boolean` | GTC orders only. When `true`, the order is rejected if it would immediately match. Guarantees the order rests on the book as a maker order. Default `false`. |
| `timestamp` | `number` | Optional client-stamped Unix time in milliseconds for receive-window checks. Top-level request field; not part of the signed `order`. |
| `recvWindow` | `number` | Optional maximum accepted order age in milliseconds, up to `10000`. If omitted, the API default applies. Top-level request field; not part of the signed `order`. |
| `stpPolicy` | `string` | Self-trade prevention policy. Values: `cancel_maker`, `cancel_taker`, `cancel_both`. Default `cancel_maker`. Top-level request field; not part of the signed `order`. |

### Receive window

`POST /orders` supports optional receive-window controls for clients that want freshness checks on order submission. Send these fields at the top level of the request body, next to `order`, `orderType`, and `marketSlug`; never put them inside the EIP-712 signed `order` object.

```json theme={null}
{
  "order": {
    "...": "signed order fields"
  },
  "orderType": "GTC",
  "marketSlug": "btc-100k",
  "timestamp": 1779870000000,
  "recvWindow": 1500
}
```

| Field | Description |
| - | - |
| `timestamp` | Client order creation time as Unix milliseconds. Send it with a nonzero effective `recvWindow` to enforce client-to-server freshness. If omitted while a window applies, the server uses its receive time. |
| `recvWindow` | Maximum accepted age, in milliseconds, between the effective timestamp and server receive time, up to `10000`. If omitted, the API default applies. A timestamp alone has no freshness effect when the effective window is zero. |

> [!WARNING]
>
> Keep trading hosts NTP-synced. If the timestamp is too far in the future or older than the receive window, the API returns `425 Too Early`. Do not retry the same signed payload after a receive-window `425`; build and sign a fresh order. If the `425` body has a trading-mode `code`, refresh maintenance status instead.

### Self-trade prevention

`POST /orders` can reject or cancel orders that would match against your own resting order on the same token.

```json theme={null}
{
  "order": {
    "...": "signed order fields"
  },
  "orderType": "GTC",
  "marketSlug": "btc-100k",
  "stpPolicy": "cancel_taker"
}
```

| Policy | Result |
| - | - |
| `cancel_maker` | Default. Cancel your conflicting resting order and continue with the incoming order. |
| `cancel_taker` | Reject the incoming order before it self-trades. |
| `cancel_both` | Cancel your conflicting resting order and reject the incoming order. |

With `cancel_maker`, matching continues against the remaining non-self liquidity, and limit orders still never execute past their limit price.

**Outcomes on the placement response:**

* A rejected taker (`cancel_taker` / `cancel_both`) returns `settlementStatus: "CANCELED"` with `reason: "STP_TAKER_REJECTED"`.
* A `cancel_maker` taker lists the cancelled resting order IDs in `stpMakerCancels` and keeps its normal status (`UNMATCHED` when nothing else fills it); no `reason` is set.

> [!NOTE]
>
> `stpPolicy` is a top-level request field. Do not include it inside the EIP-712 signed `order` object.

> [!NOTE]
>
> **SDK support.** Self-trade prevention is available in the TypeScript, Python, Rust, and Go SDKs. Pass the policy on order creation and read the outcome from the `execution` object on the response. See [TypeScript](https://docs.limitless.exchange/developers/sdk/typescript/orders.md#self-trade-prevention), [Python](https://docs.limitless.exchange/developers/sdk/python/orders.md#self-trade-prevention), [Rust](https://docs.limitless.exchange/developers/sdk/rust/orders.md#self-trade-prevention), and [Go](https://docs.limitless.exchange/developers/sdk/go/orders.md#self-trade-prevention).

> [!NOTE]
>
> **Where does `ownerId` come from?** It is the `id` field returned by [`GET /profiles/me`](https://docs.limitless.exchange/api-reference/portfolio/get-current-profile) or [`GET /profiles/{address}`](https://docs.limitless.exchange/api-reference/portfolio/get-profile). For partner sub-accounts, it is the `profileId` returned by [`POST /profiles/partner-accounts`](https://docs.limitless.exchange/api-reference/partner-accounts/create-partner-account), or recovered with [`GET /profiles/partner-accounts`](https://docs.limitless.exchange/api-reference/partner-accounts/list-partner-accounts).

> [!WARNING]
>
> **`ownerId` must match the profile that owns the order** (see [Programmatic API — EOA flow](https://docs.limitless.exchange/developers/programmatic-api.md#eoa-web3-partners)):
>
> * **Partner EOA + signed order + `onBehalfOf`:** set both `onBehalfOf` and `ownerId` to the **sub-account's** `profileId`. `order.maker` and `order.signer` must match that sub-account's wallet. A mismatched `ownerId` returns `400` with the message `"Profile ID does not match the order owner"`.
> * **Delegated signing** (unsigned `order`, `delegated_signing` scope, server wallet sub-account): send the target profile ID as both `onBehalfOf` and `ownerId`. The server normalizes `ownerId` to that target when it signs. Omit the client signature per [Delegated signing](#delegated-signing) below.
> * **Trading as yourself** (no `onBehalfOf`): `ownerId` is your own profile id (the SDK often fills this after fetching your profile).
> * **`Signer does not match - you should use embedded address for smart wallet`**: your profile is in smart-wallet trading mode, which self-signed API orders can't satisfy. Switch to EOA mode. See [Trading wallet mode](https://docs.limitless.exchange/developers/eip712-signing.md#trading-wallet-mode-whose-address-signs).

### Delegated signing

Partners place orders for a managed sub-account by setting body `onBehalfOf` to its profile ID. A client-signed order requires `trading`; the target must belong to the authenticated partner.

With both `trading` and `delegated_signing`, partners may instead omit both `signature` and `signatureType`. The request must still include the target profile ID as both `onBehalfOf` and `ownerId`. The server signs using a Privy server wallet linked to that profile, replaces `maker` and `signer` with that wallet address, and normalizes `ownerId` to the target. See [Authentication](https://docs.limitless.exchange/developers/authentication.md#delegated-signing).

### Fee rate

On fee-enabled markets (`metadata.fee: true`), a signed order's `feeRateBps` must equal the order owner's `effectiveFeeRateBps`. Read your own rate from [`GET /profiles/me`](https://docs.limitless.exchange/api-reference/portfolio/get-current-profile). A partner cannot read a sub-account's private profile with its own credentials; use the sub-account's rate when signing for it. On fee-disabled markets, sign with `feeRateBps: 0`. Unsigned delegated orders are signed by the server with the sub-account's effective rate.

On [new trading venues](https://docs.limitless.exchange/developers/venue-system.md#new-trading-venues) (`venue.feeModuleType: "COLLATERAL"`), sign with `feeRateBps: 0` on every order, whatever the market's `metadata.fee` flag or your profile's rate. Any other value is rejected with `FEE_RATE_MISMATCH`. Unsigned delegated orders on these venues are signed by the server with `0`.

### Execution response

The response includes an `execution` object with settlement details:

| Field | Type | Description |
| - | - | - |
| `matched` | `boolean` | Whether the order was matched immediately |
| `settlementStatus` | `string` | `UNMATCHED`, `MATCHED`, `MINED`, `CONFIRMED`, `RETRYING`, `FAILED`, `DELAYED`, or `CANCELED` |
| `reason` | `string` | Free-form terminal detail. For example, `STP_TAKER_REJECTED` accompanies an STP-cancelled taker; settlement or recovery failures can return other text with `FAILED`. |
| `eligibleAt` | `string` | ISO-8601 time the order is released to the matching engine. Present only when `settlementStatus` is `DELAYED` (taker delay). |
| `tradeEventId` | `string` | Trade event ID (present when matched) |
| `txHash` | `string` | On-chain transaction hash (present when mined) |
| `stpMakerCancels` | `string[]` | Resting order IDs cancelled by self-trade prevention (present when `cancel_maker` / `cancel_both` cancelled one or more of your resting orders) |
| `feeRateBps` | `number` | Fee rate in basis points. Always `0` on new trading venues. |
| `effectiveFeeBps` | `number` | Effective fee rate after rebates |
| `totalsRaw` | `object` | Raw execution totals (`contractsGross`, `contractsFee`, `contractsNet`, `usdGross`, `usdFee`, `usdNet`). On new trading venues the fee is only in `usdFee`, and `usdNet` differs by side; see [fees in order results](https://docs.limitless.exchange/developers/migrate-to-new-trading-venues.md#fees-in-order-results). |

> [!NOTE]
>
> **`DELAYED` (taker delay).** Some markets apply a short hold to marketable (taker) orders before the matching engine fills them. On such a market, a marketable order's response returns immediately with `settlementStatus: "DELAYED"`, `matched: false`, zero `totalsRaw`, and an `eligibleAt` timestamp. It does **not** block until the trade is mined. Track the outcome over [`subscribe_order_events`](https://docs.limitless.exchange/developers/websocket/order-events#subscribing-to-order-events) (provisional `MATCHED` → terminal `MINED` / `FAILED`), correlating by `order.id` and `tradeEventId`; `MATCHED` does not carry `clientOrderId`. A released FAK that fills partially gets one `MATCHED` and one terminal frame for the whole fill, plus an `OME` `EXECUTION` frame with `status: "PARTIALLY_FILLED"`. A FAK that matches nothing at release emits only an `OME` `EXECUTION` frame with `status: "KILLED"`, and `POST /orders/status/batch` reports it as `settlementStatus: "UNMATCHED"`. `postOnly` orders are never delayed.
>
> Which orders are held: `FOK` and `FAK` orders are always held for the delay. A `GTC` order is submitted immediately and rests at once if it rests; only a GTC that would cross the book is held instead, returning the same `DELAYED` response, so a GTC is delayed only when it would have taken. `postOnly` orders are never held. The hold length is the market's `settings.takerDelayMs`.
>
> During the hold the order is not on the book and emits no order or orderbook events; it first appears at `eligibleAt`. Cancellation is never delayed: cancelling a held order before `eligibleAt` removes it before it reaches the matching engine.

## Errors

| Status | Meaning |
| - | - |
| `400` | Structural validation, invalid signature/owner/token/amounts, insufficient balance or allowance, unavailable/resolved/expired market, delegated-signing failure, or matching-engine rejection. Validation failures use a `message` array; business failures usually use a string. Missing markets and profiles are normalized to `400` on this endpoint. |
| `401` | Authentication failed. |
| `403` | The HMAC token lacks `trading`, or `onBehalfOf` is not an authorized partner target. |
| `409` | `clientOrderId` or the signed order hash already exists or is being processed. |
| `425` | Receive-window rejection or a maintenance trading mode that blocks creation. Receive-window bodies contain a message; maintenance bodies contain a trading-mode `code`. |
| `500` | Unexpected order-creation failure. |

If the signed fee is incorrect, the API returns `400`:

```json theme={null}
{ "code": "FEE_RATE_MISMATCH", "expectedFeeRateBps": 150 }
```

Build and sign a new order using `expectedFeeRateBps` before resubmitting. Changing only the JSON does not update the EIP-712 signature.

On [new trading venues](https://docs.limitless.exchange/developers/venue-system.md#new-trading-venues), an order that is not `postOnly` (BUY or SELL) also needs a USDC approval to `venue.feeModule` from the signing wallet. Without it, the API returns `400`:

```
Insufficient collateral allowance for the order fee.
```

Approve USDC to `venue.feeModule` once, then resubmit.


## OpenAPI

````yaml POST /orders
openapi: 3.0.0
info:
  title: Limitless Exchange API
  description: >-

    # Limitless Exchange Trading API


    *Production-ready API for prediction market trading, portfolio management,
    and market data*


    > 🎯 **Quick Navigation**: [Authentication](#tag/authentication) |
    [Markets](#tag/markets) | [Trading](#tag/trading) |
    [Portfolio](#tag/portfolio)


    ---
      


    ## 🚀 Quick Start


    Choose your preferred programming language for complete end-to-end
    implementation:


    ### Overview


    The Limitless Exchange API offers both REST and WebSocket integration:


    **REST API (Trading)**:

    1. **🔐 Authentication**: Use API key for all programmatic access

    2. **📊 Fetch Market Data**: Get market info including venue contract
    addresses (once per market)

    3. **📋 Order Creation**: Build and sign orders using EIP-712 structured
    data

    4. **🚀 Order Submission**: Submit signed orders and receive confirmations


    **WebSocket API (Real-Time Data)**:

    1. **🔌 Connection**: Connect to `/markets` namespace for real-time updates

    2. **📊 Subscriptions**: Subscribe to market prices and position changes

    3. **📡 Events**: Handle live market data and transaction updates


    ### 🔐 Authentication for API Users


    > **⚠️ DEPRECATION NOTICE**: Cookie-based session authentication is
    deprecated and will be removed within weeks. Please migrate to API keys
    immediately.


    | Method | Header | Status |

    |--------|--------|--------|

    | **API Key** | `X-API-Key: lmts_...` | ✅ Required for programmatic access |

    | Cookie Session | `Cookie: limitless_session=...` | ⚠️ Deprecated (removal
    imminent) |


    **Getting an API Key**


    API keys can only be created via the Limitless Exchange UI:

    1. Log in to [limitless.exchange](https://limitless.exchange) using your
    wallet

    2. Click your profile menu (top right)

    3. Select "Api keys"

    4. Generate a new key


    **Using Your API Key**


    Include in all requests via the `X-API-Key` header:


    ```bash

    # REST API

    curl -H "X-API-Key: lmts_your_key_here"
    https://api.limitless.exchange/markets


    # WebSocket - pass X-API-Key header during connection handshake

    ```


    ### Migration from Cookie to API Key


    If you're currently using cookie-based authentication, migrate by:


    1. **Generate an API key** via the UI (profile menu → Api keys)

    2. **Replace cookie header** with API key header:


    ```diff

    # Before (deprecated)

    - Cookie: limitless_session=your_session_token


    # After

    + X-API-Key: lmts_your_key_here

    ```


    3. **Remove session management code** - no more login flow or cookie
    handling needed


    ### Important: Venue System for CLOB Markets


    CLOB markets use a **venue system** where each market is associated with
    specific contract addresses. Before placing orders:


    1. **Fetch market data once**: `GET /markets/:slug` returns venue
    information

    2. **Use venue.exchange**: This is the `verifyingContract` for EIP-712 order
    signing

    3. **Cache the venue**: Venue data is static per market - fetch once and
    reuse


    **Sample venue response:**

    ```json

    {
      "venue": {
        "exchange": "0xA1b2C3...",
        "adapter": "0xD4e5F6..."
      }
    }

    ```


    ### Required Approvals


    Before trading, set up token approvals based on order type:


    | Order Type | Market Type | Approve To |

    |------------|-------------|------------|

    | BUY | All CLOB | USDC → `venue.exchange` |

    | SELL | Simple CLOB | CT → `venue.exchange` |

    | SELL | NegRisk/Grouped | CT → `venue.exchange` AND `venue.adapter` |


    ### Checksummed Addresses


    All addresses must use **checksummed format** (EIP-55 mixed-case):

    - Authentication: `x-account` header

    - Orders: `maker` and `signer` fields

    - Example: `0x5aAeb6053F3E94C9b9A09f33669435E7Ef1BeAed`


    ### Implementation Guides


    **[🐍 Python Quick Start](#description/-python-quick-start)**

    - REST API: eth-account, requests, and web3.py libraries

    - WebSocket: python-socketio, asyncio integration


    **[☕ Java Quick Start](#description/-java-quick-start)**  

    - REST API: Web3j, OkHttp3, and Jackson libraries


    **[📦 Node.js/TypeScript Quick
    Start](#description/-nodejs-typescript-quick-start)**

    - REST API: viem, ethers, and cross-fetch libraries

    - WebSocket: socket.io-client for real-time trading

    - Full TypeScript support with end-to-end examples


    **[🔌 WebSocket Integration](#description/-websocket-integration)**

    - Real-time market data and position updates

    - Production-ready Python client with authentication


    ---
      


    ## 🐍 Python Quick Start


    Complete end-to-end Python implementation for Limitless Exchange API
    integration.
      


    ### 🐍 Python E2E Order Creation Guide


    Complete Python implementation guide is being loaded from external
    documentation...


    **Guide Contents:**

    - 🔐 Complete authentication flow with eth-account

    - 📋 Order construction with Web3.py calculations

    - ✍️ EIP-712 structured data signing

    - 🚀 Order submission with requests library

    - ⚠️ Comprehensive error handling

    - 🛠️ Production deployment considerations


    *For the complete Python guide, ensure the file is available at
    docs/scripts-samples/python-e2e-order-creation.md*
        


    ## ☕ Java Quick Start


    Complete end-to-end Java implementation for Limitless Exchange API
    integration.
      


    ### ☕ Java E2E Order Creation Guide


    Complete Java enterprise implementation guide is being loaded from external
    documentation...


    **Guide Contents:**

    - 🔐 Complete authentication flow with Web3j

    - 📋 Order construction with BigInteger precision

    - ✍️ EIP-712 structured data signing

    - 🚀 Order submission with OkHttp3

    - ⚠️ Enterprise error handling patterns

    - 🏗️ Production Maven project structure


    *For the complete Java guide, ensure the file is available at
    docs/scripts-samples/java-e2e-order-creation.md*
        


    ## 📦 Node.js/TypeScript Quick Start


    Complete end-to-end Node.js/TypeScript implementation for trading and
    WebSocket subscriptions.
      


    ### 📦 Node.js/TypeScript Trading & WebSocket Guide


    Complete Node.js/TypeScript implementation guide is being loaded from
    external documentation...


    **Guide Contents:**

    - 🔐 **Authentication**: Wallet-based auth with ethers and viem

    - 📋 **Order Creation**: EIP-712 signing with viem WalletClient

    - 🚀 **Order Submission**: REST API integration with cross-fetch

    - 🔌 **WebSocket Subscriptions**: socket.io-client for real-time updates

    - 📊 **Market Data**: AMM prices and CLOB orderbook subscriptions

    - ⚠️ **Type Safety**: Full TypeScript support with proper types

    - 🛠️ **Production Ready**: Complete end-to-end working example


    **Key Features:**

    - **Combined Subscriptions**: Subscribe to both AMM and CLOB markets
    simultaneously

    - **Authentication Flow**: Complete wallet-based authentication with session
    management

    - **Trading Integration**: Place orders and receive real-time updates

    - **TypeScript First**: Type-safe implementation with proper interfaces


    *For the complete Node.js guide, ensure the file is available at
    docs/scripts-samples/node-socket-trading-and-subscribe.md*
        


    ## 🔌 WebSocket Integration


    Real-time market data and position updates using WebSocket connections.
      


    ### 🔌 WebSocket Real-Time Integration Guide


    Complete WebSocket implementation guide is being loaded from external
    documentation...


    **Guide Contents:**

    - 🔌 **WebSocket Connection**: python-socketio client with async support

    - 🔐 **Authentication**: JWT session cookie integration

    - 📊 **Market Subscriptions**: Real-time price updates and position changes

    - ⚡ **Event Handling**: Comprehensive event processing patterns

    - 🔄 **Auto-Reconnection**: Production-ready reconnection logic

    - 🛠️ **Error Recovery**: Robust error handling and fallback strategies


    **Key Features:**

    - **Public Mode**: Market price updates without authentication

    - **Authenticated Mode**: Full access to positions and transactions

    - **Multi-Market Support**: Subscribe to multiple markets simultaneously

    - **Production Ready**: Tested patterns for production deployment


    *For the complete WebSocket guide, ensure the file is available at
    docs/scripts-samples/python-socket-subscribe.md*
        
  version: '1.0'
  contact:
    name: API Support
    url: https://limitless.exchange
    email: hey@limitless.network
servers:
  - url: https://api.limitless.exchange
    description: Production API
security: []
tags:
  - name: Authentication
    description: User authentication and session management
  - name: Markets
    description: Browse, search, and analyze prediction markets
  - name: Market Navigation
    description: Navigation tree, market pages, and property filters
  - name: Trading
    description: Create, manage, and cancel orders
  - name: Portfolio
    description: Position tracking, trade history, and performance
  - name: Feed
    description: Public trading activity feeds
paths:
  /orders:
    post:
      tags:
        - Trading
      summary: Create Order
      description: >-
        Creates a buy/sell order for prediction market positions. Requires
        signed order data.
      operationId: OrderController_createOrder
      parameters: []
      requestBody:
        required: true
        description: Order creation data including signature and order parameters
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrderDto'
      responses:
        '201':
          description: >-
            Order accepted. It may be resting, delayed, matched, settled,
            canceled by STP, or accepted with a settlement failure reported in
            execution.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponseDto'
        '400':
          description: >-
            Validation, signature, ownership, amount, balance, allowance,
            market, delegated-signing, or matching-engine rejection
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ValidationErrorResponse'
                  - $ref: '#/components/schemas/NestErrorResponse'
                  - $ref: '#/components/schemas/ErrorMessageResponse'
                  - $ref: '#/components/schemas/FeeRateMismatchErrorResponse'
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NestErrorResponse'
        '403':
          description: Missing trading scope or unauthorized onBehalfOf target
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessageResponse'
        '409':
          description: clientOrderId already exists or is being processed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NestErrorResponse'
        '425':
          description: >-
            Receive-window check failed, or order creation is temporarily
            blocked by maintenance mode. Use the response body to distinguish
            `reason` (receive-window) from `code` (maintenance).
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorMessageResponse'
                  - $ref: '#/components/schemas/TradingModeErrorResponse'
        '500':
          description: Unexpected order-creation failure
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessageResponse'
      security:
        - HmacAuth: []
components:
  schemas:
    CreateOrderDto:
      type: object
      properties:
        order:
          description: Order details including signature and amounts
          allOf:
            - $ref: '#/components/schemas/Order'
        ownerId:
          type: integer
          description: >-
            Required profile ID of the order owner. For delegated signing, send
            the target profile ID as both ownerId and onBehalfOf.
          example: 12345
        orderType:
          type: string
          description: >-
            Order type (GTC=Good Till Cancelled, FAK=Fill And Kill, FOK=Fill Or
            Kill)
          enum:
            - FAK
            - FOK
            - GTC
          example: GTC
        marketSlug:
          type: string
          description: Market identifier slug
          example: biden-vs-trump-2024
        postOnly:
          type: boolean
          description: >-
            Reject the order if it would match immediately. Supported only for
            GTC orders.
          example: true
        clientOrderId:
          type: string
          description: >-
            Optional owner-scoped uniqueness and deduplication key. The
            submitted value is limited to 128 characters, then trimmed; blank
            values are rejected. Reuse returns 409 rather than replaying an
            earlier response.
          example: client-order-001
          maxLength: 128
        onBehalfOf:
          type: integer
          description: >-
            Managed profile ID for partner placement. Requires `trading` and a
            partner relationship; unsigned delegated placement also requires
            `delegated_signing`.
          example: 12345
          minimum: 1
        timestamp:
          type: integer
          description: >-
            Optional client-stamped order creation time, Unix ms epoch.
            Top-level request field; not part of the EIP-712 signed order
            payload.
          example: 1735689600000
          minimum: 0
        recvWindow:
          type: integer
          description: >-
            Optional maximum accepted order age in milliseconds. Valid range: 1
            to 10000. If omitted, the server applies a 2000 ms default receive
            window. Top-level request field; not part of the EIP-712 signed
            order payload.
          example: 1500
          maximum: 10000
          minimum: 1
        stpPolicy:
          type: string
          description: >-
            Self-trade prevention policy. If omitted, defaults to cancel_maker.
            Top-level request field; not part of the EIP-712 signed order
            payload.
          enum:
            - cancel_both
            - cancel_maker
            - cancel_taker
          example: cancel_maker
      additionalProperties: false
      required:
        - order
        - ownerId
        - orderType
        - marketSlug
    OrderResponseDto:
      type: object
      properties:
        order:
          description: Order details including slim market and owner
          allOf:
            - $ref: '#/components/schemas/CreatedOrderDto'
        makerMatches:
          description: Maker matches if order was matched immediately
          type: array
          items:
            $ref: '#/components/schemas/MakerMatch'
        execution:
          description: Execution and settlement summary
          allOf:
            - $ref: '#/components/schemas/OrderExecutionDto'
      required:
        - order
        - execution
    ValidationErrorResponse:
      type: object
      properties:
        message:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorItem'
        error:
          type: string
          enum:
            - Bad Request
        statusCode:
          type: number
          enum:
            - 400
      additionalProperties: false
      required:
        - message
        - error
        - statusCode
    NestErrorResponse:
      type: object
      properties:
        message:
          type: string
        error:
          type: string
        statusCode:
          type: integer
      additionalProperties: false
      required:
        - message
        - error
        - statusCode
    ErrorMessageResponse:
      type: object
      properties:
        message:
          type: string
      additionalProperties: false
      required:
        - message
    FeeRateMismatchErrorResponse:
      type: object
      description: >-
        The signed fee differs from the order owner's effective fee rate. Build
        and sign a new order with expectedFeeRateBps before retrying.
      properties:
        code:
          type: string
          enum:
            - FEE_RATE_MISMATCH
        expectedFeeRateBps:
          type: integer
          minimum: 0
        message:
          type: string
      required:
        - code
        - expectedFeeRateBps
    TradingModeErrorResponse:
      type: object
      properties:
        code:
          type: string
          enum:
            - post_only_mode
            - cancel_only_mode
            - trading_disabled
        message:
          type: string
          example: >-
            Trading is currently cancel-only. New orders are not accepted, but
            cancels are allowed.
        mode:
          type: string
          enum:
            - post_only
            - cancel_only
            - disabled
        resumeAt:
          type: string
          format: date-time
          nullable: true
      additionalProperties: false
      required:
        - code
        - message
        - mode
    Order:
      type: object
      properties:
        salt:
          description: >-
            Unique random value for signature uniqueness. Send unsafe integers
            as decimal strings to preserve EIP-712 bytes.
          oneOf:
            - type: string
              pattern: ^\d+$
              example: '1778155025318314496'
            - type: number
              example: 1234567890
        maker:
          type: string
          description: Ethereum address of the maker (order creator)
          example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
          pattern: ^0x[a-fA-F0-9]{40}$
        signer:
          type: string
          description: Address that signed the order
          example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
          pattern: ^0x[a-fA-F0-9]{40}$
        taker:
          type: string
          description: Specific taker address (optional for open orders)
          example: '0x0000000000000000000000000000000000000000'
          pattern: ^0x[a-fA-F0-9]{40}$
        tokenId:
          type: string
          description: Token ID being traded (YES or NO position ID from conditional token)
          example: >-
            19633204485790857949828516737993423758628930235371629943999544859324645414627
        makerAmount:
          type: integer
          description: >-
            Raw 6-decimal amount offered by the maker. For GTC/FAK: collateral
            for BUY or contracts for SELL. For FOK: maximum collateral for BUY
            or contracts for SELL.
          example: 5000000
          minimum: 100
        takerAmount:
          type: integer
          description: >-
            Raw 6-decimal amount requested. For GTC/FAK: contracts for BUY or
            collateral for SELL. For FOK this must equal 1.
          example: 10000000
          minimum: 1
        expiration:
          type: string
          description: >-
            Omission is signed as zero; if supplied, the value must represent
            zero because non-zero expiration is unsupported.
          example: '0'
          pattern: ^0+$
        nonce:
          type: number
          description: Required numeric zero.
          example: 0
          enum:
            - 0
        price:
          type: number
          description: >-
            Required for GTC/FAK and forbidden for FOK. Decimal price with at
            most three places; price × contracts must equal the collateral
            amount exactly as an integer.
          example: 0.75
          minimum: 0.001
          maximum: 0.999
          multipleOf: 0.001
        feeRateBps:
          type: number
          description: Fee rate in basis points (1% = 100)
          example: 0
        side:
          type: number
          description: 'Order side: 0 = BUY, 1 = SELL'
          enum:
            - 0
            - 1
          example: 0
        signature:
          type: string
          description: >-
            EIP-712 signature of order details as a 0x-prefixed hex string with
            full-byte (even) length. Optional when using delegated signing.
          example: >-
            0x6e3a3f2c2c2bb1ce3a14c4f5e4ad6f3c8b1ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d4a36cc4ad9c44d4d5fa1c4cd5b6e74a4d41b
          pattern: ^0x([a-fA-F0-9]{2})*$
        signatureType:
          type: number
          description: Signature type (0-3). Optional when using delegated signing.
          enum:
            - 0
            - 1
            - 2
            - 3
          example: 2
      additionalProperties: false
      description: >-
        EIP-712 order fields. Signature and signatureType must be supplied
        together for client signing or both omitted for delegated server
        signing.
      oneOf:
        - required:
            - signature
            - signatureType
        - not:
            anyOf:
              - required:
                  - signature
              - required:
                  - signatureType
      required:
        - salt
        - maker
        - signer
        - tokenId
        - makerAmount
        - takerAmount
        - nonce
        - feeRateBps
        - side
    CreatedOrderDto:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Internal order ID
        salt:
          type: string
          description: Order salt as a decimal string
          example: '1778155025318314496'
        maker:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        signer:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        taker:
          type: string
          nullable: true
          pattern: ^0x[a-fA-F0-9]{40}$
        tokenId:
          type: string
        expiration:
          type: string
          format: date-time
          nullable: true
        signatureType:
          type: number
          enum:
            - 0
            - 1
            - 2
            - 3
        feeRateBps:
          type: integer
          nullable: true
        signature:
          type: string
          pattern: ^0x([a-fA-F0-9]{2})*$
        orderType:
          type: string
          enum:
            - GTC
            - FAK
            - FOK
        side:
          type: number
          enum:
            - 0
            - 1
          description: 0 = BUY, 1 = SELL
        marketId:
          type: string
        ownerId:
          type: integer
        createdAt:
          type: string
          format: date-time
        market:
          $ref: '#/components/schemas/MarketSlimDto'
        makerAmount:
          type: integer
          description: Raw 6-decimal amount
          example: 5000000
        takerAmount:
          type: integer
          description: Raw 6-decimal amount
          example: 10000000
        nonce:
          type: number
          enum:
            - 0
          description: Numeric zero
        price:
          type: number
          example: 0.75
        owner:
          $ref: '#/components/schemas/CreatedOrderOwner'
      required:
        - id
        - salt
        - maker
        - signer
        - tokenId
        - signatureType
        - signature
        - orderType
        - side
        - marketId
        - ownerId
        - createdAt
        - market
        - makerAmount
        - takerAmount
        - nonce
        - owner
    MakerMatch:
      type: object
      properties:
        id:
          type: string
          format: uuid
        matchedSize:
          type: string
          description: Matched contracts in raw 6-decimal units.
          example: '1000000'
        fillPrice:
          type: string
          description: Effective taker-perspective fill price.
          example: '0.55'
        fillCost:
          type: string
          description: Fill collateral cost in raw 6-decimal units.
          example: '550000'
        orderId:
          type: string
          format: uuid
        order:
          $ref: '#/components/schemas/MakerMatchOrder'
      required:
        - id
        - matchedSize
        - fillPrice
        - fillCost
        - orderId
        - order
    OrderExecutionDto:
      type: object
      properties:
        matched:
          type: boolean
          example: true
        settlementStatus:
          type: string
          example: MINED
          enum:
            - UNMATCHED
            - MATCHED
            - MINED
            - CONFIRMED
            - RETRYING
            - FAILED
            - DELAYED
            - CANCELED
        reason:
          type: string
          example: settlement transaction reverted
        eligibleAt:
          type: string
          example: '2026-06-08T10:15:30.000Z'
          format: date-time
          nullable: true
        tradeEventId:
          type: string
          example: 4aa706dd-6c57-4f3c-945a-99818dfd95f1
        txHash:
          type: string
          example: '0xabc123'
          nullable: true
        clientOrderId:
          type: string
          example: client-order-001
        stpMakerCancels:
          example:
            - 4aa706dd-6c57-4f3c-945a-99818dfd95f1
          type: array
          items:
            type: string
        feeRateBps:
          type: number
          example: 25
        effectiveFeeBps:
          type: number
          example: 26
        totalsRaw:
          $ref: '#/components/schemas/OrderExecutionTotalsRawDto'
      required:
        - matched
        - settlementStatus
        - feeRateBps
        - effectiveFeeBps
        - totalsRaw
    ValidationErrorItem:
      type: object
      properties:
        field:
          type: string
          example: orderIds
        message:
          type: string
          example: orderIds should not be empty
      additionalProperties: false
      required:
        - field
        - message
    MarketSlimDto:
      type: object
      properties:
        id:
          type: integer
          example: 7348
        slug:
          type: string
          example: btc-up-or-down-1-hour
        title:
          type: string
          example: BTC Up or Down - Hourly
        status:
          type: string
          example: FUNDED
          enum:
            - CREATED
            - DRAFTED
            - FUNDED
            - LOCKED
            - RESOLVED
        yesPositionId:
          type: string
          example: 11514974713064423461...
          nullable: true
        noPositionId:
          type: string
          example: 14525308260861904048...
          nullable: true
        group:
          $ref: '#/components/schemas/MarketGroupSlimDto'
      required:
        - id
        - slug
        - title
        - status
        - yesPositionId
        - noPositionId
    CreatedOrderOwner:
      type: object
      properties:
        id:
          type: integer
        account:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        client:
          type: string
        tradeWalletOption:
          type: string
          nullable: true
          enum:
            - eoa
            - smartWallet
        smartWallet:
          type: string
          nullable: true
        username:
          type: string
        displayName:
          type: string
        pfpUrl:
          type: string
          nullable: true
        socialUrl:
          type: string
          nullable: true
        rankName:
          type: string
        points:
          type: number
        isTop100:
          type: boolean
        leaderboardPosition:
          type: integer
        referredUsersCount:
          type: integer
      required:
        - id
        - account
        - client
        - tradeWalletOption
        - smartWallet
        - username
        - displayName
        - pfpUrl
        - socialUrl
        - rankName
        - points
        - referredUsersCount
    MakerMatchOrder:
      type: object
      properties:
        id:
          type: string
          format: uuid
        maker:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        price:
          type: string
          nullable: true
          example: '0.55'
        side:
          type: number
          enum:
            - 0
            - 1
        tokenId:
          type: string
        owner:
          $ref: '#/components/schemas/MakerMatchOwner'
      required:
        - id
        - maker
        - price
        - side
        - tokenId
        - owner
    OrderExecutionTotalsRawDto:
      type: object
      properties:
        contractsGross:
          type: string
          example: '1000000'
        contractsFee:
          type: string
          example: '1000'
        contractsNet:
          type: string
          example: '999000'
        usdGross:
          type: string
          example: '500000'
        usdFee:
          type: string
          example: '500'
        usdNet:
          type: string
          example: '499500'
      required:
        - contractsGross
        - contractsFee
        - contractsNet
        - usdGross
        - usdFee
        - usdNet
    MarketGroupSlimDto:
      type: object
      properties:
        id:
          type: integer
          example: 42
        slug:
          type: string
          example: btc-price-markets
        title:
          type: string
          example: BTC Price Markets
      required:
        - id
        - slug
        - title
    MakerMatchOwner:
      type: object
      properties:
        id:
          type: integer
        account:
          type: string
          pattern: ^0x[a-fA-F0-9]{40}$
        client:
          type: string
        tradeWalletOption:
          type: string
          nullable: true
          enum:
            - eoa
            - smartWallet
        smartWallet:
          type: string
          nullable: true
        username:
          type: string
        displayName:
          type: string
        pfpUrl:
          type: string
          nullable: true
        socialUrl:
          type: string
          nullable: true
        points:
          type: number
          enum:
            - 0
        referredUsersCount:
          type: number
          enum:
            - 0
      required:
        - id
        - account
        - client
        - tradeWalletOption
        - smartWallet
        - username
        - displayName
        - pfpUrl
        - socialUrl
        - points
        - referredUsersCount
  securitySchemes:
    HmacAuth:
      type: apiKey
      in: header
      name: lmts-api-key
      description: >-
        Scoped API token with HMAC-SHA256 signing. Requires three headers:
        lmts-api-key (token ID), lmts-timestamp (ISO-8601), lmts-signature
        (Base64-encoded HMAC). See Authentication docs for details.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.