# Change order trigger price

`PATCH /orders/{orderId}`

Edits a pending order: trigger price, reserved `amount`, slippage tolerance, or base size. The engine does this by replacing the order, so the
response carries a **new order with a new identifier**, while the previous one ends up as `canceled_by_update`.

Checked beyond the schema:

- The order must exist and still be `active`, and its account must belong to the caller and be in a trading status.
- `market` and `liquidation` orders cannot be edited at all, nor can a `stop` / `take` order that was created without a trigger price
  (`order_not_updatable`); a trigger price that is set cannot be reset to `0` (`trigger_price_reset_forbidden`).
- Growing the reserve of an increase order requires the difference as free balance, and is refused while the account is locked by the managed capital limit.
- An order created with `sizeMode: base` needs a fresh `amount` whenever `baseSize` changes (`base_size_requires_amount`).
- The market must be open, and the resulting order is re-checked exactly as on creation — the same field-shape, trigger-price and notional
  codes listed on `POST /orders` apply here, except `invalid_leverage`: leverage cannot be edited.

A request that sets none of the fields changes nothing and returns the order as it stands.

## Authorization

bearer: http · bearer (required). Personal API key, prefixed with `usk_`.

## Parameters

- path: orderId (string · uuid; required). Identifier of the order to edit.

Type: string · uuid

format: uuid

## Request body · OrderUpdateRequest

application/json · required

Schema: OrderUpdateRequest

Type: object

Required fields: none

- triggerPrice (string · int32; optional)

triggerPrice example: 65000000000000

triggerPrice.Type: string · int32

triggerPrice.New trigger price, fp9 raw. Bounds are re-checked against the current market price (and, for `stop` / `take`, against the liquidation price of the position). A trigger price that is already set cannot be reset to `0`.

triggerPrice.format: int32

triggerPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- amount (string · int32; optional)

amount example: 100000000000

amount.Type: string · int32

amount.New `amount`, fp9 raw, in the unit its order class uses — see the same field on order creation. On an increase order it is the quote reserve: growing it requires the difference to be available as free balance, and it is required together with `baseSize` on a `base`-sized order. On a close order it is the base asset size of the position to close.

amount.format: int32

amount.pattern: ^(?:-?[1-9][0-9]*|0)$

- expectedAmount (string · int32; optional)

expectedAmount example: 1000000000

expectedAmount.Type: string · int32

expectedAmount.New slippage tolerance, fp9 raw. See the same field on order creation.

expectedAmount.format: int32

expectedAmount.pattern: ^(?:-?[1-9][0-9]*|0)$

- baseSize (string · int32; optional)

baseSize example: 1000000000

baseSize.Type: string · int32

baseSize.New size in base asset units, fp9 raw. Only for orders created with `sizeMode: base`.

baseSize.format: int32

baseSize.pattern: ^(?:-?[1-9][0-9]*|0)$

Example



```json
{}
```

## Example · cURL

```bash
curl --request PATCH 'https://api.upscale.trade/orders/{orderId}' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data-raw '{}'
```

## Example · JavaScript

```javascript
const response = await fetch("https://api.upscale.trade/orders/{orderId}", {
  method: "PATCH",
  headers: {
    "Accept": "application/json",
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: "{}",
});
console.log(response.status, await response.text());
```

## Example · Python

```python
import requests

response = requests.request(
    "PATCH",
    "https://api.upscale.trade/orders/{orderId}",
    headers={"Accept":"application/json","Authorization":"Bearer YOUR_API_KEY","Content-Type":"application/json"},
    data="{}",
    timeout=30,
)
print(response.status_code, response.text)
```

## Response 401

**401**  — Unauthorized

## Response 403

**403**  — The order is no longer active. The account belongs to another user (`account_access_denied`), or the request is authenticated with an API key while `api_trading` is disabled on the account (`api_trading_not_enabled`). Trading on the account is over in its current status (`challenge_closed`), or the account is locked by the managed capital limit (`funded_limit_trading_locked`). The market is paused (`market_paused`) or accepts closing orders only (`market_close_only`).

## Response 404

**404**  — No order with this identifier.

## Response 429

**429**  — Rate limit of the API key exceeded (`api_key_rate_limit_exceeded`). `Retry-After` says when to come back; the body carries the bucket (`read` / `write`), the window that tripped, its limit and `retryAt`.

## Response default · OrderResponse

**default** application/json — Response

Schema: OrderResponse

Type: object

