---
title: "Cancel an order"
method: POST
path: "/orders/{id}/cancel"
tags: ["Admin Sales: Orders"]
---

# Cancel an order

`POST /orders/{id}/cancel`

## Request

- Base URL: `http://localhost:8000/api/admin`
- URL: `http://localhost:8000/api/admin/orders/{id}/cancel`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-admin-api/docs/orders/:id/cancel/post.ts> (a function with typed inputs; its response is checked against the schema)

Cancels every cancellable item on the order and returns the updated `OrderDetail`. Gated by the same conditions as the admin UI (open status, qty_to_cancel, `sales.orders.cancel` permission).

## Path parameters

- `id` integer, required

## Request body

- object

## Response `200`

The updated order detail.

## Other responses

- `201`: AdminCancelOrder resource created
- `400`: Invalid input
- `404`: Order not found.
- `422`: Order is closed / fraud / has nothing to cancel, or admin lacks `sales.orders.cancel`.

---

[API](https://skmtc.dev/bagisto/apis/bagisto-admin-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-admin-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-admin-api/revisions/3198f11be70f?raw)
