---
title: "Create TWAP Order"
method: POST
path: "/v1/perps/twap/order"
tags: ["TWAP Orders"]
---

# Create TWAP Order

`POST /v1/perps/twap/order`

Creates a new TWAP (Time-Weighted Average Price) order. The order is split into child orders placed at regular intervals over the specified running time. Running time must be between 5 minutes and 24 hours and a multiple of the frequency. The number of child orders (runningTime / frequency) must be between 2 and 200. For how TWAP execution works, see [TWAP orders](/time-weighted-average-price).

## Request body

- CreateTWAPOrderReq
  - `market` string, required — Perps trading market
  - `side` 'buy' | 'sell', required — Order side
  - `size` string, required — Total order size in base currency to execute over the TWAP duration
  - `runningTime` integer, required — Total duration of the TWAP order in seconds. Must be between 300 (5 minutes) and 86400 (24 hours) and a multiple of `frequency`.
  - `frequency` integer, required — Interval between child orders in seconds. runningTime / frequency gives the number of child orders, which must be between 2 and 200.
  - `reduceOnly` boolean — If true, child orders are reduce-only
  - `maxPrice` string — Maximum allowed price for child orders. Child orders will not be placed above this price.
  - `minPrice` string — Minimum allowed price for child orders. Child orders will not be placed below this price.

## Response `200`

Created TWAP order

- 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` TWAPOrderApiResp
    - `twapId` string, required — TWAP order ID
    - `market` string, required — Perps market
    - `side` 'buy' | 'sell', required — Order side
    - `startTime` string, date-time, required — Time the TWAP order was created
    - `finishTime` string, date-time — Time the TWAP order completed or was cancelled (omitted if still running)
    - `runningTime` integer, required — Total duration of the TWAP order in seconds
    - `frequency` integer, required — Interval between child orders in seconds
    - `avgFilledPrice` string, required — Volume-weighted average fill price across all child orders
    - `filledSize` string, required — Total base size filled across all child orders
    - `totalSize` string, required — Total target base size of the TWAP order
    - `totalFees` string, required — Total fees paid across all child orders
    - `orderStatus` string, required — Status of the TWAP order
    - `reduceOnly` boolean, required — Whether child orders are reduce-only
    - `maxPrice` string — Maximum allowed price for child orders (omitted if not set)
    - `minPrice` string — Minimum allowed price for child orders (omitted if not set)
    - `successfulOrders` integer — Number of successfully placed child orders (omitted if zero)
    - `failedOrders` integer — Number of failed child order placements (omitted if zero)
    - `twapCancelReason` 0 | 1 | 2 — Reason the TWAP order was cancelled (only set if cancelled). Values: `0` not cancelled, `1` cancelled by user, `2` cancelled after too many failed child orders.
    - `lastChildOrderError` string — Error code of the last failed child order (only set for running orders, never for historical)

## 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/revisions/39df6b2fa672/schema)
