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

# Create order

> Creates a new order.

<Tabs groupId="programming-language">
  <Tab value="Java" title="Java">
    ```java theme={null}
    OrdersService ordersService = IntxServiceFactory.createOrdersService(client);
    CreateOrderRequest request = new CreateOrderRequest.Builder()
        .instrument("BTC-PERP")
        .side("BUY")
        .size("0.0001")
        .orderType("LIMIT")
        .price("50000")
        .tif("GTC")
        .clientOrderId("1234567890")
        .build();
    CreateOrderResponse response = ordersService.createOrder(request);
    ```

    For more information, please visit the [INTX Java SDK](https://github.com/coinbase-samples/intx-sdk-java).
  </Tab>

  <Tab value=".NET" title=".NET">
    ```cs theme={null}
    var ordersService = new OrdersService(client);
    var request = new CreateOrderRequest(
        Instrument: "BTC-PERP",
        Side: "BUY",
        Size: "0.0001",
        OrderType: "LIMIT",
        Price: "50000",
        Tif: "GTC",
        ClientOrderId: "1234567890",
    );
    var response = ordersService.CreateOrder(request);
    ```

    For more information, please visit the [INTX .NET SDK](https://github.com/coinbase-samples/intx-sdk-dotnet).
  </Tab>

  <Tab value="Go" title="Go">
    ```go theme={null}
    ordersSvc := orders.NewOrdersService(client)
    request := &orders.CreateOrderRequest{
        Instrument: "BTC-PERP",
        Side: "BUY",
        Size: "0.0001",
        OrderType: "LIMIT",
        Price: "50000",
        Tif: "GTC",
        ClientOrderId: "1234567890",
    }
    response, err := ordersSvc.CreateOrder(context.Background(), request)
    ```

    For more information, please visit the [INTX Go SDK](https://github.com/coinbase-samples/intx-sdk-go).
  </Tab>

  <Tab value="Python" title="Python">
    ```python theme={null}
    client = IntxClient()
    request = CreateOrderRequest(
        instrument="BTC-PERP",
        side="BUY",
        size="0.0001",
        order_type="LIMIT",
        price="50000",
        tif="GTC",
        client_order_id="1234567890",
    )
    response = client.create_order(request)
    ```

    For more information, please visit the [INTX Python SDK](https://github.com/coinbase-samples/intx-sdk-py).
  </Tab>

  <Tab value="Typescript" title="TS/JS">
    ```js theme={null}
    const ordersService = new OrdersService(client);

    ordersService.getOrder({
        clientOrderId: 'CLIENT_ORDER_ID_HERE',
        instrument: 'ETH-PERP',
        side: OrderSide.BUY,
        size: '0.001',
        orderType: OrderType.LIMIT,
        tif: TimeInForce.GTC,
        price: '4000',
    }).then(async (response) => {
        console.log('Order Created: ', response);
    })
    ```

    For more information, please visit the [INTX TS SDK](https://github.com/coinbase-samples/intx-sdk-ts).
  </Tab>

  <Tab value="CLI" title="CLI">
    ```
    intxctl create-order --help
    ```

    For more information, please visit the [INTX CLI](https://github.com/coinbase-samples/intx-cli).
  </Tab>
</Tabs>


## OpenAPI

````yaml POST /api/v1/orders
openapi: 3.0.3
info:
  title: REST API
  description: >
    # Welcome to Coinbase INTX API

    ## Introduction

    The INTX APIs allow institutions to trade and manage orders on the
    International Exchange. The following API pages detail various REST API
    endpoints we offer.

    ## Getting Started

    To get started, please visit one of the following pages:

    - [Quickstart](/international-exchange/introduction/quickstart)

    -
    [Overview](/api-reference/international-exchange-api/rest-api/introduction)

    -
    [Authentication](/api-reference/international-exchange-api/rest-api/authentication)

    - [Rate Limits](/international-exchange/introduction/rate-limits-overview)

    ## FIX API

    - [FIX API reference](/international-exchange/fix-api/fix-api-overview)

    ## WebSocket API

    - [WebSocket API
    reference](/international-exchange/websocket-feed/websocket-overview)
  version: '1.0'
servers:
  - url: https://api.international.coinbase.com
security: []
paths:
  /api/v1/orders:
    post:
      tags:
        - Orders
      summary: Create order
      description: Creates a new order.
      operationId: createOrder
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - client_order_id
                - side
                - size
                - tif
                - type
                - instrument
              properties:
                client_order_id:
                  description: >-
                    A unique identifier assigned by the client. Must meet one of
                    the following constraints:
                     - 18 characters long using all ASCII characters
                     - 20 characters long using alphanumeric characters and dash (-)
                     - 31 characters long using hexadecimal characters (0-9, a-f, lowercase and no preceding 0s)
                     - A UUID using standard hyphenation and all lowercase (e.g., 36a9d3ee-32b7-460e-979a-121735af4824)
                  type: string
                side:
                  $ref: '#/components/schemas/OrderSide'
                size:
                  description: The amount in base asset units
                  type: string
                tif:
                  $ref: '#/components/schemas/TimeInForce'
                  description: >-
                    The time in force applied to an order. A Good Till Cancel
                    (GTC) or Good Till Time (GTT) can last up to 30 days. An
                    Immediate or Cancel (IOC) attempts to fill as much of the
                    order as possible and/or cancels immediately when no resting
                    orders meet or improve the order's price limit. A Fill or
                    Kill (FOK) is canceled without filling if it does not
                    completely fill immediately. Required for all order types
                    except market orders.
                instrument:
                  description: >-
                    The name, ID, or UUID of the instrument the order wants to
                    transact
                  type: string
                type:
                  $ref: '#/components/schemas/OrderType'
                  description: The type of order being submitted
                price:
                  description: >-
                    The max or min price limit in quote asset units to buy or
                    sell at (respectively). Only used for limit and stop limit
                    order types.
                  type: string
                stop_price:
                  description: The market price that activates a stop order
                  type: string
                stop_limit_price:
                  description: >-
                    The limit price at which the TP/SL stop leg order will be
                    placed. Only used for TP/SL order type.
                  type: string
                expire_time:
                  description: >-
                    The expiration time required for orders with the time in
                    force set to GTT. Must not go beyond 30 days of the current
                    time. Uses ISO-8601 format (e.g., 2023-03-16T23:59:53Z).
                  type: string
                  format: date-time
                portfolio:
                  description: >-
                    The ID or UUID of the portfolio the order belongs to (uses
                    default portfolio if not defined)
                  type: string
                stp_mode:
                  $ref: '#/components/schemas/SelfTradePreventionMode'
                  description: >-
                    Specifies the behavior for self match handling. None
                    disables the functionality, new cancels the newest order,
                    and both cancels both orders.
                post_only:
                  description: Only submit the order if it will rest on the order book
                  type: boolean
                close_only:
                  description: Only submit the order if it will close an existing order
                  type: boolean
                algo_strategy:
                  $ref: '#/components/schemas/AlgoStrategy'
                  description: The algorithmic trading strategy to use for the order
      responses:
        '200':
          description: Order submitted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrderResult_v1'
        '400':
          description: Invalid attribute
      security:
        - auth_client_id: []
          auth_passphrase: []
          auth_signature: []
          auth_timestamp: []
components:
  schemas:
    OrderSide:
      description: The side of the transaction
      type: string
      enum:
        - BUY
        - SELL
      example: BUY
    TimeInForce:
      description: >-
        The time in force applied to an order. A Good Till Cancel (GTC) can last
        up to 30 days. An Immediate or Cancel (IOC) attempts to fill as much of
        the order as possible and/or cancels immediately when no resting orders
        meet or improve the order's price limit. A Fill or Kill (FOK) is
        canceled without filling if it does not completely fill immediately.
        This will not be populated for assignments
      type: string
      enum:
        - GTC
        - IOC
        - GTT
        - FOK
      example: GTC
    OrderType:
      description: The type of the order
      type: string
      enum:
        - LIMIT
        - MARKET
        - STOP_LIMIT
        - STOP
        - TAKE_PROFIT_STOP_LOSS
      example: LIMIT
    SelfTradePreventionMode:
      description: >-
        Specifies the behavior for self match handling. None disables the
        functionality, new cancels the newest order, and both cancels both
      type: string
      enum:
        - NONE
        - AGGRESSING
        - RESTING
        - BOTH
        - DECREMENT_AND_CANCEL
      example: AGGRESSING
    AlgoStrategy:
      description: Specifies the algorithmic trading strategy for the order
      type: string
      enum:
        - TWAP
      example: TWAP
    OrderResult_v1:
      type: object
      properties:
        order_id:
          description: A unique identifier assigned by the exchange
          type: string
          example: 43877033468085760
        client_order_id:
          description: A unique identifier assigned by the client
          type: string
          example: ABC123
        side:
          $ref: '#/components/schemas/OrderSide'
        instrument_id:
          description: >-
            The unique identifier of the instrument the order wants to transact
            in
          type: string
          example: 2562519737567269
        instrument_uuid:
          description: The UUID of the instrument the order wants to transact in
          type: string
          format: uuid
          example: 359f66d8-4235-47c3-9733-0fbfe2cfaa0a
        symbol:
          description: The name of the instrument the order wants to transact in
          type: string
          example: BTC-PERP
        portfolio_id:
          description: The unique identifier of the portfolio the order was submitted under
          type: string
          format: string
          example: 1724343681801273
        portfolio_uuid:
          description: The UUID of the portfolio the order was submitted under
          type: string
          format: uuid
          example: b80ec69b-1229-4bcf-a6a8-c506ffd74c20
        type:
          $ref: '#/components/schemas/OrderType'
        price:
          description: >-
            The max or min price limit in quote asset units to buy or sell at
            (respectively). Only used for limit and stop limit order types.
          type: string
          example: 20215.53
        stop_price:
          description: The market price that activates a stop order
          type: string
          example: 20015.53
        stop_limit_price:
          description: >-
            The limit price at which the TP/SL stop leg order will be placed.
            Only used for TP/SL order type.
          type: string
          example: 20015.53
        size:
          description: The amount in base asset units
          type: string
          example: 1.5423
        tif:
          $ref: '#/components/schemas/TimeInForce'
        expire_time:
          description: >-
            The expiration time for orders with the time in force set to GTT.
            Uses ISO-8601 format (e.g., 2023-03-16T23:59:53Z).
          type: string
          format: date-time
          example: '2023-03-16T23:59:53.000Z'
        stp_mode:
          $ref: '#/components/schemas/SelfTradePreventionMode'
        event_type:
          $ref: '#/components/schemas/OrderEventType'
        event_time:
          type: string
          format: date-time
          example: '2023-03-16T23:59:53.000Z'
        submit_time:
          type: string
          format: date-time
          example: '2023-03-16T23:59:53.000Z'
        order_status:
          $ref: '#/components/schemas/OrderStatus'
        leaves_qty:
          description: The amount of the order remaining open on the exchange
          type: string
        exec_qty:
          description: The traded quantity on the order
          type: string
        avg_price:
          description: The average price that the order has traded at so far
          type: string
        fee:
          description: The exchange fee affiliated with the trade (only for trade events)
          type: string
        post_only:
          description: >-
            Indicates that the order was submitted with the `post_only`
            instruction
          type: boolean
        close_only:
          description: >-
            Indicates that the order was submitted with the `close_only`
            instruction
          type: boolean
        algo_strategy:
          $ref: '#/components/schemas/AlgoStrategy'
        text:
          description: A text message that gets populated for canceled orders
          type: string
          example: client cancel
    OrderEventType:
      description: The most recent type of event that happened to the order
      type: string
      enum:
        - NEW
        - TRADE
        - CANCELED
        - REPLACED
        - PENDING_CANCEL
        - REJECTED
        - PENDING_NEW
        - EXPIRED
        - PENDING_REPLACE
        - STOP_TRIGGERED
      example: TRADE
    OrderStatus:
      description: The type of the order
      type: string
      enum:
        - WORKING
        - DONE
      example: WORKING
  securitySchemes:
    auth_client_id:
      type: apiKey
      name: CB-ACCESS-KEY
      in: header
      description: The Client ID that owns the API Key for the request
    auth_passphrase:
      type: apiKey
      name: CB-ACCESS-PASSPHRASE
      in: header
      description: The pass phrase affiliated with the API Key
    auth_signature:
      type: apiKey
      name: CB-ACCESS-SIGN
      in: header
      description: >-
        A HMAC SHA-256 signature using the API Key secret on the string
        TIMESTAMP, METHOD, REQUEST_PATH, BODY
    auth_timestamp:
      type: apiKey
      name: CB-ACCESS-TIMESTAMP
      in: header
      description: The timestamp of when the request is being made

````