Skip to main content

Authentication

Trading

Orders

Cancelling never answers with an HTTP error for an unknown or already ended order: POST /api/orders/cancel returns 200 with status: "not_found" or status: "already_terminal". A cancel that is recorded but has no recorded answer yet returns 202 with status: "cancel_pending", code: "cancel_pending" and Retry-After: 5. Send the same cancel again after Retry-After until it ends. See Cancelling orders.

Bulk cancel — notCancelled reasons

POST /api/orders/cancel-all and POST /api/orders/cancel-batch answer per order, not per call: ids that were cancelled come back in cancelled, and every id that was not appears in notCancelled under one of the reasons below. These travel inside a success body — they are not error codes.

RFQ maker quotes

POST /api/v1/partner/rfq/quotes and POST /api/v1/partner/rfq/quotes/{quoteId}/cancel (RND-1845). The reasons on a rejected leg of a 200 are listed on the RFQ maker API page.

Partner trades and MM KPIs

Returned by GET /api/v1/partner/trades and GET /api/v1/partner/mm-kpis. See Trades and reconciliation.

Portfolio

Events

Returned by GET /api/events, /api/events/featured and /api/events/{slug}; the volume and closing-window codes also by GET /api/verticals; invalid_from, invalid_to, invalid_range and range_too_wide also by GET /api/upcoming. On most of these message is a generic string, so switch on code. The crypto filters (invalid_asset, invalid_cadence, invalid_exclude_cadence, invalid_frequency) are listed under Crypto markets.

Market data

Returned by the market read endpoints (GET /api/markets/{symbol}/executable-price, /orderbook, /price-history, /ohlc, /trades, /traders, and /traders/by-outcome; see Executable price for a size and Pagination).

Public profiles

Activity feed

Returned by GET /api/activity/recent.

Disputes feed

Returned by GET /api/challenges, GET /api/markets/{symbol}/challenges and GET /api/markets/{symbol}/challenges/{id} (RND-3900).

Crypto markets

Returned by the crypto read surfaces — GET /api/markets/{symbol}/crypto-price-history, GET /api/crypto-series/{id}/windows, GET /api/crypto-long-series/{id}/periods, and the crypto filters on GET /api/events (invalid_asset, invalid_cadence, invalid_exclude_cadence, invalid_frequency; the other GET /api/events codes are under Events).

Withdrawals

Withdrawal security (2FA & whitelist)

