# Create Exotic Order (TP/SL)

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v2/account/exotic-orders:
    post:
      summary: Create Exotic Order (TP/SL)
      deprecated: false
      description: >-
        ## 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](https://docs.onetrading.com/rest/trading/create-order.md)
        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.
      tags:
        - One Trading Public REST API/Trading
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                instrument_code:
                  type: string
                  description: The instrument, e.g. `BTC_USD_P`.
                tpsl_mode:
                  type: string
                  enum:
                    - order
                    - position
                  description: >-
                    `order`: protect one order, closing its filled amount.
                    `position`: protect the whole position on the instrument.
                    Spot is `order` only.
                  default: order
                client_id:
                  type: string
                  format: uuid
                  description: >-
                    `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`.
                take_profit:
                  type: object
                  description: Take profit level.
                  properties:
                    value:
                      type: string
                      description: The level, as a positive decimal string.
                      examples:
                        - '78000'
                      pattern: ^\d+(\.\d+)?$
                    type:
                      type: string
                      enum:
                        - MID
                        - BBO
                      description: >-
                        The price the level is watched against. `MID`: the
                        midpoint of the best bid and the best ask. `BBO`: the
                        side of the book the close hits, the best bid for a
                        long, the best ask for a short.
                      default: MID
                  required:
                    - value
                  x-apidog-orders:
                    - value
                    - type
                  additionalProperties: false
                stop_loss:
                  type: object
                  description: Stop loss level.
                  properties:
                    value:
                      type: string
                      description: The level, as a positive decimal string.
                      examples:
                        - '78000'
                      pattern: ^\d+(\.\d+)?$
                    type:
                      type: string
                      enum:
                        - MID
                        - BBO
                      description: >-
                        The price the level is watched against. `MID`: the
                        midpoint of the best bid and the best ask. `BBO`: the
                        side of the book the close hits, the best bid for a
                        long, the best ask for a short.
                      default: MID
                  required:
                    - value
                  x-apidog-orders:
                    - value
                    - type
                  additionalProperties: false
                tpsl_force:
                  type: boolean
                  default: false
                  description: >-
                    `position` mode: replace the instrument's existing position
                    TP/SL instead of failing with `POSITION_TPSL_EXISTS`.
                slippage_bps:
                  type: integer
                  minimum: 1
                  maximum: 9999
                  description: >-
                    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.
                status:
                  type: string
                  enum:
                    - PENDING
                    - ACTIVE
                  description: >-
                    `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
                order_kind:
                  type: string
                  enum:
                    - TPSL
                  description: The kind of order. Only `TPSL` is supported.
                  default: TPSL
              required:
                - instrument_code
              x-apidog-orders:
                - instrument_code
                - tpsl_mode
                - client_id
                - take_profit
                - stop_loss
                - tpsl_force
                - slippage_bps
                - status
                - order_kind
            examples:
              '1':
                value:
                  instrument_code: BTC_USD_P
                  tpsl_mode: position
                  stop_loss:
                    value: '65000'
                    type: MID
                summary: Stop loss on the open position
              '2':
                value:
                  instrument_code: BTC_USD_P
                  tpsl_mode: position
                  tpsl_force: true
                  take_profit:
                    value: '78000'
                  stop_loss:
                    value: '66000'
                  slippage_bps: 300
                summary: Replace the position TP/SL
              '3':
                value:
                  instrument_code: BTC_USD_P
                  tpsl_mode: order
                  client_id: 58503f2b-ca87-4816-9338-93c443e6fdde
                  take_profit:
                    value: '78000'
                    type: BBO
                summary: Take profit on an open order
      responses:
        '201':
          x-apidog-name: Created
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  order:
                    type: object
                    description: A take profit / stop loss.
                    properties:
                      client_id:
                        type: string
                        format: uuid
                        description: >-
                          Identifier of the TP/SL: use it to read, update or
                          cancel it. For a TP/SL attached to an order, it is
                          that order's `client_id`.
                      instrument_code:
                        type: string
                        description: The instrument, e.g. `BTC_USD_P`.
                      order_kind:
                        type: string
                        enum:
                          - TPSL
                        description: Always `TPSL`.
                      tpsl_mode:
                        type: string
                        enum:
                          - order
                          - position
                        description: >-
                          `order`: closes the filled amount of the order it
                          protects. `position`: closes the whole position on the
                          instrument, as it is when a level is reached.
                      status:
                        type: string
                        enum:
                          - PENDING
                          - ACTIVE
                          - TRIGGERED
                          - COMPLETE
                          - CANCELLED
                        description: >-
                          Status of the TP/SL.

                          - `PENDING`: waiting for the order it is attached to
                          to fill.

                          - `ACTIVE`: armed, its levels are watched against the
                          live price.

                          - `TRIGGERED`: a level was reached and its close is
                          being placed. It cannot be updated or cancelled.

                          - `COMPLETE`: its close finished.

                          - `CANCELLED`: finished without closing. The
                          `EXOTIC_ORDER_CANCELLED` WebSocket message carries the
                          reason.
                      take_profit:
                        type: object
                        description: Take profit level, `null` when the TP/SL has none.
                        properties:
                          value:
                            type: string
                            description: The level, as a positive decimal string.
                            examples:
                              - '78000'
                          type:
                            type: string
                            enum:
                              - MID
                              - BBO
                            description: >-
                              The price the level is watched against. `MID`: the
                              midpoint of the best bid and the best ask. `BBO`:
                              the side of the book the close hits, the best bid
                              for a long, the best ask for a short.
                        required:
                          - value
                          - type
                        x-apidog-orders:
                          - value
                          - type
                        nullable: true
                      stop_loss:
                        type: object
                        description: Stop loss level, `null` when the TP/SL has none.
                        properties:
                          value:
                            type: string
                            description: The level, as a positive decimal string.
                            examples:
                              - '78000'
                          type:
                            type: string
                            enum:
                              - MID
                              - BBO
                            description: >-
                              The price the level is watched against. `MID`: the
                              midpoint of the best bid and the best ask. `BBO`:
                              the side of the book the close hits, the best bid
                              for a long, the best ask for a short.
                        required:
                          - value
                          - type
                        x-apidog-orders:
                          - value
                          - type
                        nullable: true
                      slippage_bps:
                        type: integer
                        description: >-
                          How far from its level the close may trade, in basis
                          points. Set when the TP/SL is created; it cannot be
                          changed.
                        nullable: true
                      version:
                        type: integer
                        description: >-
                          Changes each time the TP/SL changes. Send the value
                          you last read when you update it.
                      side:
                        type: string
                        enum:
                          - BUY
                          - SELL
                          - UNKNOWN
                        description: >-
                          Side of the order or position the TP/SL protects
                          (`BUY`: long, `SELL`: short). `UNKNOWN` while it is
                          `PENDING`.
                        nullable: true
                      market_type:
                        type: string
                        enum:
                          - SPOT
                          - FUTURES
                        description: The kind of market the instrument is.
                        nullable: true
                      position_id:
                        type: string
                        description: >-
                          The futures position an `ACTIVE` TP/SL protects.
                          `null` while it is `PENDING`, and on spot.
                        nullable: true
                      order_id:
                        type: string
                        description: >-
                          Exchange `order_id` of the order the TP/SL protects,
                          when known.
                        nullable: true
                      type:
                        type: string
                        enum:
                          - MARKET
                          - LIMIT
                        description: >-
                          Informational. `LIMIT` when the TP/SL armed from an
                          order that had already filled, otherwise `MARKET`. A
                          close is always sent as a limit order.
                        nullable: true
                      price:
                        type: string
                        description: >-
                          Price of the order the TP/SL protects, when it armed
                          from one. `null` otherwise.
                        nullable: true
                      filled_amount:
                        type: string
                        description: >-
                          Order mode: the filled amount of the protected order,
                          which is what the TP/SL closes. Position mode: the
                          size of the position when the TP/SL armed; it closes
                          the position as it is when a level is reached. `"0"`
                          while `PENDING`.
                      tp_client_id:
                        type: string
                        description: >-
                          `client_id` of the close order placed when the take
                          profit fires on a spot market. The orders of a futures
                          close have their own ids, listed in
                          `EXOTIC_ORDER_TRIGGERED`.
                        nullable: true
                      sl_client_id:
                        type: string
                        description: As `tp_client_id`, for the stop loss.
                        nullable: true
                      created_at:
                        type: string
                        format: date-time
                        description: When the TP/SL was created.
                      filled_at:
                        type: string
                        format: date-time
                        description: When it became `ACTIVE`.
                        nullable: true
                      completed_at:
                        type: string
                        format: date-time
                        description: When it became `COMPLETE`.
                        nullable: true
                      cancelled_at:
                        type: string
                        format: date-time
                        description: When it was cancelled.
                        nullable: true
                    x-apidog-orders:
                      - client_id
                      - instrument_code
                      - order_kind
                      - tpsl_mode
                      - status
                      - take_profit
                      - stop_loss
                      - slippage_bps
                      - version
                      - side
                      - market_type
                      - position_id
                      - order_id
                      - type
                      - price
                      - filled_amount
                      - tp_client_id
                      - sl_client_id
                      - created_at
                      - filled_at
                      - completed_at
                      - cancelled_at
                    required:
                      - client_id
                      - instrument_code
                      - order_kind
                      - tpsl_mode
                      - status
                      - take_profit
                      - stop_loss
                      - slippage_bps
                      - version
                      - side
                      - market_type
                      - position_id
                      - order_id
                      - type
                      - price
                      - filled_amount
                      - tp_client_id
                      - sl_client_id
                      - created_at
                      - filled_at
                      - completed_at
                      - cancelled_at
                required:
                  - order
                x-apidog-orders:
                  - order
              example:
                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
          headers: {}
        '400':
          x-apidog-name: Bad Request
          description: >-
            The request is invalid, or the TP/SL could not be accepted for this
            market. Unknown fields are refused with
            `INVALID_EXOTIC_ORDER_REQUEST`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code.
                  error_message:
                    type: string
                    description: Human-readable detail.
                required:
                  - error
                  - error_message
                x-apidog-orders:
                  - error
                  - error_message
              examples:
                '1':
                  summary: Invalid body
                  value:
                    error: INVALID_EXOTIC_ORDER_REQUEST
                    error_message: The exotic order request is invalid
                '2':
                  summary: Missing TP/SL
                  value:
                    error: MISSING_TP_SL
                    error_message: At least one of take_profit or stop_loss must be provided
                '3':
                  summary: Missing client ID
                  value:
                    error: MISSING_CLIENT_ID
                    error_message: client_id is required when tpsl_mode is order
                '4':
                  summary: Invalid client ID
                  value:
                    error: INVALID_CLIENT_ID
                    error_message: client_id must be a UUID
                '5':
                  summary: Invalid instrument
                  value:
                    error: INVALID_INSTRUMENT_CODE
                    error_message: The provided instrument code is invalid
                '6':
                  summary: Invalid take profit
                  value:
                    error: INVALID_TAKE_PROFIT
                    error_message: >-
                      take_profit must be an object with a positive decimal
                      string value no greater than 9007199254740991 and a type
                      of MID or BBO
                '7':
                  summary: Invalid stop loss
                  value:
                    error: INVALID_STOP_LOSS
                    error_message: >-
                      stop_loss must be an object with a positive decimal string
                      value no greater than 9007199254740991 and a type of MID
                      or BBO
                '8':
                  summary: Invalid mode
                  value:
                    error: INVALID_TPSL_MODE
                    error_message: tpsl_mode must be order or position
                '9':
                  summary: Invalid force
                  value:
                    error: INVALID_TPSL_FORCE
                    error_message: tpsl_force must be true or false
                '10':
                  summary: Invalid slippage
                  value:
                    error: INVALID_SLIPPAGE_BPS
                    error_message: slippage_bps must be an integer from 1 to 9999
                '11':
                  summary: Invalid status
                  value:
                    error: INVALID_EXOTIC_ORDER_STATUS
                    error_message: status must be PENDING or ACTIVE
                '12':
                  summary: Invalid kind
                  value:
                    error: INVALID_ORDER_KIND
                    error_message: order_kind must be TPSL
                '13':
                  summary: Level on the wrong side of the price
                  value:
                    error: TPSL_OUTSIDE_PRICE_BAND
                    error_message: >-
                      A take profit or stop loss level is on the wrong side of
                      the current price (SL against reference 67250.5)
                '14':
                  summary: Slippage over the price collar
                  value:
                    error: SLIPPAGE_ABOVE_PRICE_COLLAR
                    error_message: >-
                      The slippage is over the instrument's price collar, so the
                      close could never place (maximum 1000 bps)
                '15':
                  summary: Close below the minimum order value
                  value:
                    error: BELOW_MIN_ORDER_VALUE
                    error_message: >-
                      A take profit or stop loss would place an order below the
                      market's minimum order value (SL, minimum 10)
                '16':
                  summary: Market closed
                  value:
                    error: MARKET_CLOSED
                    error_message: The market is closed
                '17':
                  summary: Market not listed
                  value:
                    error: MARKET_NOT_FOUND
                    error_message: The market is not listed
                '18':
                  summary: Position mode on spot
                  value:
                    error: SPOT_POSITION_MODE_UNSUPPORTED
                    error_message: >-
                      A spot market has no position; a spot take profit / stop
                      loss must use tpsl_mode order
                '19':
                  summary: Spot sell
                  value:
                    error: SPOT_SELL_UNSUPPORTED
                    error_message: A spot take profit / stop loss can only protect a buy
                '20':
                  summary: Order or position could not be read
                  value:
                    error: EXCHANGE_LOOKUP_FAILED
                    error_message: The exchange order or position could not be resolved
          headers: {}
        '401':
          x-apidog-name: Unauthorized
          description: >-
            The token was rejected: `UNAUTHORIZED`, or
            `INVALID_REQUEST_SIGNATURE` when the API key requires signed
            requests and the signature is missing or invalid.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code.
                  error_message:
                    type: string
                    description: Human-readable detail.
                required:
                  - error
                  - error_message
                x-apidog-orders:
                  - error
                  - error_message
              examples:
                '1':
                  summary: Unauthorized
                  value:
                    error: UNAUTHORIZED
                    error_message: Unauthorized access
                '2':
                  summary: Invalid signature
                  value:
                    error: INVALID_REQUEST_SIGNATURE
                    error_message: The request signature is missing or invalid
          headers: {}
        '403':
          x-apidog-name: Forbidden
          description: >-
            Either the gateway rejected the token (`{"message":"Forbidden"}`),
            the API key lacks the `TRADE` scope or the account is not active
            (`PERMISSION_DENIED`), or the account has no exchange account
            (`EXCHANGE_ACCOUNT_NOT_PROVISIONED`), or the account is not
            permitted to trade the instrument's product.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: string
                        description: Error code.
                      error_message:
                        type: string
                        description: Human-readable detail.
                    required:
                      - error
                      - error_message
                    x-apidog-orders:
                      - error
                      - error_message
                  - type: object
                    properties:
                      message:
                        type: string
                    required:
                      - message
                    x-apidog-orders:
                      - message
              examples:
                '1':
                  summary: Gateway
                  value:
                    message: Forbidden
                '2':
                  summary: Missing scope, or account not active
                  value:
                    error: PERMISSION_DENIED
                    error_message: Permission denied
                '3':
                  summary: Not provisioned
                  value:
                    error: EXCHANGE_ACCOUNT_NOT_PROVISIONED
                    error_message: >-
                      The account is authenticated but has no exchange account
                      yet
                '4':
                  summary: Product not permitted
                  value:
                    error: PERMISSION_DENIED
                    error_message: You do not have permission to trade futures.
          headers: {}
        '404':
          x-apidog-name: Not Found
          description: >-
            `order` mode: no order on the account has this `client_id`.
            `position` mode: there is no open position on the instrument.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code.
                  error_message:
                    type: string
                    description: Human-readable detail.
                required:
                  - error
                  - error_message
                x-apidog-orders:
                  - error
                  - error_message
              examples:
                '1':
                  summary: Not found
                  value:
                    error: ORDER_NOT_FOUND
                    error_message: The requested order was not found
                '2':
                  summary: No open position
                  value:
                    error: POSITION_NOT_FOUND
                    error_message: The requested position was not found
          headers: {}
        '409':
          x-apidog-name: Conflict
          description: The TP/SL conflicts with one that already exists.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code.
                  error_message:
                    type: string
                    description: Human-readable detail.
                required:
                  - error
                  - error_message
                x-apidog-orders:
                  - error
                  - error_message
              examples:
                '1':
                  summary: Position TP/SL exists
                  value:
                    error: POSITION_TPSL_EXISTS
                    error_message: >-
                      An active position take profit / stop loss already exists
                      for this instrument; set tpsl_force to replace it
                      (existing client_id 0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10)
                '2':
                  summary: Already registered
                  value:
                    error: ORDER_ALREADY_EXISTS
                    error_message: >-
                      A take profit / stop loss is already registered for this
                      client_id
          headers: {}
        '429':
          x-apidog-name: Too Many Requests
          description: >-
            Rate limit exceeded. Limits are per account holder per minute: 600
            (retail), 2,000 (institutional), 10,000 (market maker).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code.
                  error_message:
                    type: string
                    description: Human-readable detail.
                required:
                  - error
                  - error_message
                x-apidog-orders:
                  - error
                  - error_message
              examples:
                '1':
                  summary: Too many requests
                  value:
                    error: TOO_MANY_REQUESTS
                    error_message: Too many requests
          headers: {}
        '500':
          x-apidog-name: Server Error
          description: >-
            The request could not be completed. It is safe to read the TP/SL
            again before retrying.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code.
                  error_message:
                    type: string
                    description: Human-readable detail.
                required:
                  - error
                  - error_message
                x-apidog-orders:
                  - error
                  - error_message
              examples:
                '1':
                  summary: Server error
                  value:
                    error: SERVER_ERROR
                    error_message: An internal server error occurred
          headers: {}
        '503':
          x-apidog-name: Service Unavailable
          description: 'The market could not be checked. Nothing was changed: try again.'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code.
                  error_message:
                    type: string
                    description: Human-readable detail.
                required:
                  - error
                  - error_message
                x-apidog-orders:
                  - error
                  - error_message
              examples:
                '1':
                  summary: Instruments unavailable
                  value:
                    error: INSTRUMENTS_UNAVAILABLE
                    error_message: The market could not be checked; try again
          headers: {}
      security: []
      x-apidog-folder: One Trading Public REST API/Trading
      x-apidog-status: released
      x-run-in-apidog: https://app.eu.apidog.com/web/project/349694/apis/api-4589056-run
components:
  schemas: {}
  securitySchemes:
    bearerAuth:
      type: bearer
      scheme: bearer
      description: >-
        API key issued to the account holder, sent as `Authorization: Bearer
        <token>`. The key must hold the `SUBACCOUNT_TRANSFER` scope.
    bearer:
      type: bearer
      scheme: bearer
servers:
  - url: https://api.onetrading.com/fast
    description: Production Env
security: []

```