v1

latestOpenAPI 3.0.32026-07-267278168.1 KB
Orders

Create Order

Creates a limit or market order. Change the "type" field to switch between order types. If postOnly is true and an order would match at placement, a 400 is returned with error post_only_has_match. For the available order types and their behavior, see Order types.

post/v1/perps/orders

Request body

side'buy' | 'sell' required

buy or sell

pricestring

Limit price. Must be aligned with quoteIncrement from /v1/markets. Omit for market orders.

sizestring

Order quantity in base currency. Used for both limit and market orders. Must be aligned with baseIncrement from /v1/markets.

quoteSizestring

Order quantity in quote currency. Can only be set for market order buys.

marketstring required

Trading market pair

clientOrderIdstring

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

postOnlyboolean

If true, the order is rejected if it would match at placement. Returns 400 with error post_only_has_match if it would match.

reduceOnlyboolean

If true, the order can only reduce an existing position.

Example request

{
  "side": "buy",
  "price": "1.55",
  "size": "20.30",
  "quoteSize": "13.0967",
  "market": "AAPL-USD.P",
  "clientOrderId": "order123",
  "type": "limit",
  "timeInForce": "GTC",
  "takeProfit": {
    "triggerPrice": "18000.00"
  },
  "stopLoss": {
    "triggerPrice": "18000.00"
  }
}

Response

Created order

successboolean required

Whether the request was successful

errorstring

Error message, present only on failure

error_codestring

Semantic error code. See each endpoint's error responses for the specific codes it can return.

deprecatedstring

Deprecation notice, if applicable

Example response

{
  "success": true,
  "result": {
    "orderId": "70a37d8f972f2494837f9dba8364cbb4",
    "clientOrderId": "order123",
    "parentOrderId": "twap_70a37d8f972f2494837f9dba8364cbb4",
    "side": "buy",
    "price": "1.55",
    "size": "20.30",
    "market": "AAPL-USD.P",
    "filledSize": "5.403",
    "lastFillSize": "5.403",
    "filledCost": "8.37465",
    "realizedPnl": "1.2345",
    "fee": "0.0837",
    "feeRebate": "0.0042",
    "status": "open",
    "createdAt": "2022-06-16T12:35:11.123456Z",
    "filledAt": "2022-06-16T12:35:11.123456Z",
    "canceledAt": "2022-06-16T12:35:11.123456Z",
    "cancelReason": "liquidation",
    "type": "limit",
    "timeInForce": "GTC",
    "liquidationId": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
    "triggerPrice": "125.50"
  }
}