---
title: "Create collateral OCO order"
method: POST
path: "/api/v4/order/collateral/oco"
tags: ["Collateral Trading"]
---

# Create collateral OCO order

`POST /api/v4/order/collateral/oco`

The endpoint creates a collateral [OCO](/glossary#one-cancels-the-other-oco) (one-cancels-the-other) order using [collateral balance](/glossary#balance-collateral). An OCO order combines a limit order (take-profit leg) and a stop-limit order (stop-loss leg) into a single conditional group. When one leg executes, the system cancels the other automatically.

<Warning>
Rate limit: 10000 requests/10 sec.
</Warning>

<Accordion title="Error Codes">
  - `30` - default validation error code. Also returned when `reduceOnly=true` is combined with `stopLoss` or `takeProfit`
  - `31` - market validation failed
  - `32` - amount validation failed
  - `33` - price validation failed
  - `36` - clientOrderId validation failed
  - `10` - insufficient balance to place the order
  - `111` - resulting position would exceed the market maximum
  - `112` - pending orders value would exceed the allowed maximum
  - `113` - position side cannot be changed while open positions or orders exist
  - `114` - hedge mode position side does not match (sent `BOTH` or omitted `positionSide` in hedge mode, or sent `LONG`/`SHORT` in one-way mode)
  - `115` - order would open a position in the opposite direction (one-way mode)
  - `116` - reduce-only validation failed (no position exists or order side matches position direction)
</Accordion>

## Request body

- object
  - `market` string, required — Available margin [market](/glossary#market). Example: BTC_USDT
  - `side` 'buy' | 'sell', required — Order direction. Use `buy` to open or increase a long position and `sell` to open or increase a short position.
  - `amount` string, required — Amount of [stock](/glossary#stock) currency for both legs of the OCO order. Minimum and step values are market-dependent — query the [market info](/api-reference/market-data/market-info) endpoint for constraints.
  - `price` string, required — Limit order price in [money](/glossary#money) currency for the take-profit leg.
  - `activation_price` string, required — Trigger price in [money](/glossary#money) currency for the stop-loss leg. The stop-limit order activates when the market price reaches the specified value.
  - `stop_limit_price` string, required — Execution price in [money](/glossary#money) currency for the stop-loss leg. After activation, the stop-loss leg places a limit order at the specified price.
  - `clientOrderId` string — Custom client order identifier. Uniqueness is enforced only among the account's open (pending) orders on the same market — once a previous order is filled or canceled, the same identifier can be reused, including on the same market. Contains only letters, numbers, dashes, dots, or underscores.
  - `reduceOnly` boolean — When `true`, both legs of the OCO order can only reduce or close an existing position — neither leg can increase the position or open a new one. If the order amount exceeds the current position size, the system reduces the order to match — the response returns the adjusted amount. The API returns error code `116` if no open position exists or the order side matches the position direction. See [reduce-only](/glossary#reduce-only).
  - `positionSide` 'LONG' | 'SHORT' | 'BOTH' — Position direction. Optional at the request layer but functionally required when hedge mode is enabled. See [positionSide](/glossary#position-side). Both legs of the OCO inherit the value. - **One-way mode** (default account mode): the field is ignored. Orders always use `BOTH`, and the response returns `positionSide: "BOTH"` on each leg whether the field is sent or omitted. - **Hedge mode**: the field MUST be `LONG` or `SHORT`. Sending `BOTH`, omitting the field, or sending a value that does not match the account's mode causes the trade service to reject the order with error code `114` (`Hedge mode position side does not match`).
  - `stp` 'no' | 'cb' | 'cn' | 'co' — Self-trade prevention mode. The value applies to both legs of the OCO order. Allowed values: `no` (self-trades allowed), `cb` (cancel both the new and the existing order), `cn` (cancel the new order, keep the existing), `co` (cancel the existing order, place the new one). Default: `no`. Legacy values `cancel_both`, `cancel_new`, `cancel_old` are deprecated: the API accepts the legacy values with identical behavior until a deprecation deadline is announced, then rejects the legacy values. Responses always return the abbreviated form, regardless of which variant the request used. See [Self-Trade Prevention](/platform/self-trade-prevention).
  - `request` string, required
  - `nonce` integer, required

## Response `200`

Successful response - OCO order created

- object
  - `id` integer — OCO order identifier
  - `reduceOnly` boolean — Reduce-only flag
  - `stop_loss` object — Stop loss order details
    - `orderId` integer — Order identifier
    - `clientOrderId` string — Custom order identifier. Empty string if not specified
    - `market` string — Market name
    - `side` 'buy' | 'sell' — Order side
    - `type` string — Order type
    - `timestamp` number — Unix timestamp in seconds (UTC) of order creation, with microsecond precision.
    - `dealMoney` string — Executed amount in money
    - `dealStock` string — Executed amount in stock
    - `amount` string — Order amount
    - `takerFee` string — Taker fee ratio
    - `makerFee` string — Maker fee ratio
    - `left` string — Unexecuted amount in stock
    - `dealFee` string — Executed fee by deal
    - `post_only` boolean — Post-only flag
    - `mtime` number — Timestamp of order modification
    - `price` string — Order price
    - `activation_price` string — Activation price
    - `activation_condition` 'gte' | 'lte' — Trigger condition derived from `side` (response-only, cannot be overridden): `buy` → `gte`, `sell` → `lte`.
    - `activated` integer — Activation status (0 - not activated, 1 - activated)
    - `status` 'NEW' | 'FILLED' | 'PARTIALLY_FILLED' | 'CANCELLED' — Order status. `NEW` — accepted, not yet matched. `FILLED` — fully executed. `PARTIALLY_FILLED` — partially executed, remainder still active. `CANCELLED` — canceled before full execution.
    - `stp` string — Self-trade prevention mode. Possible values: `no`, `cb`, `cn`, `co`. Always returned in abbreviated form, even when the request used a legacy value.
    - `positionSide` 'LONG' | 'SHORT' | 'BOTH' — Position side
  - `take_profit` object — Take profit order details
    - `orderId` integer — Order identifier
    - `clientOrderId` string — Custom order identifier. Empty string if not specified
    - `market` string — Market name
    - `side` 'buy' | 'sell' — Order side
    - `type` string — Order type
    - `timestamp` number — Unix timestamp in seconds (UTC) of order creation, with microsecond precision.
    - `dealMoney` string — Executed amount in money
    - `dealStock` string — Executed amount in stock
    - `amount` string — Order amount
    - `takerFee` string — Taker fee ratio
    - `makerFee` string — Maker fee ratio
    - `left` string — Unexecuted amount in stock
    - `dealFee` string — Executed fee by deal
    - `post_only` boolean — Post-only flag
    - `mtime` number — Timestamp of order modification
    - `price` string — Order price
    - `status` 'NEW' | 'FILLED' | 'PARTIALLY_FILLED' | 'CANCELLED' — Order status. `NEW` — accepted, not yet matched. `FILLED` — fully executed. `PARTIALLY_FILLED` — partially executed, remainder still active. `CANCELLED` — canceled before full execution.
    - `stp` string — Self-trade prevention mode. Possible values: `no`, `cb`, `cn`, `co`. Always returned in abbreviated form, even when the request used a legacy value.
    - `positionSide` 'LONG' | 'SHORT' | 'BOTH' — Position side

## Other responses

- `400` — Inner validation failed
- `422` — Request validation failed
- `503` — Service temporarily unavailable

---

[API](https://skmtc.net/whitebit/apis/whitebit-private-http-api-v4.md) · [All operations](https://skmtc.net/whitebit/apis/whitebit-private-http-api-v4/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/whitebit/whitebit-private-http-api-v4/revisions/76c9def9942f/schema)
