# Cancel Exotic Order (TP/SL)

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v2/account/exotic-orders:
    delete:
      summary: Cancel Exotic Order (TP/SL)
      deprecated: false
      description: >-
        ## Cancel 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`).


        Cancels TP/SLs without placing an order. Send exactly one of the two
        parameters:


        - `client_id` cancels that one TP/SL, and answers with it in `order`.
        `EXOTIC_ORDER_CANCELLED` follows on the WebSocket `ACCOUNT` channel with
        reason `USER_CANCELLED`.

        - `instrument_code` cancels the position TP/SL on that instrument, and
        its spot TP/SLs, and answers with `cancelled`, `failed` and the
        cancelled `orders` (reason `BULK_CANCEL`). A futures TP/SL in `order`
        mode belongs to its order and is cancelled by its `client_id` only. With
        nothing to cancel the answer is `cancelled: 0`.


        Cancelling a TP/SL leaves the order or position it protected as it is.
        The reverse also holds once a TP/SL is `ACTIVE`: cancelling the order it
        was attached to, or Cancel All Orders, does not cancel it. It ends when
        it is cancelled here, when a level fires, or when its position is closed
        or flips.


        A TP/SL that is `TRIGGERED` is placing its close: cancelling it by
        `client_id` is refused with `ORDER_ALREADY_TERMINAL`, and the close runs
        to its end.
      tags:
        - One Trading Public REST API/Trading
      parameters:
        - name: client_id
          in: query
          description: Cancel this one TP/SL. Send this or `instrument_code`, not both.
          required: false
          schema:
            type: string
            format: uuid
        - name: instrument_code
          in: query
          description: >-
            Cancel the position TP/SL and the spot TP/SLs on this instrument.
            Send this or `client_id`, not both.
          required: false
          example: BTC_USD_P
          schema:
            type: string
      responses:
        '200':
          x-apidog-name: Success
          description: >-
            By `client_id`: the cancelled TP/SL in `order`. By
            `instrument_code`: `cancelled`, `failed` and `orders`.
          content:
            application/json:
              schema:
                oneOf:
                  - title: By client_id
                    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
                  - title: By instrument_code
                    type: object
                    properties:
                      cancelled:
                        type: integer
                        description: How many TP/SLs were cancelled.
                      failed:
                        type: integer
                        description: >-
                          How many could not be cancelled, for example one that
                          fired at the same moment.
                      orders:
                        type: array
                        items:
                          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
                        description: The cancelled TP/SLs.
                    required:
                      - cancelled
                      - failed
                      - orders
                    x-apidog-orders:
                      - cancelled
                      - failed
                      - orders
              examples:
                '1':
                  summary: By client_id
                  value:
                    order:
                      client_id: 0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10
                      instrument_code: BTC_USD_P
                      order_kind: TPSL
                      tpsl_mode: position
                      status: CANCELLED
                      take_profit: null
                      stop_loss:
                        value: '65000'
                        type: MID
                      slippage_bps: 500
                      version: 3
                      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: '2026-11-16T11:02:10.000Z'
                '2':
                  summary: By instrument_code
                  value:
                    cancelled: 1
                    failed: 0
                    orders:
                      - client_id: 0d0b1f0c-7f0e-4f55-9a53-6f6f3c1c2a10
                        instrument_code: BTC_USD_P
                        order_kind: TPSL
                        tpsl_mode: position
                        status: CANCELLED
                        take_profit: null
                        stop_loss:
                          value: '65000'
                          type: MID
                        slippage_bps: 500
                        version: 3
                        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: '2026-11-16T11:02:10.000Z'
          headers: {}
        '400':
          x-apidog-name: Bad Request
          description: >-
            A query parameter is invalid. An unknown parameter is refused with
            `INVALID_PARAMETERS`.
          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: Neither or both identifiers
                  value:
                    error: MISSING_IDENTIFIER
                    error_message: >-
                      Exactly one of client_id or instrument_code must be
                      provided
                '2':
                  summary: Invalid client ID
                  value:
                    error: INVALID_CLIENT_ID
                    error_message: client_id must be a UUID
                '3':
                  summary: Unknown parameter
                  value:
                    error: INVALID_PARAMETERS
                    error_message: One or more parameters are invalid
          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`).
          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
          headers: {}
        '404':
          x-apidog-name: Not Found
          description: No TP/SL has this `client_id`.
          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
          headers: {}
        '409':
          x-apidog-name: Conflict
          description: >-
            The TP/SL has already finished, is placing its close, or changed at
            the same moment.
          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: Already finished, or closing
                  value:
                    error: ORDER_ALREADY_TERMINAL
                    error_message: >-
                      The take profit / stop loss has already completed or been
                      cancelled
                '2':
                  summary: Version conflict
                  value:
                    error: VERSION_CONFLICT
                    error_message: >-
                      The take profit / stop loss was modified by another
                      request; fetch it again and retry
          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: {}
      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-4589058-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: []

```