Skip to main content
POST
/
v1
/
pm
/
orders
/
batch
Batch place orders
curl --request POST \
  --url https://relay.bayse.markets/v1/pm/orders/batch \
  --header 'Content-Type: application/json' \
  --data '
{
  "orders": [
    {
      "outcomeId": "<string>",
      "side": "<string>",
      "type": "<string>",
      "amount": 123,
      "currency": "<string>",
      "price": 123,
      "timeInForce": "<string>",
      "postOnly": true,
      "maxSlippage": 123,
      "expiresAt": "<string>",
      "stpMode": "<string>",
      "clientOrderId": "<string>"
    }
  ]
}
'
{
  "engine": "CLOB",
  "results": [
    {
      "index": 0,
      "clientOrderId": "mm-001",
      "success": true,
      "order": {
        "id": "f6a7b8c9-d0e1-2345-fabc-678901234567",
        "marketId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "userId": "9a8b7c6d-5e4f-3210-abcd-ef1234567890",
        "outcome": "YES",
        "side": "BUY",
        "orderType": "LIMIT",
        "type": "GTC",
        "status": "open",
        "amount": 100,
        "price": 0.70,
        "size": 100,
        "filledSize": 0,
        "remainingSize": 100,
        "avgFillPrice": 0,
        "fee": 0,
        "postOnly": false,
        "stpMode": "SKIP",
        "quantity": 0,
        "createdAt": "2026-05-04T12:00:00Z",
        "updatedAt": "2026-05-04T12:00:00Z"
      }
    },
    {
      "index": 1,
      "clientOrderId": "mm-002",
      "success": false,
      "error": {
        "code": "INSUFFICIENT_BALANCE",
        "message": "Insufficient USD balance for this order"
      }
    }
  ],
  "summary": { "total": 2, "succeeded": 1, "failed": 1 }
}

Documentation Index

Fetch the complete documentation index at: https://docs.bayse.markets/llms.txt

Use this file to discover all available pages before exploring further.

Submit up to 20 CLOB orders in a single request. Orders may span multiple markets and events — each item carries only outcomeId, and the server resolves the parent market and event. CLOB-only: AMM markets are rejected per-order with UNSUPPORTED_ENGINE. See the Batch orders concept page for limits, semantics, and rate-limit behavior.

Authentication

Write authentication required — X-Public-Key, X-Timestamp, and X-Signature headers. See the Authentication guide.

Headers

Idempotency-Key
string
Optional. 1–255 characters of [A-Za-z0-9_-]. Retries within 24 hours that share the same key, body, and route replay the original response with Idempotent-Replayed: true. A retry with the same key but a different body is rejected with 422. A concurrent retry (sent while the first is still in flight) is rejected with 409 — back off briefly and retry once the first call has finished. Transient responses (5xx, 429, 408) are not cached, so you can recover by retrying.

Request body

orders
array
required
1–20 order items. Each item is processed independently — one bad item does not abort the others.

Example request

PUBLIC_KEY="pk_live_abcdef123456"
SECRET_KEY="sk_live_secret789xyz"
TIMESTAMP=$(date +%s)
METHOD="POST"
URL_PATH="/v1/pm/orders/batch"
BODY='{"orders":[{"outcomeId":"c3d4e5f6-a7b8-9012-cdef-345678901234","side":"BUY","type":"LIMIT","amount":100,"price":0.70,"timeInForce":"GTC","clientOrderId":"mm-001"},{"outcomeId":"d4e5f6a7-b8c9-0123-defa-456789012345","side":"SELL","type":"LIMIT","amount":50,"price":0.32,"timeInForce":"GTC","clientOrderId":"mm-002"}]}'

BODY_HASH=$(printf '%s' "$BODY" | openssl dgst -sha256 -hex 2>/dev/null | sed 's/.*= //')
PAYLOAD="${TIMESTAMP}.${METHOD}.${URL_PATH}.${BODY_HASH}"
SIGNATURE=$(printf '%s' "$PAYLOAD" | openssl dgst -sha256 -hmac "$SECRET_KEY" -binary | base64)

curl -X POST "https://relay.bayse.markets${URL_PATH}" \
  -H "X-Public-Key: ${PUBLIC_KEY}" \
  -H "X-Timestamp: ${TIMESTAMP}" \
  -H "X-Signature: ${SIGNATURE}" \
  -H "Idempotency-Key: 9d3f2c0e-7b1a-4e5d-9f80-3a8b1c2d4e5f" \
  -H "Content-Type: application/json" \
  -d "$BODY"

Response

engine
string
Always CLOB for batch endpoints today.
results
array
Per-order outcomes, in the same order as the request.
summary
object
{
  "engine": "CLOB",
  "results": [
    {
      "index": 0,
      "clientOrderId": "mm-001",
      "success": true,
      "order": {
        "id": "f6a7b8c9-d0e1-2345-fabc-678901234567",
        "marketId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "userId": "9a8b7c6d-5e4f-3210-abcd-ef1234567890",
        "outcome": "YES",
        "side": "BUY",
        "orderType": "LIMIT",
        "type": "GTC",
        "status": "open",
        "amount": 100,
        "price": 0.70,
        "size": 100,
        "filledSize": 0,
        "remainingSize": 100,
        "avgFillPrice": 0,
        "fee": 0,
        "postOnly": false,
        "stpMode": "SKIP",
        "quantity": 0,
        "createdAt": "2026-05-04T12:00:00Z",
        "updatedAt": "2026-05-04T12:00:00Z"
      }
    },
    {
      "index": 1,
      "clientOrderId": "mm-002",
      "success": false,
      "error": {
        "code": "INSUFFICIENT_BALANCE",
        "message": "Insufficient USD balance for this order"
      }
    }
  ],
  "summary": { "total": 2, "succeeded": 1, "failed": 1 }
}
Batch calls are charged per item against your write rate-limit bucket — a 20-order batch costs 20 tokens. Over-budget batches are rejected with 429 before any orders reach the matching engine. See Rate limits.