HTTP POST for all cancellations. PredictStreet uses
POST /api/orders/cancel,
POST /api/orders/cancel-batch, and POST /api/orders/cancel-all. Unlike exchanges
that use HTTP DELETE (such as Polymarket DELETE /orders or Binance DELETE /fapi/v1/batchOrders),
PredictStreet routes all cancellations over POST with JSON bodies to ensure
consistent authentication, request logging, and deterministic idempotency semantics.
Any HTTP DELETE /api/orders or DELETE /api/orders/:id request is unrouted and returns HTTP 404 Not Found.Cancel a single order
orderId must be a valid UUID v4 or v5 (matching GET /api/orders/{id}).
Any non-UUID-v4/v5 string is rejected at the gateway with 400 invalid_request
before reaching the exchange (RND-2440). The UUID may be in any hex
case: it is read in lowercase, so the orderId in every answer (and in
error details) is the lowercase UUID (RND-4823).
Response (HTTP 200):
remainingQty: The quantity still unfilled on the order at release time.filledQty(optional): The crossed quantity counted by the matching engine at the instant the order was released from the book.
200, not 404: cancellation is idempotent. Treat
CANCELLED, already_terminal and not_found all as “nothing left to
cancel” — a client that only whitelists CANCELLED and not_found will
read a re-cancel as a failure.
A quote that is still competing in an RFQ auction is not an order yet: cancel it with its quoteId on the RFQ maker API.
RFQ quotes (RND-1842): Live resting RFQ maker quotes can also be cancelled
via POST /api/orders/cancel, /cancel-batch, and /cancel-all (status: "CANCELLED"
with remainingQty, or already_terminal if the quote had already ended).
An RFQ order that cannot be ended by cancel is refused on /api/orders/cancel:
an RFQ quote that a confirm has taken with 409 rfq_order_taken (RND-2678;
it ends by its own fill or its own release), and an RFQ taker leg, an RFQ
quote that is partially filled or one whose reservation is not in
its side’s asset with 409 rfq_order_not_cancellable (it ends
by its own fill or its own hold). An exchange node not yet updated may still
answer a taken quote with rfq_order_not_cancellable, so treat both codes as
final. On /api/orders/cancel-batch and /api/orders/cancel-all such orders
are reported as termination_refused in notCancelled. Nothing is recorded
for such an order and the answer is final: do not retry the cancel. Both 409
answers carry error.retryable: false and the refused order’s id as
error.details.orderId (RND-3149); key on error.code.
202 cancel_pending: recorded, not complete yet
If the platform has recorded your cancel in the exchange journal but no
answer from the matching engine is recorded yet (for example while the
matching engine restarts), the response is HTTP 202 Accepted with a
Retry-After: 5 header:
Retry-After
(5 seconds) until it ends. Retrying with the same order id is safe: it finds
the same recorded cancel, so it cannot cancel twice. A retry asks the
matching engine again, so it completes the cancel as soon as the engine
answers. The platform also completes the cancel on its own, but that can
take several minutes after a long matching-engine outage, and the order can
fill in the meantime.
Until the cancel lands, the order may still be open and can still fill, so
no remainingQty is given. Its final status arrives on the
order WebSocket stream and on GET /api/orders/{id}.
That status is CANCELLED, or FILLED if the order filled first. A retry
can therefore be answered already_terminal. If a retry is answered
409 order_cancel_not_taken, the matching engine refused this cancel and
usually the order is still open; that refusal is final (see below).
Errors on a single cancel
Field-name conventions across the orders API:
- The cancel request and response use
orderId. - List/read endpoints (
GET /api/orders/open,/api/orders/history,/api/orders/{id}) return the same value underid. - The unfilled remainder is
remainingQtyeverywhere it surfaces (cancel response, order list/read). TreatorderIdandidas the same identifier for lookup; the variance is purely a request-vs-response convention.
Cancel a batch by ID
Cancel up to 100 orders by id in one request withPOST /api/orders/cancel-batch. Built for an MM re-quote tick: it collapses
N single cancels into one round-trip instead of N. It is not atomic: every
id is decided and reported on its own, so one id failing neither aborts the
request nor undoes the ids already in cancelled. Duplicate ids, including
the same UUID in another hex case, are processed once: the first occurrence
counts, and the response maps are keyed in the casing it was sent in;
error details carry the lowercase UUID (RND-4823).
cancelled and notCancelled, and
remainingQty gives each cancelled id’s unfilled quantity (same meaning
as on cancel-all):
Duplicate ids are de-duplicated server-side (processed once, reported once).
When the batch contains an id longer than 128 characters or containing a NUL
character,
notCancelled lists its ids in request order. An id longer than 1024
characters fails the whole request with 400 invalid_request, and nothing
is cancelled (RND-4156). If every id is longer than 128 characters or contains a NUL
character, the answer is
cancelled: [] with every id not_found, and nothing reaches the matching
engine.
409 shard_owned_elsewhere (error.retryable: true) and
503 shard_owner_unavailable mean no id was attempted: send the same batch
again (after Retry-After, 2 seconds, for shard_owner_unavailable). For
both, the platform has already re-sent the batch for about 6 seconds. 503 exchange_unavailable / exchange_transport_error
mean some ids may have been cancelled: re-read the orders, then resend.
Rate limited at 15 req/sec/wallet (token-bucket). No KYC / deposit-tier gating — cancellation is
the risk-reducing exit path and is always permitted.
Cancel all your open orders
associatedWallet, or the
X-User-Wallet on a multi_wallet key) across every market, side and
outcome. A request that names marketId, side or outcome, in the
body or in the query string, is refused with
400 cancel_all_takes_no_scope and nothing is cancelled. To cancel only
part of your book, see Cancelling a subset.
Response (HTTP 201) has the cancel-batch shape: cancelled,
notCancelled, remainingQty, and optional filledQty:
remainingQty value as an upper bound: size a
replacement quote from it, but book fills from the order read
(GET /api/orders/{id}), not from quantity − remainingQty. An
empty remainingQty ({}) next to a non-empty cancelled means the
figures were not returned — never read it as zero left; read the orders
instead.
Account gate differences
UnlikePOST /api/orders/cancel-batch (which is exempt from compliance
gates to facilitate risk reduction), POST /api/orders/cancel-all enforces
standard write gates (like every cancel route, it has no geo check):
- Refused with
403 user_pausedif the wallet is paused, or403 rg_freezeunder a responsible-gambling freeze (which keeps your open orders resting, so cancel them by ID). - Refused with
401 account_blocked/401 account_closed/401 wallet_bannedif the account is banned, blocked, or closed (Bearer and single-wallet API keys;403 account_unavailableon a multi-wallet API key). - Refused with
412 consent_requiredif the Terms require re-acceptance. Signed-in sessions only: a request made with anX-Api-Keyis never gated on consent. - Refused with
503 platform_frozenwhile platform trading is frozen.
POST /api/orders/cancel-batch to cancel orders by ID.
A banned, blocked or closed account can do so only with an X-Api-Key; a
session token is refused with 401.
Failure answers
The failure answers mean different things:409 shard_owned_elsewhere: The request reached an exchange node that does not manage this wallet’s partition. Nothing was attempted (error.retryable: true); repeat the call immediately. The platform does not re-send a cancel-all itself.409 cancel_all_running: A previous cancel-all sweep for this wallet is currently running. Repeat afterretryAfterSec.429 exchange_client_saturated: The gateway queue has reached capacity; repeat afterretryAfterSec.503 shard_owner_unavailable: The exchange node partition is restarting. Nothing was attempted; retry afterRetry-After: 2.503 cancel_all_unknown/503 exchange_unavailable: The outcome of the sweep was lost in transit. Some orders may have been cancelled while others remain open. Do not re-issue cancel-all automatically; checkGET /api/orders/openfirst to see what remains open.503 platform_frozen: Trading is frozen across the entire platform.
Cancelling a subset
Cancel-all cannot be narrowed. To pull only part of your book (for example, all your asks on outcome 0 of one market), list those orders with the filters onGET /api/orders/open, then cancel the returned
ids with POST /api/orders/cancel-batch
(up to 100 ids per call):
What a cancel does
A successful cancel takes the order off the book and ends it asCANCELLED. The collateral locked for its unfilled remainder (USDC on a
BUY, outcome tokens on a SELL) returns to available. The status change
and the collateral release can follow the cancel response rather than
land with it, so a read made right after the response can briefly still
show the order’s previous status with its collateral locked — re-read
rather than assume.
Cancelling an order that has already ended changes nothing and answers
already_terminal, so repeating a cancel is safe.