orders

Cancel an order

Changed on

Cancels an order if it has not yet been started (status must be 'pending').

The userId query parameter is required (e.g., ?userId=user123). If userId is missing or does not match the userId of the order, the request will be rejected.

delete/orders/{orderId}

Request

  • Base URL
    <BURGER_API_HOST>/api (relative, and the document was published on a file host, not at the API’s origin)
  • URL
    <BURGER_API_HOST>/api/orders/{orderId}
  • Auth
    none declared

Path parameters

orderIdstring required

ID of the order

Query parameters

userIdstring required

ID of the user requesting the cancellation (required)

Response

Order cancelled successfully

idstring required
createdAtstring date-time required
estimatedCompletionAtstring date-time required
completedAtstring date-time

ISO date string for when the order was completed (undefined until completed)

nicknamestring

Optional nickname for the order

totalPricenumber float required
status'pending' | 'in-preparation' | 'ready' | 'completed' | 'cancelled' required
  • pending: Order has been created but not yet started - in-preparation: Order is being prepared - ready: Order is ready for pickup - completed: Order has been picked up - cancelled: Order has been cancelled

Example response

{
  "items": [
    {
      "burgerId": "burger-1",
      "quantity": 1,
      "extraToppingIds": [
        "topping-1",
        "topping-2"
      ]
    }
  ]
}

Changes