Cancel Order

Cancel a resting order.

DELETE /orders/{orderId}

Auth: Authorization: Bearer <access_token>.

Path Parameters

ParameterDescription
orderIdOrder id returned by POST /orders

Query Parameters (alternative)

If you don't have the venue orderId handy, you can cancel by your own idempotency key:

DELETE /orders?client_order_id={client_order_id}

Either {orderId} in the path or client_order_id in the query is required — exactly one.

Example — Cancel by Order Id

curl -X DELETE https://api.godarkdex.com/api/v1/orders/ord_01HXYZ12345 \
  -H "Authorization: Bearer $TOKEN"

Example — Cancel by Client Order Id

curl -X DELETE "https://api.godarkdex.com/api/v1/orders?client_order_id=my-order-001" \
  -H "Authorization: Bearer $TOKEN"

Success Response

{
  "code": 0,
  "data": {
    "order_id": "ord_01HXYZ12345",
    "client_order_id": "my-order-001",
    "status": "CANCELLED",
    "filled_quantity": 0.03,
    "remaining_quantity": 0.07,
    "cancel_reason": "USER_REQUESTED"
  },
  "timestamp": "2026-04-20T10:30:00.123Z",
  "request_id": "req_01HXYZ..."
}

The final order state is returned in full so you don't need a follow-up GET /orders/{orderId}.

Errors

CodeMeaning
1400Order not found or already in a terminal state (FILLED, CANCELLED, REJECTED)
1401Order belongs to a different account

See Error Codes for the full list.