---
title: "Create Batched Orders"
method: POST
path: "/v1/perps/orders/batch"
tags: ["Orders"]
---

# Create Batched Orders

`POST /v1/perps/orders/batch`

Creates multiple orders in a single API call. Some orders may succeed while others fail. The response code is 2XX as long as there is no internal server error. Returns 400 with `error_code=batch_order_empty` if the `orders` array is empty. Returns 400 with `error_code=batch_order_too_many_orders` if too many orders are provided (max 20). For the available order types and their behavior, see [Order types](/order-types).

## Request body

- BatchAddOrderReq
  - `orders` AddOrderReq[], required — Array of order requests. Must have at least 1 element and at most 20.
    - `side` 'buy' | 'sell', required — buy or sell
    - `price` string — Limit price. Must be aligned with quoteIncrement from /v1/markets. Omit for market orders.
    - `size` string — Order quantity in base currency. Used for both limit and market orders. Must be aligned with baseIncrement from /v1/markets.
    - `quoteSize` string — Order quantity in quote currency. Can only be set for market order buys.
    - `market` string, required — Trading market pair
    - `clientOrderId` string — Optional client-provided order ID. Must be alphanumeric including underscores and dashes, and at most 64 characters.
    - `type` 'limit' | 'market' — Order type. Defaults to "limit".
    - `timeInForce` 'GTC' | 'IOC' — "GTC" (Good until cancelled) or "IOC" (Immediate or cancel). Cannot be set for market orders. Defaults to "GTC".
    - `postOnly` boolean — If true, the order is rejected if it would match at placement. Returns 400 with error `post_only_has_match` if it would match.
    - `reduceOnly` boolean — If true, the order can only reduce an existing position.
    - `takeProfit` StopOrderReq
      - `triggerPrice` string, required — Trigger price for the stop order
    - `stopLoss` StopOrderReq
      - `triggerPrice` string, required — Trigger price for the stop order

## Response `200`

Batch order result

- object
  - `success` boolean, required — Whether the request was successful
  - `error` string — Error message, present only on failure
  - `error_code` string — Semantic error code. See each endpoint's error responses for the specific codes it can return.
  - `deprecated` string — Deprecation notice, if applicable
  - `result` BatchAddOrderRes
    - `addedOrders` ApiOrder[] — Orders that were successfully added
      - `orderId` string, required — Internal order ID
      - `clientOrderId` string — Client-provided order ID (if set)
      - `parentOrderId` string — Parent order ID (e.g. for TWAP child orders)
      - `side` 'buy' | 'sell', required — buy or sell
      - `price` string, required — Limit price
      - `size` string, required — Order quantity in base currency
      - `market` string, required — Trading market
      - `filledSize` string, required — Quantity of the order that has been filled
      - `lastFillSize` string, required — Quantity filled in the most recent trade
      - `filledCost` string, required — Cost of the filled portion of the order (filledSize × fill price)
      - `realizedPnl` string — Realized PNL for this order (perps only)
      - `fee` string, required — Fees incurred on this order
      - `feeRebate` string — Fee rebate earned on this order (perps only)
      - `status` 'open' | 'fullyfilled' | 'canceled' | 'pending' | 'untriggered', required — Order status
      - `createdAt` string, date-time, required — Order creation time
      - `filledAt` string, date-time — Time when the order was fully filled (if applicable)
      - `canceledAt` string, date-time — Order cancellation time (if cancelled)
      - `cancelReason` '' | 'liquidation' | 'selfMatchPrevention' | 'cancelAfterTimeout' | 'startupBadPrice' | 'immediateOrCancel' | 'cancelAfterTimeoutOnShutdown' | 'cancelOnStartup' | 'cancelByAdmin' | 'positionClosed' | 'stopOrderPositionNeutral' | 'stopOrderPositionDirectionMismatch' | 'stopOrderInLiquidation' | 'stopOrderInternalError' — Reason the order was cancelled. Possible values: "" (user cancelled), "liquidation", "selfmatchprevention", "cancelaftertimeout", "startupbadprice", "immediateorcancel"
      - `type` 'limit' | 'market' | 'stopMarket' | 'takeProfitMarket', required — Order type
      - `timeInForce` 'GTC' | 'IOC' — Time in force (GTC or IOC). Not returned for market orders.
      - `reduceOnly` boolean — Whether the order is reduce-only
      - `liquidationId` string — ID of the liquidation event this order participated in (perps only)
      - `closePosition` boolean — True if this is a position-level TP/SL order
      - `stopOrderType` 'stopLoss' | 'takeProfit' — Stop order type (stopLoss or takeProfit), if applicable
      - `triggerPrice` string — Trigger price for stop orders
    - `failedOrders` ErroredAddOrderReq[] — Orders that were not added and the reason why
      - `order` AddOrderReq
        - `side` 'buy' | 'sell', required — buy or sell
        - `price` string — Limit price. Must be aligned with quoteIncrement from /v1/markets. Omit for market orders.
        - `size` string — Order quantity in base currency. Used for both limit and market orders. Must be aligned with baseIncrement from /v1/markets.
        - `quoteSize` string — Order quantity in quote currency. Can only be set for market order buys.
        - `market` string, required — Trading market pair
        - `clientOrderId` string — Optional client-provided order ID. Must be alphanumeric including underscores and dashes, and at most 64 characters.
        - `type` 'limit' | 'market' — Order type. Defaults to "limit".
        - `timeInForce` 'GTC' | 'IOC' — "GTC" (Good until cancelled) or "IOC" (Immediate or cancel). Cannot be set for market orders. Defaults to "GTC".
        - `postOnly` boolean — If true, the order is rejected if it would match at placement. Returns 400 with error `post_only_has_match` if it would match.
        - `reduceOnly` boolean — If true, the order can only reduce an existing position.
        - `takeProfit` StopOrderReq
          - `triggerPrice` string, required — Trigger price for the stop order
        - `stopLoss` StopOrderReq
          - `triggerPrice` string, required — Trigger price for the stop order
      - `error` string — Error message explaining why the order failed
      - `errorCode` string — Semantic error code, empty if not a semantic error

## Other responses

- `400` — Bad request. The request was malformed or failed validation.
- `401` — Authentication required. Provide a valid JWT or API key.
- `403` — Access denied. The authenticated account does not have permission.
- `429` — Rate limit exceeded. Slow down request frequency.
- `500` — Internal server error.

---

[API](https://skmtc.net/ondoperps/apis/ondo-perps-rest-api.md) · [All operations](https://skmtc.net/ondoperps/apis/ondo-perps-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/ondoperps/ondo-perps-rest-api/versions/39df6b2fa672/schema)
