Skip to main content
POST
/
api
/
v4
/
order
/
collateral
/
oco
Create collateral OCO order
curl --request POST \
  --url https://whitebit.com/api/v4/order/collateral/oco \
  --header 'Content-Type: application/json' \
  --header 'X-TXC-APIKEY: <api-key>' \
  --header 'X-TXC-PAYLOAD: <api-key>' \
  --header 'X-TXC-SIGNATURE: <api-key>' \
  --data '
{
  "market": "BTC_USDT",
  "side": "buy",
  "amount": "0.001",
  "price": "40000",
  "activation_price": "41000",
  "stop_limit_price": "42000",
  "client_order_id": "order1987111",
  "reduceOnly": false,
  "request": "{{request}}",
  "nonce": "{{nonce}}"
}
'
{
  "id": 117703764513,
  "reduceOnly": false,
  "stop_loss": {
    "order_id": 117703764514,
    "client_order_id": "",
    "market": "BTC_USDT",
    "side": "buy",
    "type": "stop limit",
    "timestamp": 1594605801.49815,
    "deal_money": "0",
    "deal_stock": "0",
    "amount": "2.241379",
    "takerFee": "0.001",
    "makerFee": "0.001",
    "left": "2.241379",
    "deal_fee": "0",
    "post_only": false,
    "mtime": 1662478154.941582,
    "price": "19928.79",
    "activation_price": "29928.79",
    "activation_condition": "gte",
    "activated": 0,
    "status": "FILLED",
    "stp": "no",
    "positionSide": "LONG"
  },
  "take_profit": {
    "order_id": 117703764515,
    "client_order_id": "",
    "market": "BTC_USDT",
    "side": "buy",
    "type": "limit",
    "timestamp": 1662478154.941582,
    "deal_money": "0",
    "deal_stock": "0",
    "amount": "0.635709",
    "takerFee": "0.001",
    "makerFee": "0.001",
    "left": "0.635709",
    "deal_fee": "0",
    "post_only": false,
    "mtime": 1662478154.941582,
    "price": "9928.79",
    "status": "FILLED",
    "stp": "no",
    "positionSide": "LONG"
  }
}
The reduceOnly parameter documented on this page is coming soon. The documentation is published in advance for integration planning. The parameter is not yet accepted by the API. See Reduce-only orders for details.

Authorizations

X-TXC-APIKEY
string
header
required

The public WhiteBIT API key.

X-TXC-PAYLOAD
string
header
required

Base64-encoded JSON request body.

X-TXC-SIGNATURE
string
header
required

HMAC-SHA512 signature of the payload, hex-encoded. Computed as hex(HMAC-SHA512(payload, api_secret)).

Body

application/json
market
string
required

Available margin market. Example: BTC_USDT

Example:

"BTC_USDT"

side
enum<string>
required

Order direction. Use buy to open or increase a long position and sell to open or increase a short position.

Available options:
buy,
sell
Example:

"buy"

amount
string
required

Amount of stock currency for both legs of the OCO order. Minimum and step values are market-dependent — query the market info endpoint for constraints.

Example:

"0.001"

price
string
required

Limit order price in money currency for the take-profit leg.

Example:

"40000"

activation_price
string
required

Trigger price in money currency for the stop-loss leg. The stop-limit order activates when the market price reaches the specified value.

Example:

"41000"

stop_limit_price
string
required

Execution price in money currency for the stop-loss leg. After activation, the stop-loss leg places a limit order at the specified price.

Example:

"42000"

request
string
required
Example:

"{{request}}"

nonce
string
required
Example:

"{{nonce}}"

client_order_id
string

Custom order identifier. Must be unique and contain only letters, numbers, dashes, dots, or underscores.

Example:

"order1987111"

reduceOnly
boolean
default:false

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 API returns error code 116 if no open position exists or the order side matches the position direction. See reduce-only.

Example:

false

Response

Successful response - OCO order created

id
integer

OCO order identifier

Example:

117703764513

reduceOnly
boolean

Reduce-only flag

Example:

false

stop_loss
object

Stop loss order details

take_profit
object

Take profit order details