---
search:
  tags:
    - Operations
    - POST
seo:
  description: >-
    Requests cancellation of an order. A 201 response means the cancellation
    request was received… Reference for the POST /{id}/cancel endpoint in the
    Orders API.
sidebar:
  label: Cancel order
  badge: POST
title: Cancel order
type: openapi-operation
---
Requests cancellation of an order. A 201 response means the cancellation request was received — not necessarily that the order is cancelled yet.

Check the `cancellationStatus` in the response:

- orders that can be cancelled immediately (for example, those not yet dispatched) come back `canceled` right away
- others come back `pending` and are reviewed asynchronously before being approved or denied

For requests that return `pending`, listen for the `order.cancellationrequest.created` and `order.cancellationrequest.updated` events to learn the outcome — see [Order Cancellation Requests events](https://docs.sibipro.com/events/order.cancellation-requests).

`POST /{id}/cancel`

**Request body** (`application/json`)

- `reason` (string, required) — Reason for the cancellation

Request body example:

```json
{
  "reason": "Customer requested a cancellation"
}
```

**Responses**

- `201` — Cancellation requested. The response reflects the current \`cancellationStatus\`: usually \`pending\` (queued for asynchronous review), but already \`canceled\` for orders that are cancelled immediately.
- `400` — Bad request - Invalid input data
- `401` — Unauthorized - Missing or invalid authentication
- `403` — Forbidden - the token was minted for the other environment, is not a Public REST API token, or does not carry the scope this operation requires
- `500` — Internal server error

Response example, 201:

```json
{
  "cancellationStatus": "pending",
  "cancellationReason": "Customer requested a cancellation",
  "requestedAt": "2024-01-20T12:00:00Z"
}
```

Response example, 400:

```json
{
  "code": "VALIDATION_ERROR",
  "message": "Invalid input parameters"
}
```

Response example, 401:

```json
{
  "code": "UNAUTHORIZED",
  "message": "Missing or invalid authentication token"
}
```

Response example, 403 · environmentMismatch:

```json
{
  "code": "TOKEN_ENVIRONMENT_MISMATCH",
  "message": "A test token was used against the production API. Test tokens only work against the Sibi test environment; use a production token here."
}
```

Response example, 403 · restTokenRequired:

```json
{
  "code": "REST_TOKEN_REQUIRED",
  "message": "This endpoint only accepts Public REST API tokens. Create one at https://developer.sibipro.com."
}
```

Response example, 403 · insufficientScope:

```json
{
  "code": "INSUFFICIENT_SCOPE",
  "message": "The presented token is missing the `cancel:orders` scope, which this endpoint requires. Create a token with the scopes you need at https://developer.sibipro.com."
}
```

Response example, 500:

```json
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "An unexpected error occurred",
  "details": [
    {
      "field": "unknown",
      "error": "Internal server error occurred while processing request"
    }
  ]
}
```
