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

# Create algo order

> **Limit: 1 request per 1 second**

`POST /v1/algo/order`

Place maker/taker order that requires an additional trigger for order execution such as stop orders.

`STOP` type order bahavior: an order to buy or sell at the market/limit price once the asset has traded at or through a specified price (the "stop price"). If the asset reaches the stop price, the order becomes a market order and is filled at the next available market price.

To place `Positional TP/SL` order, the input fields is 2 layer and includes an array of the objects named childOrder. The take-profit or stop-loss order should be the objects in the array. For the sub-order in childOrder, please input `CLOSE_POSITION` as type, and `TAKE_PROFIT` or `STOP_LOSS` in algoType field.
To place `Trailing Stop` order, please use `TRAILING_STOP` as algoType and `MARKET` as type. Please also input your trailing rate setting in callbackRate field.

Sample request can be found [here](/docs/build-on-omnichain/user-flows/algo-order-samples)

Note: This endpoint requires trading scope in orderly key.



## OpenAPI

````yaml orderly.openapi post /v1/algo/order
openapi: 3.0.1
info:
  title: EVM
  description: ''
  version: 1.0.0
servers:
  - url: https://api.orderly.org
    description: Mainnet
  - url: https://testnet-api.orderly.org
    description: Testnet
security: []
tags:
  - name: public
  - name: private
paths:
  /v1/algo/order:
    post:
      tags:
        - private
      summary: Create algo order
      description: >-
        **Limit: 1 request per 1 second**


        `POST /v1/algo/order`


        Place maker/taker order that requires an additional trigger for order
        execution such as stop orders.


        `STOP` type order bahavior: an order to buy or sell at the market/limit
        price once the asset has traded at or through a specified price (the
        "stop price"). If the asset reaches the stop price, the order becomes a
        market order and is filled at the next available market price.


        To place `Positional TP/SL` order, the input fields is 2 layer and
        includes an array of the objects named childOrder. The take-profit or
        stop-loss order should be the objects in the array. For the sub-order in
        childOrder, please input `CLOSE_POSITION` as type, and `TAKE_PROFIT` or
        `STOP_LOSS` in algoType field.

        To place `Trailing Stop` order, please use `TRAILING_STOP` as algoType
        and `MARKET` as type. Please also input your trailing rate setting in
        callbackRate field.


        Sample request can be found
        [here](/docs/build-on-omnichain/user-flows/algo-order-samples)


        Note: This endpoint requires trading scope in orderly key.
      parameters:
        - $ref: '#/components/parameters/orderly_timestamp'
        - $ref: '#/components/parameters/orderly_account_id'
        - $ref: '#/components/parameters/orderly_key'
        - $ref: '#/components/parameters/orderly_signature'
        - $ref: '#/components/parameters/recv_window_header'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                symbol:
                  type: string
                algo_type:
                  type: string
                  description: >-
                    `STOP`/`TP_SL`/`POSITIONAL_TP_SL`/`BRACKET`/`BRACKET +
                    TP_SL`/`TRAILING_STOP`
                client_order_id:
                  type: string
                  description: >-
                    36 length, accepts hyphen but cannot be the first character,
                    default: null
                type:
                  type: string
                  description: '`LIMIT` / `MARKET`, required if `algo_type` = `STOP`'
                price:
                  type: number
                  description: Optional for `TP_SL` and `POSTIONAL_TP_SL`
                quantity:
                  type: number
                  description: >-
                    For `MARKET`/`ASK`/`BID` order, if order_amount is given, it
                    is not required. Not required if type is `POSITIONAL_TP_SL`.
                trigger_price_type:
                  type: string
                  description: Only `MARK_PRICE` is available for now.
                trigger_price:
                  type: number
                reduce_only:
                  type: boolean
                visible_quantity:
                  type: boolean
                  description: Default false
                side:
                  type: string
                  description: '`SELL`/`BUY`, required if `STOP` type'
                order_tag:
                  type: string
                  description: >
                    Optional tag for the order. Supports two formats:

                    - Referral code: plain string (e.g., `REFERRAL2026`) -
                    overrides referral relationship

                    - Order tag fee config: `enum:<enum_id>` (e.g.,
                    `enum:STRATEGY_DCA`) - adds fee on top of existing fees,
                    preserves referral

                    Max length: 36 characters. Cannot be modified after order
                    placement.
                child_orders:
                  type: array
                  items:
                    type: object
                    properties:
                      symbol:
                        type: string
                      algo_type:
                        type: string
                      child_orders:
                        type: array
                        items:
                          $ref: '#/components/schemas/CreateAlgoOrderChildRequest'
                        description: Array of `CreateAlgoOrderChildRequest`
                activatedPrice:
                  type: string
                  description: Activated price for algoType=`TRAILING_STOP`
                callbackRate:
                  type: string
                  description: >-
                    Callback rate, only for algoType=`TRAILING_STOP`, i.e. the
                    value = 0.1 represent to 10%.
                callbackValue:
                  type: string
                  description: >-
                    Callback value, only for algoType=`TRAILING_STOP`, i.e. the
                    value = 100
                margin_mode:
                  type: string
                  description: >-
                    Margin mode for the order. Default: the symbol's current
                    default margin mode.
                  enum:
                    - CROSS
                    - ISOLATED
              example:
                - symbol: PERP_ETH_USDC
                  algo_type: BRACKET
                  quantity: 0.0032
                  side: BUY
                  type: LIMIT
                  price: 3415.9
                  child_orders:
                    - symbol: PERP_ETH_USDC
                      algo_type: POSITIONAL_TP_SL
                      child_orders:
                        - symbol: PERP_ETH_USDC
                          algo_type: TAKE_PROFIT
                          side: SELL
                          type: CLOSE_POSITION
                          trigger_price: 3518.4
                          reduce_only: true
                        - symbol: PERP_ETH_USDC
                          algo_type: STOP_LOSS
                          side: SELL
                          type: CLOSE_POSITION
                          trigger_price: 3313.4
                          reduce_only: true
                - symbol: PERP_NEAR_USDC
                  algo_type: TP_SL
                  quantity: 5.5
                  trigger_price_type: MARK_PRICE
                  child_orders:
                    - symbol: PERP_NEAR_USDC
                      algo_type: TAKE_PROFIT
                      side: SELL
                      type: MARKET
                      trigger_price: 3.365
                      reduce_only: true
                    - symbol: PERP_NEAR_USDC
                      algo_type: STOP_LOSS
                      side: SELL
                      type: MARKET
                      trigger_price: 3.36
                      reduce_only: true
                - symbol: PERP_NEAR_USDC
                  algo_type: POSITIONAL_TP_SL
                  trigger_price_type: MARK_PRICE
                  child_orders:
                    - symbol: PERP_NEAR_USDC
                      algo_type: TAKE_PROFIT
                      side: SELL
                      type: CLOSE_POSITION
                      trigger_price_type: MARK_PRICE
                      trigger_price: 4.05
                      reduce_only: true
                    - symbol: PERP_NEAR_USDC
                      algo_type: STOP_LOSS
                      side: SELL
                      type: CLOSE_POSITION
                      trigger_price_type: MARK_PRICE
                      trigger_price: 3.95
                      reduce_only: true
              required:
                - symbol
                - algo_type
                - quantity
                - side
                - type
                - child_orders
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostAlgoOrderResponse'
      deprecated: false
