Advance a sandbox test order
Developer Platform, Sandbox & Key Management
/test-tools/orders/{orderId}
Advance a sandbox test order
updateTestToolsOrderSandbox-only deterministic execution control. Advance an isolated PENDING or PARTIALLY_FILLED test order through fill, partial fill, rejection, cancellation, or settlement failure. A fully filled order can be marked settled. The operation updates virtual wallet reservations, holdings, execution records, and signed webhooks without contacting an exchange or requiring MyStocks staff. EXPIRE releases only remaining reservations and preserves completed fills. It emits order.cancelled with EXPIRED lifecycle. REJECT accepts a published rejectionCode. Frozen accounts permit expiry, cancellation, rejection and marking an existing fill settled, but all new fills including FAIL_SETTLEMENT are blocked. Owned external IDs resolve to canonical subAccountId.
Parameters
orderIdstringpathRequiredHeaders
AuthorizationstringRequiredBearer sk_sandbox_<your_key> for sandbox requests.
Idempotency-KeystringheaderRequiredUnique 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
Request body
subAccountIdstringRequiredactionFILL | PARTIAL_FILL | REJECT | CANCEL | SETTLE | FAIL_SETTLEMENT | EXPIRERequiredquantitynumberRequired for PARTIAL_FILL and must be less than the remaining quantity.
unitPriceUsdnumberOptional deterministic fill price; defaults to the order price.
notestringrejectionCodeINSUFFICIENT_FUNDS | KYC_REQUIRED | MARKET_CLOSED | COMPLIANCE_HOLD | TECHNICAL_ISSUE | OTHEROnly for action REJECT; defaults to OTHER. Expiry has no rejection code.
Response fields
See the response format and API Reference for this endpoint.
Response codes
200Simulator transition applied.400Invalid simulator action or request body.404Sub-account or simulator order not found.409Transition conflicts with the current order state or reserved balance.