> ## 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.

<Info>
  Before creating orders:

  1. Fetch market data via [Get Market Details](/api-reference/markets/get-market) to get venue and token IDs
  2. Sign the order using [EIP-712](/developers/eip712-signing) with `venue.exchange` as `verifyingContract`
  3. Ensure you have [token approvals](/developers/venue-system#required-token-approvals) set up
</Info>

<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 `503 Service Unavailable`. Check [Maintenance Mode](/developers/maintenance-mode) before sending orders.
</Warning>

### Optional Fields

| Field           | Type      | Description                                                                                                                                                                                                                                                                                        |
| --------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `clientOrderId` | `string`  | Idempotency key (max 128 chars). If a duplicate is submitted, the server returns `409 Conflict`.                                                                                                                                                                                                   |
| `onBehalfOf`    | `number`  | Profile ID of the sub-account to place the order for. Requires a [scoped API token](/developers/authentication#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. Valid range: `1` to `10000`. If omitted, no receive-window check is applied. 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. Direct API callers should send this with `recvWindow` when they want client-to-server freshness checks.             |
| `recvWindow` | Maximum accepted age, in milliseconds, between `timestamp` and the server receive time. Valid range: `1` to `10000`. If omitted, no receive-window check is applied. |

<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 `425`; build and sign a fresh order.
</Warning>

### 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 canceled resting order IDs in `stpMakerCancels` and keeps its normal status (`UNMATCHED` when nothing else fills it); no `reason` is set.

<Info>
  `stpPolicy` is a top-level request field. Do not include it inside the EIP-712 signed `order` object.
</Info>

<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](/developers/sdk/typescript/orders#self-trade-prevention), [Python](/developers/sdk/python/orders#self-trade-prevention), [Rust](/developers/sdk/rust/orders#self-trade-prevention), and [Go](/developers/sdk/go/orders#self-trade-prevention).
</Note>

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

<Warning>
  **`ownerId` must match the profile that owns the order** (see [Programmatic API — EOA flow](/developers/programmatic-api#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` — `"Profile ID does not match the order owner"`.
  * **Delegated signing** (unsigned `order`, `delegated_signing` scope, server wallet sub-account): the server fills in `ownerId` 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).
</Warning>

### Delegated Signing

Partners with the `delegated_signing` scope can omit `signature` and `signatureType` from the order object. The server signs the order using a Privy server wallet linked to the target sub-account and sets `maker`/`signer` to the server wallet address. See [Authentication](/developers/authentication#delegated-signing) for details.

### 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`   | Reason the order was canceled. `STP_TAKER_REJECTED` when self-trade prevention rejected the incoming order (`cancel_taker` / `cancel_both`). Present only when `settlementStatus` is `CANCELED`. |
| `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 canceled 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                                                                                                                                                                         |
| `effectiveFeeBps`  | `number`   | Effective fee rate after rebates                                                                                                                                                                 |
| `totalsRaw`        | `object`   | Raw execution totals (`contractsGross`, `contractsFee`, `contractsNet`, `usdGross`, `usdFee`, `usdNet`)                                                                                          |

<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`](/developers/websocket-events#subscribing-to-order-events) (provisional `MATCHED` → terminal `MINED` / `FAILED`), correlating by `clientOrderId` / `tradeEventId`. `postOnly` orders are never delayed.
</Note>


## OpenAPI

````yaml POST /orders
openapi: 3.0.0
info:
  title: Limitless Exchange API
  description: >-
    Production-ready REST API for prediction market trading, portfolio
    management, and market data on Limitless Exchange (Base L2).
  version: '1.0'
  contact:
    name: API Support
    url: https://limitless.exchange
    email: help@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: API Tokens
    description: Scoped API token management for partner integrations
  - name: Partner Accounts
    description: Sub-account creation and allowance recovery for partner integrations
  - name: System
    description: Public API state and availability information
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 successfully created and matched
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponseDto'
        '400':
          description: >-
            Invalid order data, insufficient balance/allowance, or market
            deadline passed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '401':
          description: User not authenticated
        '425':
          description: Receive-window check failed. Use a fresh timestamp and submit again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '500':
          description: Server error during order creation
        '503':
          description: Trading is temporarily limited by maintenance mode
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: cancel_only_mode
                  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
                    example: cancel_only
                  resumeAt:
                    type: string
                    format: date-time
                    nullable: true
                    example: '2026-06-22T18:00:00.000Z'
                required:
                  - code
                  - message
                  - mode
              examples:
                postOnlyMode:
                  summary: Regular order blocked during post-only mode
                  value:
                    code: post_only_mode
                    message: >-
                      Trading is currently post-only. Only post-only orders and
                      cancels are allowed.
                    mode: post_only
                    resumeAt: '2026-06-22T18:00:00.000Z'
                cancelOnlyMode:
                  summary: New order blocked during cancel-only mode
                  value:
                    code: cancel_only_mode
                    message: >-
                      Trading is currently cancel-only. New orders are not
                      accepted, but cancels are allowed.
                    mode: cancel_only
                    resumeAt: '2026-06-22T18:00:00.000Z'
                tradingDisabled:
                  summary: Order creation blocked while trading is disabled
                  value:
                    code: trading_disabled
                    message: Trading is currently disabled.
                    mode: disabled
                    resumeAt: '2026-06-22T18:00:00.000Z'
      security:
        - HmacAuth: []
components:
  schemas:
    CreateOrderDto:
      type: object
      properties:
        order:
          description: Order details including signature and amounts
          allOf:
            - $ref: '#/components/schemas/Order'
        ownerId:
          type: number
          description: Profile ID of the order owner
          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: >-
            Client-provided idempotency key for order placement. If a duplicate
            is submitted, the server returns 409 Conflict.
          example: client-order-001
          maxLength: 128
        onBehalfOf:
          type: number
          description: >-
            Profile ID to place order on behalf of (partner flow). Requires an
            API token with trading scope and a partner relationship with the
            target profile.
          example: 12345
        timestamp:
          type: number
          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: number
          description: >-
            Optional maximum accepted order age in milliseconds. Valid range: 1
            to 10000. If omitted, no receive-window check is applied. Top-level
            request field; not part of the EIP-712 signed order payload.
          example: 1500
          minimum: 1
          maximum: 10000
        stpPolicy:
          type: string
          description: >-
            Self-trade prevention policy. Top-level request field; not part of
            the EIP-712 signed order payload. Defaults to cancel_maker when
            omitted.
          enum:
            - cancel_both
            - cancel_maker
            - cancel_taker
          example: cancel_maker
      required:
        - order
        - ownerId
        - orderType
        - marketSlug
    OrderResponseDto:
      type: object
      properties:
        order:
          $ref: '#/components/schemas/CreatedOrderDto'
          description: Order details including slim market and owner
        makerMatches:
          description: Maker matches if order was matched immediately
          type: array
          items:
            $ref: '#/components/schemas/MakerMatch'
        execution:
          $ref: '#/components/schemas/OrderExecutionDto'
          description: Execution and settlement summary
      required:
        - order
        - execution
    ErrorResponseDto:
      type: object
      properties:
        message:
          type: string
          description: Error message
          example: Invalid order data
      required:
        - message
    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: number
          description: >-
            Amount the maker is offering, scaled by 1e6. For GTC orders: price *
            size * 1e6 (BUY) or size * 1e6 (SELL). For FOK orders: USDC to spend
            * 1e6 (BUY) or shares to sell * 1e6 (SELL).
          example: 5000000
          minimum: 0
        takerAmount:
          type: number
          description: >-
            Amount the maker wants in return, scaled by 1e6. For GTC orders:
            size * 1e6 (BUY) or price * size * 1e6 (SELL). For FOK orders:
            always 1.
          example: 10000000
          minimum: 0
        expiration:
          type: string
          description: >-
            Order expiration. Must be "0". Non-zero expiration is not currently
            supported and orders signed with a non-zero value are rejected.
          example: '0'
        nonce:
          type: number
          description: >-
            Must be 0. Non-zero nonce is not currently supported and is
            rejected.
          example: 0
        price:
          type: number
          description: >-
            Order price as decimal (0.01-0.99, required for limit-like GTC/FAK
            orders)
          example: 0.75
          minimum: 0.01
          maximum: 0.99
        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.
          pattern: ^0x([a-fA-F0-9]{2})*$
          example: >-
            0x123abc456def789ghi0123abc456def789ghi0123abc456def789ghi0123456789012345678901
        signatureType:
          type: number
          description: Signature type (0-3). Optional when using delegated signing.
          enum:
            - 0
            - 1
            - 2
            - 3
          example: 2
      required:
        - salt
        - maker
        - signer
        - tokenId
        - makerAmount
        - takerAmount
        - feeRateBps
        - side
        - signature
        - signatureType
    CreatedOrderDto:
      type: object
      description: >-
        Created order as returned by the API. Large numeric fields (`salt`,
        `makerAmount`, `takerAmount`, `nonce`, `price`) are serialized as
        decimal strings to preserve precision.
      properties:
        id:
          type: string
          format: uuid
          description: Internal order ID
        salt:
          type: string
          description: Order salt as decimal string
          example: '1778155025318314496'
        maker:
          type: string
          example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
        signer:
          type: string
          example: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'
        taker:
          type: string
          nullable: true
          example: '0x0000000000000000000000000000000000000000'
        tokenId:
          type: string
          example: >-
            19633204485790857949828516737993423758628930235371629943999544859324645414627
        makerAmount:
          type: string
          description: Maker amount as decimal string (scaled by 1e6)
          example: '5000000'
        takerAmount:
          type: string
          description: Taker amount as decimal string (scaled by 1e6)
          example: '10000000'
        expiration:
          type: string
          nullable: true
          description: Always "0". Non-zero expiration is not currently supported.
          example: '0'
        signatureType:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
          example: 2
        nonce:
          type: string
          nullable: true
          description: Always "0". Non-zero nonce is not currently supported.
          example: '0'
        feeRateBps:
          type: integer
          nullable: true
          example: 0
        signature:
          type: string
          pattern: ^0x([a-fA-F0-9]{2})*$
        orderType:
          type: string
          enum:
            - GTC
            - FAK
            - FOK
          example: GTC
        price:
          type: string
          nullable: true
          description: Order price as decimal string (0.01-0.99)
          example: '0.75'
        side:
          type: integer
          enum:
            - 0
            - 1
          description: 0 = BUY, 1 = SELL
          example: 0
        marketId:
          type: string
          description: Internal market identifier
        ownerId:
          type: integer
          description: Profile ID of the order owner
          example: 12345
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        market:
          type: object
          description: Slim market info
          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
              enum:
                - FUNDED
                - RESOLVED
                - LOCKED
                - DRAFT
                - FUNDED_FLAGGED
            yesPositionId:
              type: string
              nullable: true
            noPositionId:
              type: string
              nullable: true
            group:
              type: object
              nullable: true
              properties:
                id:
                  type: integer
                slug:
                  type: string
                title:
                  type: string
        owner:
          type: object
          nullable: true
          description: Public profile of the order owner
          properties:
            id:
              type: integer
            account:
              type: string
              description: Checksummed wallet address
            displayName:
              type: string
              nullable: true
            username:
              type: string
              nullable: true
            imageURI:
              type: string
              nullable: true
      required:
        - id
        - salt
        - maker
        - signer
        - tokenId
        - makerAmount
        - takerAmount
        - signatureType
        - signature
        - orderType
        - side
        - marketId
        - ownerId
        - createdAt
        - market
    MakerMatch:
      type: object
      properties: {}
    OrderExecutionDto:
      type: object
      description: Execution and settlement summary for a created order
      properties:
        matched:
          type: boolean
          description: Whether the order was matched immediately
          example: true
        settlementStatus:
          type: string
          description: >-
            Current settlement status of the order. DELAYED means the order was
            accepted but is held by a per-market taker delay before being
            released to the matching engine. CANCELED with reason
            STP_TAKER_REJECTED means self-trade prevention (cancel_taker /
            cancel_both) rejected the incoming order.
          enum:
            - UNMATCHED
            - MATCHED
            - MINED
            - CONFIRMED
            - RETRYING
            - FAILED
            - DELAYED
            - CANCELED
          example: MINED
        reason:
          type: string
          nullable: true
          description: >-
            Reason the order was canceled. STP_TAKER_REJECTED when self-trade
            prevention rejected the incoming order. Present only when
            settlementStatus is CANCELED.
          enum:
            - STP_TAKER_REJECTED
          example: STP_TAKER_REJECTED
        eligibleAt:
          type: string
          format: date-time
          nullable: true
          description: >-
            ISO-8601 time a delayed (taker-delay) order is released to the
            matching engine. Present only when settlementStatus is DELAYED.
          example: '2026-06-08T10:15:30.000Z'
        tradeEventId:
          type: string
          description: Trade event ID (present when matched)
          example: 4aa706dd-6c57-4f3c-945a-99818dfd95f1
        txHash:
          type: string
          description: On-chain transaction hash (present when mined)
          example: '0xabc123'
          nullable: true
        clientOrderId:
          type: string
          description: Echo of client-provided idempotency key
          example: client-order-001
        stpMakerCancels:
          type: array
          description: >-
            Resting order IDs canceled by self-trade prevention (cancel_maker /
            cancel_both)
          items:
            type: string
          example:
            - 4aa706dd-6c57-4f3c-945a-99818dfd95f1
        feeRateBps:
          type: number
          description: Fee rate in basis points applied to this order
          example: 25
        effectiveFeeBps:
          type: number
          description: Effective fee rate in basis points after any rebates
          example: 26
        totalsRaw:
          $ref: '#/components/schemas/OrderExecutionTotalsRawDto'
      required:
        - matched
        - settlementStatus
        - feeRateBps
        - effectiveFeeBps
        - totalsRaw
    OrderExecutionTotalsRawDto:
      type: object
      description: Raw execution totals in contract units (strings to preserve precision)
      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
  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.

````