components:
  parameters:
    orderly_timestamp:
      name: orderly-timestamp
      in: header
      description: Timestamp of the signed request in milliseconds.
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: '1649920583000'
    orderly_account_id:
      name: orderly-account-id
      in: header
      description: Account ID of the authenticated account.
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: 6.858456565150415e+75
    orderly_key:
      name: orderly-key
      in: header
      description: Public orderly key used to sign the request.
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: ed25519:8tm7dnKYkSc3FzgPuJaw1wztr79eeZpN35nHW5pL5XhX
    orderly_signature:
      name: orderly-signature
      in: header
      description: Signature of the request payload generated with the orderly key.
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: >-
        dG4bkKiqG0dUYLzViRZkvbI6Sy239JxAdNMIBxFZ4w030Jofr0ORV06GHtvXZkaZaWUXE+XAU3fnzKN/5fDeBQ==
    recv_window_header:
      name: x-recv-window
      in: header
      description: >-
        Use this parameter to control the timeout threshold for placing order,
        unit in miliseconds
      required: false
      schema:
        type: number
      example: 20
  schemas:
    CreateAlgoOrderChildRequest:
      type: object
      properties:
        symbol:
          type: string
        algo_type:
          type: string
        side:
          type: string
        type:
          type: string
        trigger_price:
          type: number
        price:
          type: number
        reduce_only:
          type: boolean
        trigger_price_type:
          type: string
    PostAlgoOrderResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - required:
            - data
          type: object
          properties:
            data:
              $ref: '#/components/schemas/CreatedAlgoOrder'
    BasicResponse:
      required:
        - success
      type: object
      properties:
        success:
          description: Indicates whether the request was successful.
          type: boolean
          example: true
        timestamp:
          description: Server timestamp in milliseconds.
          type: integer
          example: 1702989203989
    CreatedAlgoOrder:
      type: object
      required:
        - order_id
        - client_order_id
        - algo_type
        - quantity
      properties:
        order_id:
          type: number
          example: 13
        client_order_id:
          type: string
          example: testclientid
        algo_type:
          type: string
          example: STOP
        quantity:
          type: number
          example: 100.12

````