---
title: "Cancel an order - Amplia Reg"
description: "How to cancel an Amplia Reg order through the API when the certificate is no longer wanted, which statuses allow it and the Sales app role it needs."
canonical: "https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/cancel-order"
locale: "en"
product: "Amplia Reg"
last_updated: "2026-10-08"
---

# Cancel an order - Amplia Reg

Cancel an order when the certificate is no longer wanted, for example because the sale was canceled or refunded in your system. A canceled
order is closed for good: it cannot be reopened, and the holder can no longer issue the certificate.

> **Tip**
>
> Make sure you have completed the [Getting started](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/get-started) steps

## Before you start

* **Role**: the application must have the **Sales app** role. The **Electronic registration authority** role, used for
  [preapproved orders](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/preapproved-orders), cannot cancel orders: an application that creates preapproved orders and also cancels them
  needs both roles.
* **Order status**: an order can be canceled at any status until the certificate is issued, including **Waiting issue**. Orders that are
  **Issued**, **Revoked** or already **Canceled** cannot be canceled. See [Order statuses](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/issuance#order-statuses).

> **Note**
>
> Canceling does not apply to a certificate that was already issued. To invalidate an issued certificate, it must be revoked instead. See
> [Revocation](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/issuance#revocation).

## Canceling the order

Call the cancellation API with the order number and the reason for the cancellation.

In .NET:

```cs
await ampliaRegService.CancelOrderAsync("100-000-010", new OrderCancelRequest() {
	Description = "Cancellation requested by customer", // Cancellation reason (required, max 500 characters)
});
```

Via API:

```js
POST /api/orders/100-000-010/cancellation
{
	"description": "Cancellation requested by customer" // Cancellation reason (required, max 500 characters)
}
```

The order can be identified by its number or by its ID (the `orderId` received in [webhooks](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks)). The number is matched
ignoring punctuation, spaces and case, so `100-000-010` and `100000010` refer to the same order.

The `description` field is required, with up to 500 characters. Write it for whoever will read the order's history later: it is recorded
in the order's status history, next to the date of the cancellation.

On success, the API responds with HTTP code 200 and no body.

## What happens next

* The order moves to **Canceled** (`Canceled`), and the cancellation and its reason are recorded in the order's history.
* If the order was created by your application and your application has webhooks enabled, it receives an `OrderStatusChanged`
  notification with `status` set to `Canceled`. The `orderStatusTransitionModel.description` field carries the reason given in the
  request.
* For ICP-Brasil orders, if the holder's biometric enrollment was started for this order and the order had not been approved yet, Amplia
  Reg also cancels the pending enrollment transaction with the biometric service.

## Errors

| Code | Cause |
|---|---|
| `OrderNotFound` | No order with the given number or ID exists |
| `CannotCancelOrder` | The order is already **Issued**, **Revoked** or **Canceled** |

If the application does not have the Sales app role, the API responds with HTTP code 403 (Forbidden). If `description` is missing or
longer than 500 characters, it responds with HTTP code 400 (Bad Request). See [Error codes](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/error-codes) for the other codes.

## See also

* [Getting started with integration](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/get-started)
* [Create an order](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/create-order)
* [How certificate issuance works](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/issuance)
* [Webhooks](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/webhooks)
* [Error codes](https://docs.lacunasoftware.com/en-us/articles/amplia-reg/integration/error-codes)
