> For the complete documentation index, see [llms.txt](https://docs.pangolin.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pangolin.exchange/pangoperps/trading-api/order-management/create-algo-order.md).

# Create Algo Order

Place a triggered order, including stop, take-profit/stop-loss, bracket, and trailing-stop configurations.

### Endpoint

**POST /v1/algo/order**

Mainnet: `POST https://api.orderly.org/v1/algo/order`

Testnet: `POST https://testnet-api.orderly.org/v1/algo/order`

Rate limit: 1 request per second. Use this authenticated endpoint for an order that needs a trigger before it can execute, such as a stop order. The API key must include the trading scope.

A STOP order activates when the market reaches its trigger price, then executes as the selected market or limit type. For positional take-profit/stop-loss orders, use a nested child\_orders structure: the parent represents POSITIONAL\_TP\_SL and each close-position child uses TAKE\_PROFIT or STOP\_LOSS. For a trailing stop, set algo\_type to TRAILING\_STOP, type to MARKET, and provide callbackRate.

### Authentication headers

* orderly-timestamp — signed-request timestamp in milliseconds.
* orderly-account-id — PangoPerps account ID.
* orderly-key — public API key.
* orderly-signature — request signature.
* x-recv-window — optional timeout threshold for placing the order, in milliseconds.
* Content-Type: application/json — JSON request body.

### Request body

The request body is a JSON array of algorithmic order objects. These fields are supported:

| Field                | Type      | Required / constraints                                                                                                          | Description                                                                              |
| -------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| symbol               | string    | Required                                                                                                                        | Market symbol.                                                                           |
| algo\_type           | string    | Required                                                                                                                        | STOP, TP\_SL, POSITIONAL\_TP\_SL, BRACKET, BRACKET + TP\_SL, or TRAILING\_STOP.          |
| type                 | string    | Required; LIMIT or MARKET. Required for STOP orders.                                                                            | Execution order type.                                                                    |
| quantity             | number    | Required for most types; optional for POSITIONAL\_TP\_SL. For MARKET/ASK/BID, it may be omitted when order\_amount is supplied. | Order size.                                                                              |
| side                 | string    | Required for STOP; BUY or SELL.                                                                                                 | Order direction.                                                                         |
| child\_orders        | object\[] | Required                                                                                                                        | Nested trigger or child-order definitions.                                               |
| client\_order\_id    | string    | Optional; up to 36 characters, may contain hyphens but cannot start with one.                                                   | Client-assigned ID.                                                                      |
| price                | number    | Optional for TP\_SL and POSITIONAL\_TP\_SL.                                                                                     | Limit price where applicable.                                                            |
| trigger\_price\_type | string    | Optional; MARK\_PRICE is currently supported.                                                                                   | Price source used to evaluate a trigger.                                                 |
| trigger\_price       | number    | Optional                                                                                                                        | Price that activates the order or child.                                                 |
| reduce\_only         | boolean   | Optional                                                                                                                        | Restrict the order to reducing an existing position.                                     |
| visible\_quantity    | boolean   | Optional; defaults to false in this endpoint schema.                                                                            | Visibility setting listed for algo-order requests.                                       |
| order\_tag           | string    | Optional; maximum 128 characters; immutable after placement.                                                                    | Referral or custom-fee tag. For PangoPerps custom fees, use enum:pangoperps:\<enum\_id>. |
| activatedPrice       | string    | For TRAILING\_STOP                                                                                                              | Activation price for the trailing stop.                                                  |
| callbackRate         | string    | For TRAILING\_STOP                                                                                                              | Trailing rate; 0.1 represents 10%.                                                       |
| callbackValue        | string    | For TRAILING\_STOP                                                                                                              | Trailing callback value.                                                                 |
| margin\_mode         | enum      | Optional; CROSS or ISOLATED. Defaults to the symbol's current setting.                                                          | Margin mode for the order.                                                               |

Each child order can include its own symbol, algo\_type, side, type, price, trigger\_price, trigger\_price\_type, quantity, reduce\_only, and further child\_orders, depending on the chosen order structure.

### Example request: bracket with positional take-profit and stop-loss

```bash
curl --request POST \
  --url 'https://api.orderly.org/v1/algo/order' \
  --header 'Content-Type: application/json' \
  --header 'orderly-account-id: <account-id>' \
  --header 'orderly-key: <public-api-key>' \
  --header 'orderly-signature: <signature>' \
  --header 'orderly-timestamp: <timestamp-in-ms>' \
  --data '[
    {
      "symbol": "PERP_ETH_USDC",
      "algo_type": "BRACKET",
      "quantity": 0.25,
      "side": "BUY",
      "type": "LIMIT",
      "price": 3450.5,
      "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_type": "MARK_PRICE",
              "trigger_price": 3600,
              "reduce_only": true
            },
            {
              "symbol": "PERP_ETH_USDC",
              "algo_type": "STOP_LOSS",
              "side": "SELL",
              "type": "CLOSE_POSITION",
              "trigger_price_type": "MARK_PRICE",
              "trigger_price": 3300,
              "reduce_only": true
            }
          ]
        }
      ]
    }
  ]'
```

### Successful response

### Additional request example: standalone TP/SL orders

HTTP 200 returns an order identifier and summary fields for the accepted algo order.

```json
[
  {
    "symbol": "PERP_ETH_USDC",
    "algo_type": "TP_SL",
    "quantity": 0.25,
    "trigger_price_type": "MARK_PRICE",
    "child_orders": [
      {
        "symbol": "PERP_ETH_USDC",
        "algo_type": "TAKE_PROFIT",
        "side": "SELL",
        "type": "MARKET",
        "trigger_price": 3600,
        "reduce_only": true
      },
      {
        "symbol": "PERP_ETH_USDC",
        "algo_type": "STOP_LOSS",
        "side": "SELL",
        "type": "MARKET",
        "trigger_price": 3300,
        "reduce_only": true
      }
    ]
  },
  {
    "symbol": "PERP_ETH_USDC",
    "algo_type": "POSITIONAL_TP_SL",
    "trigger_price_type": "MARK_PRICE",
    "child_orders": [
      {
        "symbol": "PERP_ETH_USDC",
        "algo_type": "TAKE_PROFIT",
        "side": "SELL",
        "type": "CLOSE_POSITION",
        "trigger_price_type": "MARK_PRICE",
        "trigger_price": 3600,
        "reduce_only": true
      },
      {
        "symbol": "PERP_ETH_USDC",
        "algo_type": "STOP_LOSS",
        "side": "SELL",
        "type": "CLOSE_POSITION",
        "trigger_price_type": "MARK_PRICE",
        "trigger_price": 3300,
        "reduce_only": true
      }
    ]
  }
]
```

```json
{
  "success": true,
  "data": {
    "order_id": 123456789,
    "client_order_id": "pango-algo-001",
    "algo_type": "STOP",
    "quantity": 0.25
  },
  "timestamp": 1702989203989
}
```
