Skip to content
MyStocks Developers
API v1

API v1

Current stable contract

Versioning policyRelease changelog
Sandbox console

Advance a sandbox test order

Developer Platform, Sandbox & Key Management

PATCH

/test-tools/orders/{orderId}

Advance a sandbox test order

Sandbox onlyupdateTestToolsOrder

Sandbox-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

orderIdstringpathRequired

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

Request body

subAccountIdstringRequired
actionFILL | PARTIAL_FILL | REJECT | CANCEL | SETTLE | FAIL_SETTLEMENT | EXPIRERequired
quantitynumber

Required for PARTIAL_FILL and must be less than the remaining quantity.

unitPriceUsdnumber

Optional deterministic fill price; defaults to the order price.

notestring
rejectionCodeINSUFFICIENT_FUNDS | KYC_REQUIRED | MARKET_CLOSED | COMPLIANCE_HOLD | TECHNICAL_ISSUE | OTHER

Only 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.