Clients authenticated with Session
Keys can only fetch orders
and trades associated with those Session Keys. Deposit Wallet Owners
cannot fetch orders from authorized Session Keys.
Fetch an Order
Look up a single order by its ID. Use this to check the current status of an order you already know about, rather than scanning the full list of open orders.- TypeScript
- Python
- API
Call The method returns an The unified SDK uses
fetchOrder() on a SecureClient to fetch an order by ID:OpenOrder with normalized asset, decimal, and date
values:assetId for an outcome’s trading identifier: a token
ID for a CTF market or a position ID for a Polymarket Protocol V2 market.
Use the identifier exposed for that outcome.expiresAt is present when the response includes an expiration. Otherwise,
the field is omitted.List Open Orders
Retrieve every resting order on the account, optionally narrowed to one outcome or market. Filtering by a specific order ID can also return a canceled or fully matched order.- TypeScript
- Python
- API
Call Pass a filter to narrow the results. Despite its name, Each page contains
listOpenOrders() on a SecureClient to iterate over the account’s
open orders:market takes the
market’s condition ID:OpenOrder items:List Account Trades
Retrieve executed fills for the account, as opposed to orders that are still resting on the book. Use this to reconstruct fill history, compute realized position size, or audit what actually matched.- TypeScript
- Python
- API
Call Pass a filter to narrow the results. Despite its name, Each page contains
listAccountTrades() on a SecureClient to iterate over the
account’s trades:market takes the
market’s condition ID:ClobTrade items:status through settlement.
List Builder Trades
Retrieve matched trades attributed to a builder code across the accounts your application serves. Use this instead of an account trade read when you need to reconcile fills or measure activity for the builder integration as a whole. Orders do not appear here until they match.- TypeScript
- Python
- API
Call Pass a filter to narrow the results:Each page contains
listBuilderTrades() on a PublicClient or SecureClient to iterate over
trades attributed to your builder code:BuilderTrade items:Cancel Orders
Cancel only as broadly as needed. Start with known order IDs, use a market or asset filter when withdrawing a set of quotes, and reserve account-wide cancellation for exceptional situations. Cancellation remains available while the exchange is in cancel-only mode, when new orders are rejected. For a partially filled order, cancellation removes only its unfilled remainder, including when the market resolves. It preserves the original and matched sizes and does not undo settled fills.Cancel Orders by ID
Cancel one order when you know its ID. To cancel a known set of orders in one request, submit a batch of up to 3,000 IDs. Duplicate IDs in the batch are ignored.- TypeScript
- Python
- API
Call Call
cancelOrder() on a SecureClient to cancel one order:cancelOrders() to cancel several known orders in one request:Cancel Market Orders
Cancel by outcome to withdraw orders for one outcome, or by market to withdraw orders for every outcome in the condition. At least one filter is required.- TypeScript
- Python
- API
Call The
cancelMarketOrders() on a SecureClient with an asset ID or condition
ID:market field takes the market’s condition ID.Cancel All Orders
Use account-wide cancellation when you need to remove every resting order, such as during an emergency shutdown.- TypeScript
- Python
- API
Call
cancelAll() on a SecureClient:Cancellation Results
A cancellation can succeed for only some of the requested orders. Reconcile the result before retrying: it identifies the orders that were canceled and gives a reason for each order that could not be canceled.- TypeScript
- Python
- API
The TypeScript SDK returns a In this example, one order was canceled and another could not be canceled
because it had already matched:
CancelOrdersResponse:Type
Example
Order Heartbeats
Use order heartbeats to request cancellation of your API key’s open orders if its trading process stops responding. Each SDK call sends one request. Your application owns the ongoing heartbeat loop and failure handling. After 10 seconds without an accepted heartbeat, the server detects expiry on its five-second scan and queues a cancel-all attempt. Cancellation is best effort: queue delays, service failures, or orders that cannot be canceled can prevent or delay completion. Ten seconds is the expiry threshold, not a guaranteed cancellation time. WebSocket keepalive does not refresh this deadline.- TypeScript
- Python
- API
Call Await every send before the next one and retain the latest returned
sendOrderHeartbeat() on a SecureClient with the same API key that owns
your orders. The first call uses an empty ID by default.heartbeatId. A mismatch error contains the expected ID. The explicit retry
above uses it to recover. A rejected send does not refresh the deadline. The
SDK provides a single request per call. The loop owns scheduling and recovery.Heartbeat FAQ
Can multiple processes send heartbeats with the same API key?
Can multiple processes send heartbeats with the same API key?
Use one coordinated sender per API key and wait for each send to finish
before sending the next. Concurrent sends can race over the rotating
heartbeat ID. Every accepted heartbeat covers all open orders owned by that
key, across markets and processes.
How do I recover from a heartbeat ID mismatch?
How do I recover from a heartbeat ID mismatch?
A rejected request does not refresh the deadline. Retry with the expected
ID from the mismatch response, then save the ID returned by the successful
retry. The expected ID can be empty if another integration sent a legacy
heartbeat request.The SDK examples above retry the first mismatch once. A second mismatch
raises an error for your application to handle.
What should I do if a heartbeat request fails?
What should I do if a heartbeat request fails?
Stop placing new orders and check your outstanding orders. The examples
above propagate authentication, payload, rate-limit, transport, and response
errors to your application.A request can succeed even if its response is lost. An SDK exception does
not tell you whether the heartbeat registration is active or whether the
server has rotated the ID.
How do I stop sending heartbeats?
How do I stop sending heartbeats?
Stop placing orders, cancel the orders you want to remove, and verify the
cancellations before stopping the heartbeat loop.Stopping the loop or closing the client leaves the server’s deadline
active. There is no disarm operation that lets you immediately disable the
timeout while keeping existing orders live.
What happens after the heartbeat times out?
What happens after the heartbeat times out?
The server removes the heartbeat registration, then attempts to cancel the
orders. Cancellation is best effort. Check the cancellation results and
outstanding orders rather than assuming every order is gone. The server
does not keep canceling later orders indefinitely.A later accepted heartbeat registers the API key again. Before resuming
quoting, reconcile open orders. A successful heartbeat does not tell you
whether orders placed before the outage survived or were canceled.
Check Closed-Only Mode
Closed-only mode is an account-level circuit breaker for a market. When it’s on, the account can only place orders that reduce an existing position, not new opening orders. Check this before placing an order if you want to fail fast instead of waiting for a rejection.- TypeScript
- Python
- API
Call The method returns the account’s closed-only state as a boolean:
fetchClosedOnlyMode() on a SecureClient:Check Order Scoring
An order scores when it is live on a market with liquidity rewards and meets the market’s minimum qualifying size, maximum qualifying spread, and required live duration. Because eligibility changes as the order book moves, treat the result as a point-in-time check.- TypeScript
- Python
- API
Call To check the scoring status of several orders in one request, call
The response maps each order ID to its scoring status:
fetchOrderScoring() on a SecureClient with the order ID:fetchOrdersScoring() with their IDs: