Skip to main content
Hyperliquid
POST/exchange

Request Headers

string
required
Must be application/json

Request Body

object
required
Signed action.
number
required
Replay-protection nonce, e.g., 1701234567890
object
required
Account owner or approved API wallet; use the exchange signing format.
string
Optional account-owner address. Rejects the request if the verified signer currently maps to another account. This unsigned check does not select an account or grant access.
number
Optional signed deadline in Unix milliseconds; requests after it are rejected
The market and side remain those of the stored order. For perpetual and spot orders, s is the new replacement quantity, excluding earlier fills. For example, after 6 of 10 units fill, submit s: "4" to reprice the remaining 4, or s: "2" to reduce the remainder to 2. A limit order’s t.limit.tif must remain unchanged (Gtc, Ioc, or Alo). A trigger’s tpsl and isMarket fields are also immutable. Local stop-market TP/SL can be modified before it fires; venue-backed trigger orders require cancel and replacement. For a local TP/SL waiting for its trigger, the new trigger price is checked against a recent mark price. A trigger that would fire immediately is rejected with TP/SL trigger would execute immediately at the current mark price. mark=<px>, trigger=<px>, side=<side>, condition=<tp|sl>; without a recent mark price the item is rejected with Cannot validate TP/SL trigger for <asset> because mark price is unavailable (or is stale). TP/SL orders still waiting for their parent order to fill skip this check. An entry trigger waiting for its trigger can change its trigger price, limit and size, and keeps its order ID. Its side, tpsl, isMarket and r: false stay as placed. Its new trigger price gets the same mark-price check as a local TP/SL, and a limit entry’s limit must stay within 1% of the new trigger price, as at placement. A larger size is checked for margin only when the order triggers. Once its trigger price has been reached the item is rejected with Stop or take order has already triggered and can no longer be modified; after the order is placed, modify it as an ordinary order. For venue-backed perpetual and spot orders, each modify item must include signed replacement.version: 1 and replacement.expectedRemainingSz, including price-only edits. oid identifies the original order generation. A successful replacement has a new order ID. If remaining quantity changes before commit, the item returns STALE_MODIFY_INTENT. Refresh the order and deliberately sign a new request. Do not automatically resubmit the old size against fresh state. The server rejects new venue-backed perpetual and spot modifications with a missing or unknown replacement version. Coordinate the client rollout for these modifications with the server cutover. Retries of already recorded requests retain their original outcome. An order has at most one modification in flight. A second modify is rejected with Order modification already in progress until the first resolves. This is an independent replacement, not a cumulative execution cap. For an observed remainder of 4, signing s: "4" with expectedRemainingSz: "4" may still execute additional old-order fills after commit before the venue replaces it. Those fills do not reduce the new quantity. Existing old-plus-new reservations remain until exact outcomes are known. Use cancellation and confirmed outcomes before placing a new order if you need to reconsider size after all old executions. A spot modify reserves the replacement’s full balance beside the original order’s until the outcome is known, so an account needs free balance for both: s of the base token for a sell, or s × p plus a 0.1% fee buffer in the quote asset for a buy. If free balance cannot cover the replacement, the item is rejected with INSUFFICIENT_SPOT_BALANCE. The account must also stay within its margin and borrow limits with both reservations and after a worst-case fill of the replacement; otherwise it is rejected with ADMISSION_REJECTED. A cancel during a spot modify is accepted only while the modify still waits for protocol funding, and then also drops the modify; once the modify is ready to send or has been sent, a cancel is rejected until the modify resolves. After it confirms, only the replacement is listed as an open order; late fills of the original order still appear in your fills. A resting reduce-only order may be modified. On standard (non-assigned) markets, a reduce-only modify needs an open position on the opposite side and a size no larger than that position; this also applies to a local TP/SL waiting for its trigger. Otherwise the item is rejected with Reduce-only order requires an open position, Reduce-only <side> order cannot reduce <long|short> position, or Reduce-only order size cannot exceed position size. Also on standard markets, a modify of an order on the closing side of your position is checked against free close capacity when that order or another of your live closing orders on the market is reduce-only. Free capacity is the position size minus the remaining sizes of your other live closing orders; the modified order’s own current size is not counted. A larger replacement is rejected with code: "CLOSE_CAPACITY_EXCEEDED" and free: "<size>" (that capacity as a decimal string). A modify of a closing order while an immediate close on the same market is still freeing capacity is rejected with code: "CLOSE_IN_PROGRESS". These reduce-only and close-capacity checks do not apply to assigned HIP-3 orders. From protocol config version 18, confirming a perpetual entry replacement moves its still-waiting attached TP/SL to the new order ID. Each child keeps its signed size, trigger price, and identity. A full replacement fill arms each child at its existing size (up to its original signed size), even when the replacement is smaller. Increasing the entry does not enlarge its TP/SL. Children already armed stay with the old entry. If confirmation is processed before a late fill on the old entry, the moved children keep waiting for the replacement: that late fill can remain unprotected until it fills. User cancellation still cancels waiting children; a non-user early termination still caps them to the replacement’s own booked fills. Previously orphaned children are not repaired automatically. Immediate-fill acceptance retains its existing sizing behavior. financing is unsupported and explicitly rejected in the replacement order specification.

Response

Response Fields

string
"ok" when item results are returned; inspect each result for success or failure.
string
Action type: modify or batchModify.
object
Per-item modification results.
string | number
Requested order ID, either as sent in the request or as the Notional order ID string.
string
Replacement order ID on a confirmed modification (unchanged for local TP/SL); otherwise the original order ID. May be absent when the order was not found or was not in a modifiable state.
string
Modification result status: confirmed, pending, unknown, failed (rejected by the venue), rejected, or a request-validation status such as not_found, invalid_state, invalid_field, or invalid_size.
string
Optional per-item rejection or failure message.
string
Optional per-item rejection code, as in response.data.statuses[].code.
string
Optional remaining close quantity for CLOSE_CAPACITY_EXCEEDED.
number
Optional replacement venue order ID on an initial confirmed modification. Use the Notional orderId for subsequent API requests; retry responses may omit venueOid.
string
Optional attached TP/SL outcome: "carried" means at least one waiting child moved; "not_carried" means none moved despite an attached bracket or a previous handoff. Absent for unrelated modifications. "carried" does not promise that protection is armed, covers all exposure, or was resized. A "not_carried" result is a successful modify with a warning to review protection, and remains visible on subsequent order updates.