Guides
Guides

Amend order

Change the price, quantity, stop loss, take profit or trigger price of an open order. Send only the fields you want to change.

Modify an unfilled order by its UUID: its price and quantity, its stop loss (SL) and take profit (TP), and the trigger price of a waiting conditional order. The order's currency is inherited from its UUID; no trade_currency is needed. Send only the fields you want to change.

Request

# Change price and quantity
curl -X PATCH "https://trade.mudrex.com/fapi/v1/futures/orders/{order_id}" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key" \
  -d '{
    "order_price": "0.05519",
    "quantity": "110"
  }'
# Move a waiting conditional order's trigger
curl -X PATCH "https://trade.mudrex.com/fapi/v1/futures/orders/{order_id}" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key" \
  -d '{
    "trigger_price": "0.05689"
  }'
# Change the order's stop loss (added if the order has none)
curl -X PATCH "https://trade.mudrex.com/fapi/v1/futures/orders/{order_id}" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key" \
  -d '{
    "is_stoploss": true,
    "stoploss_price": "0.05512"
  }'
# Add a LIMIT take profit to an order that has no SL/TP
curl -X PATCH "https://trade.mudrex.com/fapi/v1/futures/orders/{order_id}" \
  -H "Content-Type: application/json" \
  -H "X-Authentication: your-secret-key" \
  -d '{
    "tpsl_mode": "PARTIAL",
    "is_takeprofit": true,
    "takeprofit_price": "0.06224",
    "takeprofit_order_type": "LIMIT",
    "takeprofit_limit_price": "0.06227"
  }'

Parameters

ParameterTypeRequiredDescription
order_idstringYesThe order UUID (path parameter).
order_pricestringNoNew order price (USDT). Not allowed on a conditional MARKET order.
quantitystringNoNew quantity (base asset).
trigger_pricestringNoNew trigger price. Waiting conditional orders only.
is_stoplossbooleanNoSet to true to add, change or remove the order's SL.
stoploss_pricestringConditionalNew SL trigger price. "0" removes the SL.
stoploss_limit_pricestringNoNew limit price. LIMIT SL only.
is_takeprofit, takeprofit_price, takeprofit_limit_priceSame as the SL fields, for the TP.
stoploss_order_type / takeprofit_order_typestringNoMARKET or LIMIT. Used only when adding an SL/TP. You cannot change the trigger type (MARKET or LIMIT) of a stop loss or take profit once it is placed. A LIMIT SL/TP can be added only to a PARTIAL order.
tpsl_modestringNoFULL or PARTIAL, in upper case. Accepted only while the order's current tpsl_mode is null. Once a mode is set, it can't be changed through Amend order.
stoploss_order_id / takeprofit_order_idstringNoDeprecated and ignored. The order's own SL/TP is updated directly.

Response

Status: 200 OK

{
    "success": true,
    "data": {
        "message": "Order updated successfully"
    }
}

Response fields

FieldDescription
messageStatus message.

Read the order back with Order detail to confirm the change.

Notes

  • Add or change an SL/TP: send is_stoploss with a price. No order id is needed. If the order has an SL, it is changed, or removed with stoploss_price: "0". Otherwise one is added. TP works the same way.
  • SL/TP mode: an order without SL/TP has tpsl_mode: null. tpsl_mode is accepted on amend only while the order's current mode is null; once a mode is set, it can't be changed through Amend order. Adding an SL/TP without tpsl_mode sets the mode to FULL. To add a LIMIT SL/TP to an order with no mode, send tpsl_mode: "PARTIAL" in the same request. Removing an order's last SL/TP returns its mode to null. While the order has an SL/TP, its mode can't change. You cannot change the trigger type (MARKET or LIMIT) of a stop loss or take profit once it is placed.
  • After a partial fill, the order's SL/TP can be changed only through the position endpoints (Edit SL/TP).
  • Waiting conditional order: its SL/TP are checked again against the new fill price when the trigger or order price changes. Its SL/TP can be changed or removed only here, not through the position endpoints or Cancel order.
  • Close-on-trigger and reduce-only orders can't carry an SL/TP. Adding one is rejected.
  • Unchanged values: sending the SL/TP price that is already set returns 200 and leaves the SL/TP as it is.

Errors

❕Common errors
HTTPError textMeaning
400nothing to amendNo field to change was sent, only tpsl_mode was sent, or a limit price was sent without is_stoploss / is_takeprofit.
400stoploss_price or stoploss_limit_price is required when is_stoploss is trueis_stoploss sent without a price (TP likewise).
400stoploss_price can't be negativeNegative SL price (TP likewise).
400stoploss_limit_price can't be sent with stoploss_price 0, which removes the stoplossLimit price sent with a removal (TP likewise).
400a trigger price is required to add a stop loss or take profitAdding an SL/TP with only a limit price.
400a LIMIT stop loss or take profit can only be added to a PARTIAL orderLIMIT SL/TP added to an order whose mode is FULL or null, without tpsl_mode: "PARTIAL".
400tpsl_mode can't change while the order has a stop loss or take profittpsl_mode sent for an order whose mode is already set.
400limit price can only be set on a limit stop loss or take profitLimit price sent for a MARKET SL/TP.
400Params errorThe exchange rejected the change, for example an SL/TP on the wrong side of the order price.
400order is already filled or cancelled and can no longer be amendedThe order is triggered, filled or cancelled.
400stop loss or take profit can't be changed once the order is partially filled, update the position's stop loss or take profit insteadSL/TP change after a partial fill.
400risk orders are not allowed on a Close on Trigger orderSL/TP on a close-on-trigger order.
400stop loss or take profit can't be added to a reduce-only orderSL/TP on a reduce-only order.
400trigger price can only be changed on a conditional ordertrigger_price sent for a normal order.
400trigger price can't be changed after the order has triggeredtrigger_price sent after the trigger.
400order price can't be set on a conditional market orderorder_price sent for a conditional MARKET order.
404stop loss or take profit not found for this orderRemoving an SL/TP the order doesn't have.
409action not allowed: another user action in progress or position may be under liquidationThe same SL/TP is being added or removed by another request.
423action not allowed: another user action in progress or position may be under liquidationAnother action is in progress. Retry shortly.

Trigger and limit price step, range and minimum value errors use the same texts as Create new order.


Did this page help you?