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

# Create order

> Place a limit order (`trade` key). `client_order_id` is required and idempotent: resending the same id with the same body returns the order already placed, never a second one. After a timeout or `503 EXCHANGE_UNAVAILABLE`, retry with the SAME id.



## OpenAPI

````yaml api-reference/openapi.json POST /portfolio/orders
openapi: 3.1.0
info:
  title: updown Trade API
  version: 1.0.0
  description: >-
    Public REST API. Market data needs no key; `/account` (and order entry, when
    it ships) takes an API key. Prices are dollar strings on the 1¢ grid, counts
    are contract strings, times are epoch ms. Generated from packages/protocol —
    do not edit by hand.
servers:
  - url: https://api.updown.fast/trade-api/v1
    description: production
security: []
paths:
  /portfolio/orders:
    post:
      summary: Create order
      description: >-
        Place a limit order (`trade` key). `client_order_id` is required and
        idempotent: resending the same id with the same body returns the order
        already placed, never a second one. After a timeout or `503
        EXCHANGE_UNAVAILABLE`, retry with the SAME id.
      operationId: createOrder
      requestBody:
        $ref: '#/components/requestBodies/CreateOrder'
      responses:
        '201':
          description: The order, as the book holds it after this call.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResponse'
        '400':
          description: Invalid request (code BAD_REQUEST).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: No API key, or one that isn't valid (code UNAUTHORIZED).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            The key lacks the permission, or the account can't trade yet (code
            FORBIDDEN).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            IDEMPOTENCY_CONFLICT (that id was used for a different order) or
            ACCOUNT_BUSY (retry in a moment).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limited (code RATE_LIMITED); wait `Retry-After` seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: The book could not be read (code EXCHANGE_UNAVAILABLE); retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - apiKey: []
components:
  requestBodies:
    CreateOrder:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/CreateOrderRequest'
  schemas:
    OrderResponse:
      type: object
      properties:
        order:
          type: object
          properties:
            order_id:
              type: string
            client_order_id:
              type: string
              pattern: ^[A-Za-z0-9._:-]{1,64}$
              description: >-
                Your id for the order, unique per account. Retrying with the
                same id never places a second order.
            market_ticker:
              type: string
              pattern: ^[a-z0-9][a-z0-9-]{0,63}-\d{6}-\d{4}-\d{4}(d\d{1,2})?$
              description: >-
                Market ticker (one window of a series), e.g.
                "btc-15m-261002-1400-1415". Opaque.
            outcome:
              type: string
              enum:
                - up
                - down
            action:
              type: string
              enum:
                - buy
                - sell
            price:
              type: string
              pattern: ^0\.(0[1-9]|[1-9]\d)$
              description: 'Contract price in dollars, "0.01"–"0.99" (v1: whole cents).'
            time_in_force:
              type: string
              enum:
                - good_till_canceled
                - immediate_or_cancel
              description: >-
                good_till_canceled: what doesn't fill rests on the book until it
                fills, you cancel it or the window closes. immediate_or_cancel:
                fills what it can now; the rest is cancelled.
            post_only:
              type: boolean
            status:
              type: string
              enum:
                - resting
                - executed
                - canceled
            count:
              type: string
              pattern: ^(0|[1-9]\d*)$
              description: 'Contracts, as a string (v1: whole contracts).'
            fill_count:
              type: string
              pattern: ^(0|[1-9]\d*)$
              description: 'Contracts, as a string (v1: whole contracts).'
            remaining_count:
              type: string
              pattern: ^(0|[1-9]\d*)$
              description: 'Contracts, as a string (v1: whole contracts).'
            average_fill_price:
              type: string
            fees_paid:
              type: string
            created_ts_ms:
              type: integer
              minimum: 0
              maximum: 9007199254740991
              description: Epoch milliseconds (UTC).
          required:
            - order_id
            - client_order_id
            - market_ticker
            - outcome
            - action
            - price
            - time_in_force
            - post_only
            - status
            - count
            - fill_count
            - remaining_count
            - created_ts_ms
          additionalProperties: false
      required:
        - order
      additionalProperties: false
    Error:
      type: object
      properties:
        code:
          type: string
          enum:
            - BAD_REQUEST
            - NOT_FOUND
            - SERIES_NOT_FOUND
            - MARKET_NOT_FOUND
            - METHOD_NOT_ALLOWED
            - RATE_LIMITED
            - UNAUTHORIZED
            - FORBIDDEN
            - ORDER_NOT_FOUND
            - IDEMPOTENCY_CONFLICT
            - ACCOUNT_BUSY
            - MARKET_NOT_OPEN
            - INSUFFICIENT_BALANCE
            - LIMIT_EXCEEDED
            - POST_ONLY_CROSS
            - SELF_TRADE
            - TRADING_PAUSED
            - ORDER_REJECTED
            - INTERNAL_ERROR
            - EXCHANGE_UNAVAILABLE
        message:
          type: string
        details:
          type: string
      required:
        - code
        - message
      additionalProperties: false
    CreateOrderRequest:
      type: object
      properties:
        market_ticker:
          type: string
          pattern: ^[a-z0-9][a-z0-9-]{0,63}-\d{6}-\d{4}-\d{4}(d\d{1,2})?$
          description: >-
            Market ticker (one window of a series), e.g.
            "btc-15m-261002-1400-1415". Opaque.
        outcome:
          type: string
          enum:
            - up
            - down
        action:
          type: string
          enum:
            - buy
            - sell
        price:
          type: string
          pattern: ^0\.(0[1-9]|[1-9]\d)$
          description: 'Contract price in dollars, "0.01"–"0.99" (v1: whole cents).'
        count:
          type: string
          pattern: ^(0|[1-9]\d*)$
          description: 'Contracts, as a string (v1: whole contracts).'
        time_in_force:
          default: good_till_canceled
          type: string
          enum:
            - good_till_canceled
            - immediate_or_cancel
          description: >-
            good_till_canceled: what doesn't fill rests on the book until it
            fills, you cancel it or the window closes. immediate_or_cancel:
            fills what it can now; the rest is cancelled.
        post_only:
          default: false
          type: boolean
        client_order_id:
          type: string
          pattern: ^[A-Za-z0-9._:-]{1,64}$
          description: >-
            Your id for the order, unique per account. Retrying with the same id
            never places a second order.
      required:
        - market_ticker
        - outcome
        - action
        - price
        - count
        - client_order_id
      additionalProperties: false
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        An API key from your account: `Authorization: Bearer
        udk_<live|test>_<id>_<secret>`.

````

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