Skip to content

Cancel an order

Cancel one resting order by order_id. A cancel is a request, not a guarantee: a fill can land while yours is in flight. An order_id the account does not own returns 404; every other rejection is a 422. Requires a read_write key.

DELETE
/api/v1/orders/{order_id}
Try it

Every endpoint, in one place: the full Try it.

Signing happens in your browser with WebCrypto. Your private key is never sent anywhere; Send request sends your key ID and the signature to the demo host above. Only demo hosts are offered. The key ID and private key are saved in this browser's local storage, per jurisdiction, until you click Clear saved key. Use a demo key here, never a production one.

Name In Type Required Description
order_id path string (uuid) yes The order’s UUID.
Field Type Required Description
geo_location string,null no Location code from the STX geolocation check, covering this cancel. Read only in environments that enforce geo-fencing, and ignored elsewhere. Where it is read, omitting it is a 422 (Placing Order(s) from this IP address … is disallowed.) unless that environment accepts the network location the request arrives from in its place, which it can refuse for an address identified as a VPN, proxy or hosting provider. Do not rely on omitting it: send the code whenever you have one. A code that is sent is always checked, so a bad one is a 422 even where omitting it would have been accepted.
Status Description Schema
200 Success object
400 A parameter was missing or invalid. Error
401 Missing, malformed or unrecognized signature, or a timestamp outside the 30-second window. Body: {“error”:“Missing or invalid API key credentials”} Error
403 This API key does not have write access. The account behind this key is not active, for example it is pending approval or suspended. Body: {“error”:“Your account is suspended. Contact support.”}, the message naming the account’s status. Error
404 No such record on this account. Error
422 The cancel was refused, for example by the location check or because the order can no longer be cancelled. The body’s error says why. Error

Request:

curl --request DELETE \
--url 'https://demo.stxapp.io/api/v1/orders/{order_id}' \
--header 'X-STX-ACCESS-KEY: <key-id>' \
--header 'X-STX-ACCESS-TIMESTAMP: <unix-ms>' \
--header 'X-STX-ACCESS-SIGNATURE: <base64-ed25519>' \
--header 'Content-Type: application/json' \
--data '{
"geo_location": null
}'

Response 200:

{
"order_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
"status": "cancelled"
}
Field Type Description
order_id uuid The order that was cancelled.
status string The order’s status after cancelling.
v1.5.9Changelogllms.txtllms-full.txt