Skip to Content
Trading

Create Exotic Order (TP/SL)

POST
/v2/account/exotic-orders

Create an Exotic Order (TP/SL)

Warning: Ensure your API key has the TRADE scope. You can generate an API key through the One Trading UI.

This endpoint is rate-limited per account holder (see 429).

Creates an exotic order: a take profit and/or stop loss (TP/SL) on an order you have already placed, or on an open position. To place a new order with a TP/SL attached, use Create Order instead.

The TP/SL is held in a separate service, not on the exchange itself, which watches its levels against the live price. When one is reached, a reduce-only limit order is placed on the exchange to close for you; a TP/SL with both levels is one order, so when one level fires the other goes with it.

Position mode (tpsl_mode: "position")

Protects the whole position on instrument_code, futures only. Leave client_id out: the TP/SL is ACTIVE at once, and when a level is reached it closes the position as it is then. Without an open position the request is refused with POSITION_NOT_FOUND.

There is one position TP/SL per instrument. A second is refused with POSITION_TPSL_EXISTS unless tpsl_force is true, which replaces the existing one (it is cancelled with FORCE_REPLACED). To change the levels of the one you have, use Update Exotic Order (TP/SL).

Order mode (tpsl_mode: "order", the default)

Protects one order: client_id is required and must be the client_id of an order on the account, otherwise the request is refused with ORDER_NOT_FOUND. The TP/SL is PENDING until that order fills, then closes its filled amount. If the order has already filled, send status: "ACTIVE" to arm it now. If the order is cancelled or rejected before it fills, the TP/SL is cancelled with it.

On a spot market a TP/SL is order mode only and protects a BUY: it sells what was bought.

Levels and close price

  • At least one of take_profit or stop_loss.
  • For a long, the take profit must be above the current price and the stop loss below it; the other way round for a short. A TP/SL that arms at once with a level on the wrong side is refused with TPSL_OUTSIDE_PRICE_BAND. One that arms later is checked then, and cancelled with VALIDATION_FAILED_AT_ACTIVATION if a level has already been reached.
  • The close is a limit order at the level less slippage_bps when selling, or plus it when buying. It fills at the book's better prices up to that limit, and never worse. A stop loss the market gaps through by more than its slippage fills nothing and leaves the position open.

Every change of state is sent on the WebSocket ACCOUNT channel.

Authorization

bearerAuth
headerAuthorizationBearer <token>

API key created in the One Trading UI, sent as Authorization: Bearer <token>. Each endpoint lists the key permission it needs.

Request Body

application/json
  1. body
instrument_code*string

The instrument, e.g. BTC_USD_P.

tpsl_mode?string

order: protect one order, closing its filled amount. position: protect the whole position on the instrument. Spot is order only.

Default"order"
Value in"order""position"
client_id?string

order mode: required, the client_id of the order to protect. position mode: leave it out to protect the position that is open now; one is generated and returned. If you send one, the TP/SL waits for the order with that client_id to fill, unless status is ACTIVE.

Formatuuid
take_profit?

Take profit level.

stop_loss?

Stop loss level.

tpsl_force?boolean

position mode: replace the instrument's existing position TP/SL instead of failing with POSITION_TPSL_EXISTS.

Defaultfalse
slippage_bps?integer

How far from its level the close may trade, in basis points. At most the instrument's price collar (price_collar_percentage × 100 on Instruments; 1000 for an instrument without one). Defaults to 500 (5%), or the collar if that is less. It cannot be changed later.

Range1 <= value <= 9999
status?string

PENDING: the TP/SL arms when the order client_id fills. ACTIVE: arm it now, from an order that has already filled (order mode) or from the open position (position mode). A position TP/SL without a client_id is always armed at once.

Default"PENDING"
Value in"PENDING""ACTIVE"
order_kind?"TPSL"

The kind of order. Only TPSL is supported.

Default"TPSL"
Value in"TPSL"

Response Body

Created

application/json
  1. response
order*

A take profit / stop loss.

curl -X POST 'https://api.onetrading.com/fast/v2/account/exotic-orders' \  -H 'Content-Type: application/json' \  -d '{  "instrument_code": "BTC_USD_P",  "tpsl_mode": "position",  "stop_loss": {    "value": "65000",    "type": "MID"  }}'
Example Response
{  "order": {    "client_id": "0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10",    "instrument_code": "BTC_USD_P",    "order_kind": "TPSL",    "tpsl_mode": "position",    "status": "ACTIVE",    "take_profit": null,    "stop_loss": {      "value": "65000",      "type": "MID"    },    "slippage_bps": 500,    "version": 1,    "side": "BUY",    "market_type": "FUTURES",    "position_id": "1b0f6f5e-2a59-4f0a-9d0e-5f7f3f0f6a11",    "order_id": null,    "type": "MARKET",    "price": null,    "filled_amount": "1.5",    "tp_client_id": "c2a7a1de-6d0b-11f0-8de9-0242ac120002",    "sl_client_id": "1f06d0b6-a7a1-6e20-8de9-0242ac120002",    "created_at": "2026-11-16T10:15:00.000Z",    "filled_at": "2026-11-16T10:15:00.000Z",    "completed_at": null,    "cancelled_at": null  }}