Skip to content
MyStocks Developers
API v1

API v1

Current stable contract

Versioning policyRelease changelog
Sandbox console

Cancel sub-account order

Sub-Accounts & White-Label Retail KYC

DELETE

/users/{userId}/orders/{orderId}

Cancel sub-account order

Sandbox availabledeleteUsersUserIdOrdersOrderId

Cancels an active PENDING or WORKING order on a sub-account and releases reserved cash or units. Available in production and sandbox; terminal orders return a conflict/error response.

Parameters

userIdstringpathRequired

Example: usr_abc123

orderIdstringpathRequired

Example: ord_abc123xyz

Headers

AuthorizationstringRequired

Bearer sk_sandbox_<your_key> for sandbox requests.

Idempotency-KeystringheaderRequired

Unique string that makes write calls safe to retry on network failure. Required for money movement, trading, KYC, subscriptions, and webhook creation. Deduplicated for 24 hours -- duplicate keys return the cached response. HTTP 409 if a concurrent request with the same key is still in progress.

Example: dep_user42_1743152580

Response fields

orderIdstring
subAccountIdstring
externalIdstring | null
typeBUY | SELL
symbolstring
quantitynumber
statusCANCELLED
refundednumber

USD amount returned to sub-account wallet. Present for BUY orders only.

currencystring

Example: "USD"

messagestring

Response codes

200Order cancelled. BUY escrow refunded to sub-account wallet atomically.
409Order cannot be cancelled — it is no longer PENDING.