Skip to main content
POST
Cancel a batch of orders by id (max 100)

Authorizations

X-Api-Key
string
header
required

Partner / integrator key — format ps_live_<keyId>_<secret>. Partner keys are issued by PredictStreet; a user can also create keys bound to their own wallet from their account settings in the web app. Never ship to a browser. multi_wallet partners must additionally send X-User-Wallet: 0x<40-hex> on every authenticated request to declare the acting wallet. See the API keys guide for scope taxonomy, partner kinds, rate limits, and rotation procedure.

Headers

X-User-Wallet
string

Required for multi_wallet partners on every authenticated request; ignored for single_wallet. Declares the acting end-user wallet for this request — drives KYC checks, balances/positions/orders attribution, rate-limit buckets, and audit. Lower-cased server-side. Missing on a multi_wallet key → 401 api_key_user_wallet_required; malformed → 401 api_key_user_wallet_invalid. The on-chain CTFExchange/Vault contracts still verify EIP-712 signer ↔ vault binding, so loosening API-layer attribution is safe by construction.

Pattern: ^0x[a-fA-F0-9]{40}$
Example:

"0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb3"

Body

application/json
orderIds
string[]
required

1–100 server-side order ids (UUIDs). Duplicates are de-duplicated server-side.

Required array length: 1 - 100 elements

Response

Per-id outcome split into cancelled and notCancelled, with remainingQty for each cancelled id.

cancelled
string[]
required

Ids whose cancellation was accepted. Acceptance and effect are separate moments: the status flip and the release of the residual collateral (BUY) / ERC-1155 reservation (SELL) can follow the acceptance, so a read of the order taken right after this response can still show the pre-cancel status — poll the order rather than assuming. Each id stands on its own: another id failing does not undo it.

notCancelled
object
required

Map of orderId → reason for every id that was not cancelled. Reasons: not_found (unknown id, or an order owned by another wallet — no existence leak), already_terminal (already CANCELLED / FILLED / REJECTED / EXPIRED — idempotent), not_attempted (the request stopped before reaching this id and nothing was tried — retry exactly these ids), placement_unanswered (the order's own placement has not been answered yet — retry after a short delay), termination_refused (the cancel was attempted and refused for this request; re-read the order and send a fresh cancel), cancel_pending (the cancel is recorded and no answer to it is recorded yet — the same condition the single cancel answers 202 cancel_pending with Retry-After: 5. Cancel the ids named this way again after a few seconds, with a single cancel or a cancel-batch of exactly those ids — from cancel-all too: a new cancel-all is a new sweep that also cancels orders placed since. Repeating the cancel of an id is safe, cannot cancel twice, and is what completes it soonest; the platform may also complete it on its own. It does not mean the order is still open — it may have filled — so re-read the order), termination_unavailable (no verified answer on whether the cancel was recorded — re-read the order; resending the same cancel cannot cancel twice), financial_obligation_protected (a settlement this order took part in has not finished applying; usually clears within seconds — re-read the order and contact support if it persists), lock_invariant (returned only by older exchange nodes: the order's collateral bookkeeping was inconsistent; current nodes record it and cancel the order; re-read the order; the rest of the batch is unaffected), unknown (unexpected error — treat as transient and re-read the order).

remainingQty
object
required

Map of orderId → quantity still unfilled when that order was cancelled (decimal string), for exactly the ids in cancelled; {} when cancelled is empty. An upper bound, not a traded quantity: size a replacement quote from it, and book fills from the order read.