Gate codes returned by POST /api/withdrawals/request when the platform enforces withdrawal security (SSO partners exempt). See 2FA and Address whitelist. Codes returned by the management endpoints under /api/me/withdrawal-security/*:

Vault generation 2

Codes for wallets and markets on the second vault generation. See Vault generation 2.

Request body

A request body the server cannot read is refused before the endpoint runs: nothing is recorded, and message is a fixed sentence, never the parser’s text. Fix the request and send it again.

NUL characters

A NUL character (0x00) in text the database refuses (usually request text in the body, query or path, but also text stored earlier) on a REST route with no NUL check of its own is answered 400 invalid_request (message: request must not contain a NUL character; RND-4746); it used to be a 500. The same holds for a \u0000 in a JSON value the database stores as JSON (RND-5467; that case was still a 500 before). Unlike the request body refusals above, this answer comes after the endpoint started, when the database refused the text. Routes that check for NUL themselves keep the code listed in their section. Remove the NUL and send the request again.

Rate limits

Service-level

Handling strategy

  • 4xx codes — fix the client.
  • 2xx with code — business logic reject; surface to user. The order endpoints (POST /api/orders/place, POST /api/orders/place-batch) answer 201 both for accepted orders and for these business rejects, so branch on the body (status: "REJECTED", or success: false per batch entry), never on the HTTP code alone.
  • 429 — wait retryAfterSec then retry.
  • 5xx — exponential backoff with jitter; 3 attempts max for idempotent calls. To retry a write, resend the identical signed request and never re-sign it: orders under the same clientOrderId, withdrawals with the same salt. A resent order or withdrawal is never executed twice.

bad_signature diagnostic hints

When POST /api/orders/place (or an entry of POST /api/orders/place-batch) rejects with code: bad_signature, the details block takes one of two shapes depending on whether the signature bytes themselves were canonical (RND-2432):

1. Non-canonical signature encoding (details.signature_form)

The on-chain exchange contract (Signatures._verifyECDSA → OpenZeppelin 4.8 ECDSA.recover) accepts only the canonical 65-byte encoding: 0x + 130 hex characters (r ‖ s ‖ v), v in {27, 28} (0x1b or 0x1c), non-zero r and s, and low s <= secp256k1n / 2 (0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0, EIP-2). Standard ethers signTypedData and Python eth_account sign_typed_data emit this form natively. Any other byte representation (such as 64-byte EIP-2098 compact signatures, v = 0 or 1, EIP-155 v >= 35, zero r or s, or high s) is rejected before curve recovery with details: { expected_signer, signature_form } (without recovered or platform_canonical_struct):
signature_form reports why the encoding was refused:
  • not_hex — odd hex length. (A missing 0x prefix or non-hex characters are refused earlier by request validation with 400 invalid_request.)
  • length_<bytes> — byte length other than 65 (for example length_64 for EIP-2098 compact signatures).
  • v_<hex> — 65 bytes, but the final v byte is neither 1b (27) nor 1c (28), such as v_00, v_01, or EIP-155 v >= 35.
  • zero_r_or_s — r == 0 or s == 0.
  • high_s / high_s_top_bit — malleable upper-half s > secp256k1n / 2 (high_s below 2^255; high_s_top_bit at or above 2^255).
(Replays of orders committed before this gate under previously admitted forms — length_64, v_00, v_01, v >= 35, or high_s — that recover the signer still run the duplicate check and return order_already_placed.)

2. Canonical 65-byte signature recovering the wrong address (details.platform_canonical_struct)

When the signature is in canonical 65-byte form, details carries the recovered address and the platform’s reconstructed struct so you can diff your client struct in seconds:
recovered ≠ expected_signer ⇒ the digest you signed differs from what the platform reconstructs. Compare your client-side struct field-by-field against platform_canonical_struct. The platform’s values are authoritative — it builds every order’s struct the same way, so sign exactly these values:
  • maker — your vault of the market’s generation. Never your EOA, even when the request body’s maker field carries your EOA.
  • signatureType — always 1 (VAULT). 0 (EOA) is not supported: the platform verifies every order with 1, so a signature over 0 recovers a different address, and the exchange contract rejects any other value at settlement.
  • signer — your authenticated wallet (expected_signer).
  • taker — the zero address.
  • tokenId — the token of the outcome you are trading.
  • salt — the request’s nonce (decimal uint256 string).
  • expiration — the request’s expiry (Unix seconds, 0 = no expiry).
  • feeRateBps — the market’s feeTakerBps (GET /api/markets/{slug}), signed verbatim. Signing 0n while the platform reconstructs with 600 gives different digests and recovers a different address.
  • side — 0 for BUY, 1 for SELL.
  • makerAmount / takerAmount — derived from price × quantity (see the rounding rule).
If every field matches, check the domain: name PredictStreet, version 1, the chain’s chainId. verifyingContract is market.exchangeAddress on generation-2 markets, the neg-risk exchange for generation-1 markets with negRiskEligible: true, and the binary exchange for all other generation-1 markets. recovered: null ⇒ curve recovery failed on the 65-byte (r, s, v) tuple (for example r outside the secp256k1 field). Re-sign and resend. An order whose signature is canonical and recovers expected_signer with a non-zero expiry that has already passed or falls within the 60-second settlement safety window is refused with order_expiry_too_soon (400 on /place, per-entry REJECTED on /place-batch, with details.minExpiration), never bad_signature. Both addresses are checksum-cased — partner clients can compare with recovered === expected_signer directly. Every value in platform_canonical_struct is either user-supplied (already known to the partner) or platform-public market metadata, so no privacy concerns from logging the response.

maker_mismatch diagnostic hints

maker_mismatch (and its legacy alias wallet_mismatch on the non-order surfaces) is the platform’s authorization check that the request body’s maker belongs to the authenticated wallet: the wallet itself or one of its vaults. Specifically:
This check covers only the request body’s maker field. It is separate from what you sign: the EIP-712 Order.maker must always be the vault, with signatureType = 1. When the body carries your wallet, the platform substitutes the vault before it verifies the signature. A struct signed with maker = wallet therefore fails with bad_signature, not maker_mismatch. Three patterns produce this rejection in the wild: 1. Body maker belongs to a different wallet. The request body’s maker is wallet A (or A’s vault) while you authenticate as wallet B — your key’s associatedWallet, or the X-User-Wallet header for multi_wallet keys. The check runs per request and compares only the body maker, which must be B or one of B’s vaults. Placing orders for another user’s vault from an operator’s session is rejected by design — each end-user vault must be addressed under its own authenticated session. This check never inspects the signature: if the body maker is right but a different EOA signed the struct, you get bad_signature instead, with recovered ≠ expected_signer. 2. Stale local vaultOf cache during the deploy/observe race. If you send your vault as the request body’s maker, make sure your local vaultOf(wallet) cache is fresh. Order placement happens during a brief window where the on-chain vault may already exist but the off-chain mirror hasn’t yet observed the VaultCreated event. The placement handler re-reads the chain on cache miss, so the platform-side resolution is correct — but a stale value held by your client will pre-fail the check on your side before the request even reaches us. 3. Vault not deployed yet. Until VaultFactory.vaultOf(wallet) returns a vault, the only body maker that passes this check is the authenticated wallet itself; any other address is rejected with maker_mismatch. A wallet maker passes, but the order is then rejected with vault_not_deployed, because trading requires a deployed vault. The platform deploys vaults automatically (see Backend auto-deploy), or request one with POST /api/me/vault (vault:migrate or vault:write). Poll GET /api/me/vault until it reports deployed: true (deployStatus shows progress), then retry. The response shape differs by endpoint:
  • POST /api/orders/place returns 401 maker_mismatch. The gateway compares the request body’s maker with your authenticated wallet and its bound vault before the order is sent for signature verification or matching.
  • POST /api/orders/place-batch returns the same code as a per-entry REJECTED result (success: false) inside the normal response array. The other entries in the batch are still processed.
  • wallet_mismatch is a legacy alias with the same meaning. Where it still appears, it is returned as 403.
Treat both codes as the same condition. Diagnose with the three patterns above; the fix in all three cases is on the client side.

order_signed_with_floor_notional diagnostic hints

When POST /api/orders/place rejects with code: order_signed_with_floor_notional, the user signed a BUY order whose makerAmount was computed with integer FLOOR division ((priceWei * qtyWei) / 1_000_000n in JS — BigInt division truncates toward zero). For boundary tuples where price × qty doesn’t divide cleanly into 6-decimal wei, FLOOR underflows the canonical CEIL by 1 wei. Why we reject: FLOOR-signed BUY orders sit on the book with zero wei of headroom against the matcher’s per-fill CEIL math. On the last fill of a multi-fill match, the summed per-fill amounts can exceed the signed makerAmount by 1 wei → chain reverts MakingGtRemaining (selector 0xe2cc6ad6) → the TAKER absorbing this order (a different user, not the FLOOR signer) sees the failure. Rejecting at placement prevents the poison from reaching the book at all. Response envelope shape:
Fix: patch the makerAmount to details.expectedCeilMakerAmountWei and re-sign + re-submit. The SDK shouldn’t need to recompute the formula client-side — details carries the exact integer to use. Canonical CEIL formula (TypeScript / Python identical semantics):
The +1 wei vs FLOOR is sub-cent and economically meaningless, but the chain math cares about every wei. See Rounding rule section for the full asymmetric CEIL-BUY / FLOOR-SELL story. SELL orders are unaffected — SELL.makerAmount is the exact outcome-token quantity (qtyWei), no rounding involved. Only BUY hits this gate.