Skip to content
UNHEDGED / DOCS

Search documentation

Browse docs or start typing to find a topic

↑ ↓ to navigate Enter to open Esc to close

Replace Order

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

Replace or amend an open Limit order. quantity is the total fill limit (filled + desired remaining). Same-price size decrease keeps id/FIFO priority (status "amended") or cancels when nothing remains ("cancelled"). Price change or size increase cancel+places a new Limit sized to total − fills. Send postOnly: true on maker-only full replaces and on size decreases (would-take is skipped on decreases; postOnly still avoids maker-protection delay). Requires order:place and order:cancel.

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
Market ID (must be ORDER_BOOK and active).
orderId string
Optional
Numeric string ID of the open Limit order to replace. Exactly one of orderId / clientOrderId.
clientOrderId string
Optional
Client id of the open Limit order to replace. Exactly one of orderId / clientOrderId.
replacementClientOrderId string
Optional
Optional client id for the replacement/amend. Omit to inherit. Must not collide on an actual amend.
price string
Required
New limit price decimal string in (0,1) with exactly 2 decimals.
quantity string | integer
Required
Total fill limit (filled + desired remaining) in human shares: 0–2 decimal string or whole-contract integer. quoteQuantity is not supported.
revision integer
Optional
Optional positive safe integer (1–9007199254740991) for this open order lineage. Must exceed its last accepted value; otherwise returns "stale order revision" without changing the order. Follows replacements and alias renames and survives engine restarts. Omit for legacy behavior, preserving the stored revision. Cancellation or full fill ends the lineage; use a fresh clientOrderId for a new order.
postOnly boolean
Optional
Defaults to false on each request; not inherited from the source order. Send true for maker-only full replaces and for size decreases (avoids maker-protection delay; would-take is skipped on decreases). Would-take on a full replace keeps the source.
Authorization
Bearer token Authorization: Bearer ak_your_key_here
Body application/json
curl -X POST https://api.unhedged.gg/api/v1/orders/replace \
  -H "Authorization: Bearer ak_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
  "marketId": "clx...",
  "clientOrderId": "bot-42",
  "price": "0.64",
  "quantity": "50.00",
  "revision": 12,
  "postOnly": true
}'
Response
{
  "result": {
    "cancelledOrderId": "213",
    "replacementOrderId": "214",
    "cancelledOrder": { "id": "213", "status": "Cancelled", ... },
    "replacementOrder": {
      "id": "214",
      "status": "Placed",
      "price": "0.64",
      "quantity": "50.00",
      "client_order_id": "bot-42",
      "revision": 12,