Modify Order

Amend a resting order's price and/or quantity in place.

PATCH /orders/{orderId}

Auth: Authorization: Bearer <access_token>.

Request Body

At least one of price or quantity must be supplied.

FieldTypeRequiredDescription
pricenumberConditionalNew price
quantitynumberConditionalNew total quantity (not a delta)

Only limit orders can be modified. peg order prices are derived from peg_reference and cannot be set directly — modify quantity instead. market orders and orders in a terminal state (FILLED, CANCELLED, REJECTED) cannot be modified.

Example

curl -X PATCH https://api.godarkdex.com/api/v1/orders/ord_01HXYZ12345 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "price": 96000,
    "quantity": 0.15
  }'

Success Response

{
  "code": 0,
  "data": {
    "order_id": "ord_01HXYZ12345",
    "price": 96000,
    "quantity": 0.15,
    "filled_quantity": 0.03,
    "remaining_quantity": 0.12,
    "status": "PARTIALLY_FILLED"
  },
  "timestamp": "2026-04-20T10:30:00.123Z",
  "request_id": "req_01HXYZ..."
}

Queue Priority

Modify is implemented as an atomic amend, not cancel-replace. Priority rules:

ChangeQueue priority
Quantity decrease onlyPreserved
Quantity increase (any)Lost (treated as a new entry at the new size)
Price change (any)Lost (re-enters the book at the new price level)

Clients that care about priority should reduce-only rather than reprice where possible.

Errors

CodeMeaning
1400Order not found or in a terminal state
1401Order belongs to a different account
1402type does not support modification (e.g. market)
1403Neither price nor quantity supplied
14101413Risk check failed against the new order parameters