Required fields: id, txId, trader, market, status, type, direction, triggerPrice, requestedTriggerPrice, stopPrice, limitPrice, stopTriggerPrice, takeTriggerPrice, trailingStopActivationPrice, trailingStopOffset, trailingStopOffsetPercent, leverage, index, positionId, parentOrderId, expiration, amount, indexPrice, settlementOraclePrice, createdAt, error, realizedPnl, rawRealizedPnl, profitAdjustmentApplied, executedAfterPause, sizeMode, baseSize, reservedAmount, errorCode, reason

Required field types: id (string · uuid; required), txId (string; required), trader (string · uuid; required), market (string · uuid; required), status (string · enum; required), type (string · enum; required), direction (string · enum; required), triggerPrice (string · int32; required), requestedTriggerPrice (string · int32 · nullable; required), stopPrice (string · int32; required), limitPrice (string · int32; required), stopTriggerPrice (string · int32; required), takeTriggerPrice (string · int32; required), trailingStopActivationPrice (string · int32; required), trailingStopOffset (string · int32; required), trailingStopOffsetPercent (string · int32; required), leverage (string · int32 · nullable; required), index (string; required), positionId (string[]; required), parentOrderId (string[]; required), expiration (string · date-time · nullable; required), amount (string · int32; required), indexPrice (string · int32 · nullable; required), settlementOraclePrice (string · int32; required), createdAt (string · date-time; required), error (string[]; required), realizedPnl (string · int32 · nullable; required), rawRealizedPnl (string · int32 · nullable; required), profitAdjustmentApplied (boolean; required), executedAfterPause (boolean; required), sizeMode (string · enum; required), baseSize (string · int32 · nullable; required), reservedAmount (string · int32 · nullable; required), errorCode (string[]; required), reason (string · enum · nullable; required)

- id (string · uuid; required)

id example: 00000000-0000-4000-8000-000000000000

id.Type: string · uuid

id.Order identifier.

id.format: uuid

id.pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$

- txId (string; required)

txId example: string

txId.Type: string

txId.Order identifier. Kept for backward compatibility, always equal to `id`.

- trader (string · uuid; required)

trader example: 00000000-0000-4000-8000-000000000000

trader.Type: string · uuid

trader.Trader account the order belongs to.

trader.format: uuid

trader.pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$

- market (string · uuid; required)

market example: 00000000-0000-4000-8000-000000000000

market.Type: string · uuid

market.Market the order is placed on.

market.format: uuid

market.pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$

- status (string · enum; required)

status example: active

status.Type: string · enum

status.Lifecycle state: `active` while it waits, `executed` once filled, `canceled` when cancelled by the trader or the platform, `canceled_by_update` when replaced by an edit, `canceled_by_position` when the position it was attached to went away, `canceled_by_error` when execution failed — see `errorCode`.

status.Allowed values: ["active","canceled","canceled_by_update","canceled_by_error","canceled_by_position","executed"]

- type (string · enum; required)

type example: market

type.Type: string · enum

type.Order type. `liquidation` marks an order the engine raised itself.

type.Allowed values: ["market","limit","stop","trailing_stop","take","stop_limit","stop_market","liquidation"]

- direction (string · enum; required)

direction example: long

direction.Type: string · enum

direction.Order direction.

direction.Allowed values: ["long","short"]

- triggerPrice (string · int32; required)

triggerPrice example: 1000000000

triggerPrice.Type: string · int32

triggerPrice.Price at which the order fires, fp9 raw. `0` when the order carries no trigger.

triggerPrice.format: int32

triggerPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- requestedTriggerPrice (string · int32 · nullable; required)

requestedTriggerPrice example: 1000000000

requestedTriggerPrice.Type: string · int32 · nullable

requestedTriggerPrice.Trigger price as requested, before the engine pushed it out to the minimum stop distance, fp9 raw. Null when the requested price was kept as is.

requestedTriggerPrice.format: int32

requestedTriggerPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- stopPrice (string · int32; required)

stopPrice example: 1000000000

stopPrice.Type: string · int32

stopPrice.Trigger price of a `stop_market` / `stop_limit` order, fp9 raw; `0` for every other type.

stopPrice.format: int32

stopPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- limitPrice (string · int32; required)

limitPrice example: 1000000000

limitPrice.Type: string · int32

limitPrice.Price the order is placed at once triggered, fp9 raw: the stop-limit price, falling back to the trigger price.

limitPrice.format: int32

limitPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- stopTriggerPrice (string · int32; required)

