Skip to content
UNHEDGED / DOCS

Search documentation

Browse docs or start typing to find a topic

↑ ↓ to navigate Enter to open Esc to close

Batch Replace Orders

POST https://api.unhedged.gg/api/v1/orders/replace/batch

Replaces 1–32 open Limit orders on one market. Each leg can supply its own revision using the single-replace rules; revisions are scoped to each open order lineage, not the batch. Replacements may fill; self-trade follows the market setting. Returns 200 when all legs succeed, or 400 with results in request order when a committed batch contains failures. A pre-trade rejection returns only a string err and keeps its source. A committed zero-fill InternalCancel includes err, cancellation/replacement IDs, and the replacement order; its source has been cancelled. Successful legs remain committed. Inspect every result before retrying any leg. Counts as one write against the place/replace rate budget. The example shows a mixed HTTP 400 response with selected order fields; source order 3 remains open.

Configure request

Request

Security · Bearer token

Send your API key in the Authorization header. Required scope order:place, order:cancel.

Rate limit · 120 req/min · 60 per market

Request body

marketId string
Required
Shared market ID (ORDER_BOOK, active).
replaces array
Required
1–32 legs: exactly one of orderId / clientOrderId, price, quantity (total fill limit), optional replacementClientOrderId / postOnly / revision. Each revision is a positive safe integer (1–9007199254740991) for that open order lineage. A stale leg returns err: stale order revision; other legs can succeed. Send postOnly: true on maker-only full replaces and size decreases.
Authorization
Bearer token Authorization: Bearer ak_your_key_here
Body application/json
curl -X POST https://api.unhedged.gg/api/v1/orders/replace/batch \
  -H "Authorization: Bearer ak_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "marketId": "clx...",
  "replaces": [
    { "orderId": "1", "price": "0.52", "quantity": "10.00", "revision": 12 },
    { "orderId": "2", "price": "0.57", "quantity": "10.00", "revision": 3 },
    { "orderId": "3", "price": "0.62", "quantity": "10.00", "postOnly": true }
  ]
}'
Response
{
  "error": "One or more orders in the batch failed",
  "results": [
    {
      "cancelledOrderId": "1",
      "replacementOrderId": "4",
      "replacementOrder": {
        "id": "4",
        "status": "Placed",
        "price": "0.52",
        "quantity": "10.00",
        "revision": 12,