Skip to main content
Move a resting order to a new price, cancel it, or clear every working order on the account. Use this page when your screen lets a trader drag an order on a chart or click to cancel it. By the end you can move an order and tell a real success from a move that only looked accepted, move an entry with its bracket, and cancel one order or all of them.

Before you start

The examples use the variables from the programmatic quickstart and a limit order resting on ESZ6, the December 2026 E-mini S&P 500 contract, on a Demo in production. A Demo prices futures only from your own futures login, as Place your first order explains, so in the sandbox you run the same calls on a HYPERLIQUID:BTC order, sized in bitcoin, as Test it end to end does. The TypeScript SDK isn’t published, so call the routes over HTTP, as the curl examples do. The TypeScript examples show the same calls through the SDK’s client, with provider and account set. Every call on this page names the order by providerOrderId, the id the provider or the paper book gave it. On a Demo it’s the clientOrderId the order was placed under. You get it in three places, and they agree: Save the one you’ll work with:
1

Move a resting order to a new price

Send the order’s full description with the new price to Replace an order. It’s one operation under one clientOrderId, so a retry after a timeout can’t move the order twice.
price is a limit’s resting price or a stop’s trigger. A stop_limit also needs stopLimitPrice, the limit its trigger turns into. orderType must match the order’s type as the engine reports it, because a replace never converts one type into another.On the paper book, send orderQty in place of qty: the order’s whole quantity after the change, filled and open, as FIX’s OrderQty. What can still fill is orderQty less what the order has filled when the change is made, so a fill that lands while your request is on its way is counted. An orderQty no more than what has filled ends the order filled, and nothing rests. Every other provider states the quantity in its own terms and answers orderQty with 400 order_qty_unsupported: send qty there. Send one of the two.Mint a new clientOrderId each time the trader moves the order somewhere new, and reuse it only when you retry the same move.On the paper book, a limit moved to a price the market already crosses fills at once, as a new limit order at that price would. It takes the market’s price, the ask for a buy and the bid for a sell, and never a worse one than the new limit, and it pays a taker’s commission. The old order ends replaced in the same moment, a bracket waiting on the entry is armed by the fill, and nothing rests.
2

Read the outcome

The response is 200 whenever the replace finished, but that doesn’t mean the order moved. Some providers change an order in one step, and the paper book is one of them. Everywhere else the engine cancels the order and places it again, and that can end several ways. outcome says which:
On a Demo the moved order rests under the replace’s clientOrderId, so providerOrderId is replace-1.Only amended and replaced are successes. Read providerOrderId from every response, because a replace can give the order a new id. Every other outcome also carries message, which says what happened in English.
3

Move an entry that has a bracket

An entry keeps its bracket when it moves. Send the replace exactly as above: the bracket waiting on the entry follows it to the order it rests as afterwards, and rests its pairs on that order’s fills. The bracket’s take profits and stop losses keep their prices. If they should move with the entry, change them with Change a bracket.Two moves are refused with 409, and the order stays where it was:
4

Cancel one order

Send the order’s id to Cancel an order. The engine answers only once the provider has accepted the cancel.
A 200 means the cancel was accepted. The order leaves the next account frame. A cancel takes no clientOrderId, because cancelling the same order twice is harmless.
5

Cancel every working order

Cancel all working orders cancels them one by one. Send instrument to clear just that instrument, or an empty body to clear the whole account. It leaves positions alone.
The response counts what it cancelled out of what was working:
If the provider refuses one cancel, the sweep stops there and answers with the refusal’s status, usually 422, and the code cancel_all_incomplete with the same two counts. Read the account and send the sweep again. Cancelling is safe to repeat.

When a change is refused

A risk lock never blocks a cancel. The lock stops new exposure, and a cancel only removes it.

Test it end to end

On your Demo in the sandbox, with HYPERLIQUID:BTC sized in bitcoin:
  1. Buy 0.01 with a limit well below the market so it rests, and save its providerOrderId.
  2. Replace it at a new price, still below the market, and confirm outcome is amended, as it is on the paper book.
  3. Cancel it using the id the replace returned, then confirm it’s gone from List orders.
  4. Place two resting orders and cancel all. The response reports cancelled equal to total.

Next steps

Close a position

Choose between the four ways out by what each cancels first.

Protect a position

Move a bracket’s take profits and stop losses, which change only through their bracket.

Stream live data

Follow the account’s orders as they change instead of reading them again.