Batch Operations
Batch endpoints allow placing or canceling multiple orders in a single request. Essential for market makers who need to update quotes across multiple price levels simultaneously.
Batch Place Orders
POST /v1/orders/batch
Scope: trade:bulk
Place up to 50 orders in a single request. Each order is processed independently — partial success is possible.
Request Body
{
"orders": [
{
"market_id": "...",
"side": "BUY",
"maker_amount": "500000",
"taker_amount": "1000000",
"token_id": "...",
"maker": "0x...",
"signer": "0x...",
"taker": "0x0000000000000000000000000000000000000000",
"salt": "111",
"nonce": 0,
"expiration": 0,
"fee_rate_bps": 200,
"signature": "0x...",
"outcome_index": 0,
"time_in_force": "GTC"
},
{
"market_id": "...",
"side": "SELL",
"maker_amount": "1000000",
"taker_amount": "500000",
...
}
]
}
Response
{
"results": [
{
"index": 0,
"success": true,
"order_id": "...",
"order_hash": "0x...",
"status": "open",
"matches": 0
},
{
"index": 1,
"success": false,
"error": "invalid signature"
}
],
"placed": 1,
"failed": 1
}
Batch Cancel Orders
DELETE /v1/orders/batch
Scope: trade:bulk
Cancel multiple orders by their hashes.
Request Body
{
"order_hashes": [
"0xabc123...",
"0xdef456..."
]
}
Response
{
"results": [
{ "order_hash": "0xabc123...", "success": true },
{ "order_hash": "0xdef456...", "success": false, "error": "order not found" }
],
"cancelled": 1,
"failed": 1
}
Cancel All Orders (Kill Switch)
DELETE /v1/orders/cancel-all
Scope: trade:bulk
Cancel all open orders for the authenticated user across all markets. This is the emergency kill switch for market makers.
Response
{
"cancelled": 47,
"message": "cancelled all open orders"
}
Cancel Market Orders
DELETE /v1/orders/cancel-market?market_id=...&outcome_index=0
Scope: trade:bulk
Cancel all open orders for the authenticated user in a specific market. Optionally filter by outcome index.
| Parameter | Type | Required | Description |
|---|---|---|---|
market_id | UUID | Yes | Market to cancel orders in |
outcome_index | int | No | Filter by outcome |
Response
{
"cancelled": 12,
"market_id": "..."
}
Heartbeat (Auto-Cancel)
POST /v1/orders/heartbeat
Scope: trade:orders
Send a heartbeat to keep your orders alive. If no heartbeat is received within 15 seconds, all open orders for the user are automatically cancelled.
Use this as a dead-man's switch to protect against network disconnections.
Request Body
{}
Response
{
"status": "ok",
"next_deadline": 1709136015
}