Cancel an order
const url = 'https://api.hyperstream.dev/v2/orders/0x35dc8d390877c71baacadb4001eea0055804cfc306f599fbfc97c1d69d64d30a/cancel';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"payload":{"nonce":"90193471235580291647163018827702615384561129844105227391950712038818471125043","rootIntentId":"0x01cb37f4c5f512f757df0452b51e3fe8daefda8dfdd7e6d298d841ac54f7d18b"},"signature":"0x60ce0a47bc64e07a5437de5fd4e6008bce46756d4d7c971710283924888b2a137a91ed09461b5848bb2b7341f5c258da3f97853e73662275f047e0c3c20882211b"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.hyperstream.dev/v2/orders/0x35dc8d390877c71baacadb4001eea0055804cfc306f599fbfc97c1d69d64d30a/cancel \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "payload": { "nonce": "90193471235580291647163018827702615384561129844105227391950712038818471125043", "rootIntentId": "0x01cb37f4c5f512f757df0452b51e3fe8daefda8dfdd7e6d298d841ac54f7d18b" }, "signature": "0x60ce0a47bc64e07a5437de5fd4e6008bce46756d4d7c971710283924888b2a137a91ed09461b5848bb2b7341f5c258da3f97853e73662275f047e0c3c20882211b" }'Relays an EOA depositor’s signed cancel. Valid once the order is published. The filled part is paid out and the rest
refunded when the hub settles.
A 200 is an acceptance, not settlement: keep polling the order. A cancel that races a fill is safe; whichever lands
first settles the order. Sign a fresh nonce on every attempt.
Only an ECDSA signature recovering to the depositor is accepted; ERC-1271 is not supported.
A contract wallet’s owner signature does not match the depositing contract. Wait for automatic settlement at expiry
or contact Khalani for help cancelling early. An order whose quote returned earlyCancelDisabled: true cannot be
cancelled before its deadline: this route answers 409. All newly built orders with a token on a non-EVM chain have
early cancellation disabled. A Solana-source order whose stored policy permits cancellation requires its EVM depositor’s
authorization; the wallet funding the Solana deposit address does not gain cancellation rights.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The orderId from /v2/build. Case-insensitive.
Example
0x35dc8d390877c71baacadb4001eea0055804cfc306f599fbfc97c1d69d64d30aRequest Bodyrequired
Section titled “Request Bodyrequired”A depositor-signed cancel, relayed by your backend.
object
object
A fresh random uint256 per cancel attempt, decimal. Not the build nonce; a reused value is rejected.
The order’s traces.rootIntentId.
The depositor’s EIP-712 OrderDelegateV2Cancel signature over payload.
Example
{ "payload": { "nonce": "90193471235580291647163018827702615384561129844105227391950712038818471125043", "rootIntentId": "0x01cb37f4c5f512f757df0452b51e3fe8daefda8dfdd7e6d298d841ac54f7d18b" }, "signature": "0x60ce0a47bc64e07a5437de5fd4e6008bce46756d4d7c971710283924888b2a137a91ed09461b5848bb2b7341f5c258da3f97853e73662275f047e0c3c20882211b"}Responses
Section titled “Responses”Accepted.
The cancel was accepted, not yet settled. Poll the order until delivered or delivery_failed, with a local timeout.
object
Identifier of the accepted cancel submission.
Example
{ "medusaSubmissionId": "0xd51bb36fd7ad3c3e0b2c7a7f29f04de6a6e2d2a1f5b1f0e9d9f0f9a6a1f5c7e3"}Invalid body, rootIntentId is not this order’s, or the signature does not recover to the depositor. A fresh nonce does not fix the signature.
The request failed schema validation. Carries message, not error.
object
object
Maintenance, a malformed JSON body, or an unhandled failure. Carries message, not error.
object
MaintenanceException (503), BadRequestException (malformed JSON) or InternalErrorException (500).
An error raised by the route itself.
object
object
Smallest deposit that would quote, in source base units.
Largest deposit that would quote, in source base units.
The deployment setting this direction needs.
Example
{ "error": "Payload rootIntentId does not match the order's published root intent"}The X-API-Key header is missing.
An error raised by the route itself.
object
object
Smallest deposit that would quote, in source base units.
Largest deposit that would quote, in source base units.
The deployment setting this direction needs.
Example
{ "error": "X-API-Key required"}The key is unknown or past its rotation window. A 403 is always about your account: do not retry.
An error raised by the route itself.
object
object
Smallest deposit that would quote, in source base units.
Largest deposit that would quote, in source base units.
The deployment setting this direction needs.
Example
{ "error": "Unknown or inactive integrator"}No such order, or it belongs to another integrator.
An error raised by the route itself.
object
object
Smallest deposit that would quote, in source base units.
Largest deposit that would quote, in source base units.
The deployment setting this direction needs.
Example
{ "error": "Order not found"}Not published yet, so there is nothing to cancel, or the order cannot be cancelled before its deadline (its quote returned earlyCancelDisabled: true).
An error raised by the route itself.
object
object
Smallest deposit that would quote, in source base units.
Largest deposit that would quote, in source base units.
The deployment setting this direction needs.
Example
{ "error": "Order has not been published yet — wait for the deposit to clear or use stuck-deposit recovery."}Rate limited per IP. No Retry-After; back off and retry.
Rate limited. No Retry-After; back off and retry.
object
Example
{ "errorCode": "RATE_LIMITED", "message": "Too many requests, please retry later"}Cancellation outcome is unknown: a transport failure or timeout may happen after submission. Check the order status and, if still open, retry with a fresh nonce. Returns the unchanged { message, name } envelope.
Maintenance, a malformed JSON body, or an unhandled failure. Carries message, not error.
object
MaintenanceException (503), BadRequestException (malformed JSON) or InternalErrorException (500).
Example
{ "message": "Internal Error", "name": "InternalErrorException"}Upstream failure. Returns a fixed error message and detail.reason; upstream diagnostic text is not returned. chain_unavailable: retry later. already_withdrawn: settled; keep tracking delivery. nonce_used: this cancel’s outcome is unknown. The nonce may have been used by a lost-response retry of this cancel or another order’s cancel. Check order status and, if still open, retry with a fresh nonce. upstream_storage: retryable; retry later with a fresh nonce while still open. order_not_found_upstream: the upstream contradicts the API’s published record; contact support. operator_rejected: server fault; contact support. rejected: another rejection; check status and contact support if it persists.
object
object
Cancellation failure class. Use this value to decide what to do; upstream diagnostic text is not returned.
Example
{ "error": "Cancellation outcome is unknown. Check the order status and, if still open, retry with a fresh nonce.", "detail": { "reason": "nonce_used" }}