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 ECDSA signatures recovering to the depositor or the delegate operator are 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.
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, or rootIntentId is not this order’s.
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.
Largest output that would quote, in destination 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.
Largest output that would quote, in destination 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.
Largest output that would quote, in destination 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.
Largest output that would quote, in destination base units.
The deployment setting this direction needs.
Example
{ "error": "Order not found"}Not published yet, so there is nothing to cancel.
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.
Largest output that would quote, in destination 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."}Unhandled failure. Retry once, then escalate with the x-request-id response header.
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"}The cancel was rejected or temporarily unavailable. Re-read the order and rejection. Fix a wrong signer or malformed signature before retrying; a fresh nonce does not fix either. For a reused nonce or temporary failure, retry with a fresh nonce only while the order is still open.
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.
Largest output that would quote, in destination base units.
The deployment setting this direction needs.
Example generated
{ "error": "example", "detail": { "minSrcAmount": "example", "maxSrcAmount": "example", "maxOutcomeAmount": "example", "missing": "example" }}