stopTriggerPrice example: 1000000000

stopTriggerPrice.Type: string · int32

stopTriggerPrice.Stop-loss attached to the order, fp9 raw. `0` when none is attached.

stopTriggerPrice.format: int32

stopTriggerPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- takeTriggerPrice (string · int32; required)

takeTriggerPrice example: 1000000000

takeTriggerPrice.Type: string · int32

takeTriggerPrice.Take-profit attached to the order, fp9 raw. `0` when none is attached.

takeTriggerPrice.format: int32

takeTriggerPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- trailingStopActivationPrice (string · int32; required)

trailingStopActivationPrice example: 1000000000

trailingStopActivationPrice.Type: string · int32

trailingStopActivationPrice.Price at which a trailing stop starts trailing, fp9 raw. `0` when it trails from creation.

trailingStopActivationPrice.format: int32

trailingStopActivationPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- trailingStopOffset (string · int32; required)

trailingStopOffset example: 1000000000

trailingStopOffset.Type: string · int32

trailingStopOffset.Trailing distance as an absolute quote amount, fp9 raw. `0` when the distance is set as a percent.

trailingStopOffset.format: int32

trailingStopOffset.pattern: ^(?:-?[1-9][0-9]*|0)$

- trailingStopOffsetPercent (string · int32; required)

trailingStopOffsetPercent example: 1000000000

trailingStopOffsetPercent.Type: string · int32

trailingStopOffsetPercent.Trailing distance as a fraction of price, fp9 raw. `0` when the distance is absolute.

trailingStopOffsetPercent.format: int32

trailingStopOffsetPercent.pattern: ^(?:-?[1-9][0-9]*|0)$

- leverage (string · int32 · nullable; required)

leverage example: 1000000000

leverage.Type: string · int32 · nullable

leverage.Leverage of the order, fp9 raw. Null on close orders, which inherit the leverage of the position.

leverage.format: int32

leverage.pattern: ^(?:-?[1-9][0-9]*|0)$

- index (string; required)

index example: string

index.Type: string

index.Order identifier. Kept for backward compatibility, always equal to `id`.

- positionId (string[]; required)

positionId example: [
  "string"
]

positionId.Type: string[]

positionId.Position a close order is attached to. Null for orders that open or grow a position.

positionId.[]Type: string

- parentOrderId (string[]; required)

parentOrderId example: [
  "string"
]

parentOrderId.Type: string[]

parentOrderId.Order this one was spawned from: a stop or take created out of `stopTriggerPrice` / `takeTriggerPrice`, or the limit order a `stop_limit` turned into. Null when the order was submitted directly.

parentOrderId.[]Type: string

- expiration (string · date-time · nullable; required)

expiration example: 2026-05-01T12:30:00.000Z

expiration.Type: string · date-time · nullable

expiration.Always null. Kept for backward compatibility — orders do not expire on their own.

expiration.format: date-time

- amount (string · int32; required)

amount example: 1000000000

amount.Type: string · int32

amount.Size of the order, fp9 raw, in the unit its class uses: on an increase order a quote amount — the reserve while it waits, and what it actually spent once executed; on a close order (`stop`, `take`, `trailing_stop`) the base asset size it closes, as requested at creation.

amount.format: int32

amount.pattern: ^(?:-?[1-9][0-9]*|0)$

- indexPrice (string · int32 · nullable; required)

indexPrice example: 1000000000

indexPrice.Type: string · int32 · nullable

indexPrice.Index price the order executed at, fp9 raw. Null while the order has not executed.

indexPrice.format: int32

indexPrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- settlementOraclePrice (string · int32; required)

settlementOraclePrice example: 1000000000

settlementOraclePrice.Type: string · int32

settlementOraclePrice.Always `1000000000` (1.0). Kept for backward compatibility.

settlementOraclePrice.format: int32

settlementOraclePrice.pattern: ^(?:-?[1-9][0-9]*|0)$

- createdAt (string · date-time; required)

createdAt example: 2026-05-01T12:30:00.000Z

createdAt.Type: string · date-time

createdAt.When the order was accepted.

createdAt.format: date-time

- error (string[]; required)

error example: [
  "string"
]

error.Type: string[]

error.Always null. Kept for backward compatibility — use `errorCode`.

error.[]Type: string

- realizedPnl (string · int32 · nullable; required)

realizedPnl example: 1000000000

realizedPnl.Type: string · int32 · nullable

