Skip to main content
All cancel endpoints require L2 authentication. The response always includes canceled (list of cancelled order IDs) and not_canceled (map of order IDs to failure reasons).

Cancel a Single Order

const resp = await client.cancelOrder("0xb816482a...");
console.log(resp);
// { canceled: ["0xb816482a..."], not_canceled: {} }

Cancel Multiple Orders

const resp = await client.cancelOrders(["0xb816482a...", "0xc927593b..."]);

Cancel All Orders

Cancel every open order across all markets:
const resp = await client.cancelAll();

Cancel by Market

Cancel all orders for a specific market, optionally filtered to a single token. Both market and asset_id are optional — omit both to cancel all orders.
const resp = await client.cancelMarketOrders({
  market: "0xbd31dc8a...", // optional: condition ID
  asset_id: "52114319501245...", // optional: specific token
});

Querying Orders

Get a Single Order

const order = await client.getOrder("0xb816482a...");
console.log(order.status, order.size_matched);

Get Open Orders

Retrieve all open orders, optionally filtered by market or token:
// All open orders
const orders = await client.getOpenOrders();

// Filtered by market
const marketOrders = await client.getOpenOrders({
  market: "0xbd31dc8a...",
});

// Filtered by token
const tokenOrders = await client.getOpenOrders({
  asset_id: "52114319501245...",
});

OpenOrder Object

FieldTypeDescription
idstringOrder ID
statusstringCurrent order status
marketstringCondition ID
asset_idstringToken ID
sidestringBUY or SELL
original_sizestringSize at placement
size_matchedstringAmount filled
pricestringLimit price
outcomestringHuman-readable outcome (e.g., “Yes”, “No”)
order_typestringOrder type (GTC, GTD, FOK, FAK)
maker_addressstringFunder address
ownerstringAPI key of the order owner
associate_tradesstring[]Trade IDs this order has been included in
expirationstringUnix expiration timestamp (0 if none)
created_atstringUnix creation timestamp

Trade History

When an order is matched, it creates a trade. Trades progress through these statuses:
StatusTerminalDescription
MATCHEDNoMatched and sent for onchain submission
MINEDNoMined on the chain, no finality yet
CONFIRMEDYesAchieved finality — trade successful
RETRYINGNoTransaction failed — being retried
FAILEDYesFailed permanently
// All trades
const trades = await client.getTrades();

// Filtered by market
const marketTrades = await client.getTrades({
  market: "0xbd31dc8a...",
});
Additional filter parameters: id, maker_address, asset_id, before, after. The Rust SDK uses cursor-based pagination via the next_cursor parameter:
const page = await client.getTradesPaginated({ market: "0xbd31dc8a..." });
console.log(page.trades, page.count); // trades array + total count

Trade Object

FieldTypeDescription
idstringTrade ID
taker_order_idstringTaker order hash
marketstringCondition ID
asset_idstringToken ID
sidestringBUY or SELL
sizestringTrade size
pricestringExecution price
fee_rate_bpsstringFee rate in basis points
statusstringTrade status (see table above)
match_timestringUnix timestamp when matched
last_updatestringUnix timestamp of last status change
outcomestringHuman-readable outcome (e.g., “Yes”)
maker_addressstringMaker’s funder address
ownerstringAPI key of the trade owner
transaction_hashstringOnchain transaction hash
bucket_indexnumberIndex for trade reconciliation
trader_sidestringTAKER or MAKER
maker_ordersMakerOrder[]Maker orders that filled this trade
A single trade can be split across multiple onchain transactions due to gas limits. Use bucket_index and match_time to reconcile related transactions back to a single logical trade.

Order Scoring

Check if your resting orders are eligible for maker rebates scoring:
// Single order
const scoring = await client.isOrderScoring({ orderId: "0x..." });

// Multiple orders
const batch = await client.areOrdersScoring({
  orderIds: ["0x...", "0x..."],
});

Next Steps

Order Attribution

Attribute orders to your builder account for volume credit

Fees

Understand fee structures and maker rebates