# Update Exotic Order (TP/SL)

## OpenAPI Specification

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


        Changes the levels of a TP/SL without placing an order.


        - Identify it by `client_id`, or by `instrument_code` for the position
        TP/SL on that instrument. Send exactly one of the two.

        - Send `version` as you last read it from Get Exotic Orders (TP/SL) (or
        from the response that created it). If the TP/SL has changed since,
        because it fired or another update got there first, the request is
        refused with `VERSION_CONFLICT`: read it again and retry.

        - Send `take_profit`, `stop_loss` or both. A level you leave out stays
        as it is, and `null` removes it. Removing the last level cancels the
        TP/SL (`TP_SL_REMOVED`): the response then carries `cancelled: true`.

        - A new level on the wrong side of the live price is refused with
        `TPSL_OUTSIDE_PRICE_BAND`.

        - `slippage_bps` and `tpsl_mode` cannot be changed: cancel the TP/SL and
        create it again, or for a position TP/SL create a new one with
        `tpsl_force`.

        - A TP/SL that is `TRIGGERED` is placing its close and cannot be
        updated.


        If a replacement position TP/SL is still `PENDING` next to the `ACTIVE`
        one (see Create Order), `instrument_code` may pick either: use
        `client_id`.


        `EXOTIC_ORDER_UPDATED` follows on the WebSocket `ACCOUNT` channel.
      tags:
        - One Trading Public REST API/Trading
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                client_id:
                  type: string
                  format: uuid
                  description: >-
                    The TP/SL to update. Send this or `instrument_code`, not
                    both.
                instrument_code:
                  type: string
                  description: >-
                    Update the position TP/SL on this instrument. Send this or
                    `client_id`, not both.
                version:
                  type: integer
                  minimum: 0
                  description: >-
                    The `version` you last read. The update applies only if the
                    TP/SL has not changed since.
                take_profit:
                  type: object
                  description: >-
                    Take profit level. `null` removes the take profit. Leave the
                    field out to keep it as it is.
                  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
                  nullable: true
                stop_loss:
                  type: object
                  description: >-
                    Stop loss level. `null` removes the stop loss. Leave the
                    field out to keep it as it is.
                  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
                  nullable: true
              required:
                - version
              x-apidog-orders:
                - client_id
                - instrument_code
                - version
                - take_profit
                - stop_loss
            examples:
              '1':
                value:
                  instrument_code: BTC_USD_P
                  version: 2
                  stop_loss:
                    value: '66500'
                    type: MID
                summary: Move the position stop loss
              '2':
                value:
                  client_id: 58503f2b-ca87-4816-9338-93c443e6fdde
                  version: 1
                  take_profit:
                    value: '79000'
                summary: Add a take profit, by client ID
              '3':
                value:
                  client_id: 58503f2b-ca87-4816-9338-93c443e6fdde
                  version: 3
                  take_profit: null
                summary: Remove the take profit
      responses:
        '200':
          x-apidog-name: Success
          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
                  cancelled:
                    type: boolean
                    description: >-
                      Present, as `true`, only when the update removed the last
                      level and so cancelled the TP/SL.
                required:
                  - order
                x-apidog-orders:
                  - order
                  - cancelled
              examples:
                '1':
                  summary: Updated
                  value:
                    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: '66500'
                        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: null
                '2':
                  summary: Last level removed
                  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: null
                      slippage_bps: 500
                      version: 4
                      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'
                    cancelled: true
          headers: {}
        '400':
          x-apidog-name: Bad Request
          description: >-
            The request is invalid. 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: Neither or both identifiers
                  value:
                    error: MISSING_IDENTIFIER
                    error_message: >-
                      Exactly one of client_id or instrument_code must be
                      provided
                '3':
                  summary: No level sent
                  value:
                    error: MISSING_TP_SL
                    error_message: At least one of take_profit or stop_loss must be provided
                '4':
                  summary: Invalid version
                  value:
                    error: INVALID_VERSION
                    error_message: version must be a non-negative integer
                '5':
                  summary: Invalid client ID
                  value:
                    error: INVALID_CLIENT_ID
                    error_message: client_id must be a UUID
                '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: 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)
                '9':
                  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 (TP, minimum 10)
          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`, or the instrument has no live
            position TP/SL.
          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 position TP/SL
                  value:
                    error: POSITION_TPSL_NOT_FOUND
                    error_message: >-
                      No active position take profit / stop loss exists for this
                      instrument
          headers: {}
        '409':
          x-apidog-name: Conflict
          description: >-
            The TP/SL changed since `version` was read, or can no longer be
            updated.
          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: Version conflict
                  value:
                    error: VERSION_CONFLICT
                    error_message: >-
                      The take profit / stop loss was modified by another
                      request; fetch it again and retry
                '2':
                  summary: Already finished, or closing
                  value:
                    error: ORDER_ALREADY_TERMINAL
                    error_message: >-
                      The take profit / stop loss has already completed or been
                      cancelled
          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-4589057-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: []

```