realizedPnl.Pnl realised by this order, fp9 raw. Set only on an executed close order; null while pending and on orders that open or grow a position.

realizedPnl.format: int32

realizedPnl.pattern: ^(?:-?[1-9][0-9]*|0)$

- rawRealizedPnl (string · int32 · nullable; required)

rawRealizedPnl example: 1000000000

rawRealizedPnl.Type: string · int32 · nullable

rawRealizedPnl.Realised pnl before the 60-second adjustment, fp9 raw. Differs from `realizedPnl` only when the adjustment fired.

rawRealizedPnl.format: int32

rawRealizedPnl.pattern: ^(?:-?[1-9][0-9]*|0)$

- profitAdjustmentApplied (boolean; required)

profitAdjustmentApplied example: true

profitAdjustmentApplied.Type: boolean

profitAdjustmentApplied.Whether the 60-second adjustment capped the profit of this order — inside a minute of an open or increase the position pnl cannot grow above what it was at that moment.

- executedAfterPause (boolean; required)

executedAfterPause example: true

executedAfterPause.Type: boolean

executedAfterPause.Whether the order executed after a market pause. Not set by the current engine — always `false`.

- sizeMode (string · enum; required)

sizeMode example: quote

sizeMode.Type: string · enum

sizeMode.How the size was expressed on creation: `quote` sizes the order by `amount`, `base` sizes it by `baseSize`.

sizeMode.Allowed values: ["quote","base"]

- baseSize (string · int32 · nullable; required)

baseSize example: 1000000000

baseSize.Type: string · int32 · nullable

baseSize.Order size in base asset units, fp9 raw. Null for `quote`-sized orders.

baseSize.format: int32

baseSize.pattern: ^(?:-?[1-9][0-9]*|0)$

- reservedAmount (string · int32 · nullable; required)

reservedAmount example: 1000000000

reservedAmount.Type: string · int32 · nullable

reservedAmount.Quote amount reserved when the order with sizeMode=base was created, fp9 raw. Stays at the original reserve after execution, while `amount` is rewritten to what was spent. Null for `quote`-sized orders, where `amount` is the reserve.

reservedAmount.format: int32

reservedAmount.pattern: ^(?:-?[1-9][0-9]*|0)$

- errorCode (string[]; required)

errorCode example: [
  "string"
]

errorCode.Type: string[]

errorCode.Why execution failed, set together with status `canceled_by_error` — for example `insufficient_reserve_at_execution`, `order_below_min_notional`, `order_exceeds_market_depth` or `slippage_tolerance`. Null otherwise.

errorCode.[]Type: string

- reason (string · enum · nullable; required)

reason example: force_close

reason.Type: string · enum · nullable

reason.Why the platform cancelled the order itself, for example `force_close` or `weekly_session_risk_close`. Null for trader-driven cancellations.

reason.Allowed values: ["force_close","stop_accounts_fail","stop_accounts_freeze","stop_accounts_promote","stop_accounts_manual","weekly_session_risk_close",null]

Example



```json
{
  "id": "00000000-0000-4000-8000-000000000000",
  "txId": "string",
  "trader": "00000000-0000-4000-8000-000000000000",
  "market": "00000000-0000-4000-8000-000000000000",
  "status": "active",
  "type": "market",
  "direction": "long",
  "triggerPrice": "1000000000",
  "requestedTriggerPrice": "1000000000",
  "stopPrice": "1000000000",
  "limitPrice": "1000000000",
  "stopTriggerPrice": "1000000000",
  "takeTriggerPrice": "1000000000",
  "trailingStopActivationPrice": "1000000000",
  "trailingStopOffset": "1000000000",
  "trailingStopOffsetPercent": "1000000000",
  "leverage": "1000000000",
  "index": "string",
  "positionId": [
    "string"
  ],
  "parentOrderId": [
    "string"
  ],
  "expiration": "2026-05-01T12:30:00.000Z",
  "amount": "1000000000",
  "indexPrice": "1000000000",
  "settlementOraclePrice": "1000000000",
  "createdAt": "2026-05-01T12:30:00.000Z",
  "error": [
    "string"
  ],
  "realizedPnl": "1000000000",
  "rawRealizedPnl": "1000000000",
  "profitAdjustmentApplied": true,
  "executedAfterPause": true,
  "sizeMode": "quote",
  "baseSize": "1000000000",
  "reservedAmount": "1000000000",
  "errorCode": [
    "string"
  ],
  "reason": "force_close"
}
```