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

# Place an order

> Submits a limit or market order. Requires TRADE permission.



## OpenAPI

````yaml /api-reference/derivatives-predictions-api/rest-api/cpm-spec.json post /api/orders
openapi: 3.0.3
info:
  title: CPM Public REST API
  version: 0.1.0
servers:
  - url: https://api.example.com
    variables: {}
security:
  - auth_api_key: []
  - auth_timestamp: []
  - auth_passphrase: []
  - auth_signature: []
paths:
  /api/orders:
    post:
      tags:
        - Orders
      summary: Place an order
      description: Submits a limit or market order. Requires TRADE permission.
      operationId: placeOrder
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlaceOrderRequest'
        required: false
      responses:
        '200':
          description: Order accepted. A 200 is returned only for accepted orders.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlaceOrderResponse'
        '400':
          description: Order rejected. The error field carries the reject reason.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderErrorResponse'
      deprecated: false
      security: []
components:
  schemas:
    PlaceOrderRequest:
      type: object
      additionalProperties: false
      properties:
        instrument_id:
          type: string
          description: >-
            Id of the instrument to trade, as a canonical decimal string.
            Tickers and JSON numbers are rejected.
          example: '598471892347'
        firm_id:
          type: string
          nullable: true
          description: >-
            Id of the firm the order is for, as a canonical decimal string.
            Required for FCM-level API keys, and must be a firm under your FCM.
            A FIRM-level key may omit it or send its own firm id.
          example: '298471892342'
        side:
          type: string
          description: >-
            Order side. BUY and SELL trade the YES contract. BUY_NO and SELL_NO
            trade the NO side and are booked as SELL or BUY of YES at one minus
            the price. BUY_NO and SELL_NO are REST only: FIX order entry accepts
            only Buy and Sell, so FIX clients convert NO orders themselves
            (BUY_NO at price P is SELL at 1 minus P).
          example: BUY
        price:
          type: string
          nullable: true
          description: >-
            Limit price per contract in USDC, as a decimal string strictly
            between 0 and 1 that aligns to the instrument's tick size. Omit or
            send null for a market order. For BUY_NO and SELL_NO it is the NO
            price and is required.
          example: '0.590'
        quantity:
          type: string
          description: Number of contracts to trade, as a positive decimal string.
          example: '25.00'
        time_in_force:
          type: string
          description: >-
            How long the order stays active: GTC rests until filled or canceled,
            IOC fills what it can immediately and cancels the rest, FOK fills
            completely at once or is rejected. Market orders run as IOC unless
            you send FOK.
          example: GTC
        client_order_id:
          type: string
          description: >-
            Your identifier for the order: at most 18 printable ASCII
            characters, or a 36-character lowercase UUID. Must be unique among
            your active orders.
          example: ord-100
        sub_account:
          type: string
          description: >-
            Sub-account the order and any resulting position belong to, in the
            same format as client_order_id. A new sub-account is created on
            first use.
          example: fund-a
        post_only:
          type: boolean
          nullable: true
          description: >-
            If true, the order only adds liquidity. An order that would cross
            the book rests at the best non-crossing price instead, unless
            post_only_reject is true. Not allowed on market orders.
          example: false
        post_only_reject:
          type: boolean
          nullable: true
          description: >-
            If true, the order only adds liquidity and is rejected with
            POST_ONLY_WOULD_CROSS if it would cross the book. Not allowed on
            market orders.
          example: false
        self_match_prevention_id:
          type: integer
          format: int32
          nullable: true
          description: >-
            Optional positive self-match prevention id. An incoming order does
            not match a resting order that carries the same id;
            self_match_prevention_mode decides which order is canceled.
          example: 7
        self_match_prevention_mode:
          type: string
          nullable: true
          description: >-
            Which order to cancel when self-match prevention triggers:
            CANCEL_AGGRESSING, CANCEL_RESTING, or CANCEL_BOTH. When omitted,
            your user or firm default applies.
          example: CANCEL_RESTING
    PlaceOrderResponse:
      type: object
      additionalProperties: false
      properties:
        order_id:
          type: string
          description: Exchange-assigned order id, as a canonical decimal string.
          example: '698471892348'
        status:
          type: string
          description: >-
            Order state when the response was sent: SUBMITTED (resting with no
            fills), PARTIALLY_FILLED, FILLED, or CANCELED (nothing filled and
            the order was canceled, as with an unfilled IOC order).
          example: PARTIALLY_FILLED
        instrument_id:
          type: string
          description: Instrument id, as a canonical decimal string.
          example: '598471892347'
        ticker:
          type: string
          description: Instrument ticker.
          example: NFL-GAMEWINNER-26NOV28LARSF-LAR
        side:
          type: string
          description: >-
            Side as booked: BUY or SELL of the YES contract. BUY_NO and SELL_NO
            orders appear here as SELL and BUY.
          example: BUY
        original_side:
          type: string
          description: Side as you submitted it, including BUY_NO or SELL_NO.
          example: BUY
        price:
          type: string
          nullable: true
          description: >-
            Limit price of the YES order as booked, in USDC, as a decimal
            string. For BUY_NO and SELL_NO it is one minus the price you sent.
            Null for a market order.
          example: '0.590000'
        quantity:
          type: string
          description: Order quantity in contracts, as a decimal string.
          example: '25.00'
        filled_quantity:
          type: string
          description: >-
            Quantity filled by the time of the response, in contracts, as a
            decimal string.
          example: '10.00'
        remaining_quantity:
          type: string
          description: >-
            Quantity not filled by the time of the response, in contracts, as a
            decimal string.
          example: '15.00'
        time_in_force:
          type: string
          description: Time in force you submitted.
          example: GTC
        client_order_id:
          type: string
          description: Echo of the client order id from the request.
          example: ord-100
        sub_account:
          type: string
          description: Echo of the sub-account from the request.
          example: fund-a
        fills:
          type: array
          items:
            $ref: '#/components/schemas/FillResponse'
          nullable: true
          description: >-
            Fills that executed before the response was sent, or null if there
            were none.
        reject_reason:
          type: string
          nullable: true
          description: >-
            Always null. A rejected order returns an error response instead of
            this object.
    OrderErrorResponse:
      type: object
      additionalProperties: false
      properties:
        error:
          type: string
          description: >-
            Machine-readable error code, for example INVALID_FIELD,
            INSUFFICIENT_BALANCE, or UNAUTHORIZED.
          example: INVALID_FIELD
        message:
          type: string
          description: Human-readable description of the error.
          example: 'side must be one of: BUY, SELL, BUY_NO, SELL_NO'
    FillResponse:
      type: object
      additionalProperties: false
      properties:
        trade_id:
          type: string
          description: Trade id, as a canonical decimal string.
          example: '798471892349'
        price:
          type: string
          description: Trade price per YES contract in USDC, as a decimal string.
          example: '0.590000'
        quantity:
          type: string
          description: Filled quantity in contracts, as a decimal string.
          example: '10.00'
        fee:
          type: string
          description: >-
            Your fee for this fill in USDC, as a decimal string. A negative
            value is a rebate.
          example: '0.170000'
        role:
          type: string
          description: TAKER if your order took liquidity, MAKER if it was resting.
          example: TAKER
  securitySchemes:
    auth_api_key:
      name: CB-ACCESS-KEY
      description: The API key string for the request
      in: header
      type: apiKey
    auth_timestamp:
      name: CB-ACCESS-TIMESTAMP
      description: The request timestamp (epoch seconds)
      in: header
      type: apiKey
    auth_passphrase:
      name: CB-ACCESS-PASSPHRASE
      description: The passphrase for the API key
      in: header
      type: apiKey
    auth_signature:
      name: CB-ACCESS-SIGN
      description: HMAC SHA-256 signature over TIMESTAMP + METHOD + REQUEST_PATH + BODY
      in: header
      type: apiKey

````