# Invoice cancellation

## Description

An invoice can be canceled to prevent the buyer from paying the invoice. This is necessary if an error has been made on the invoice. An invoice can only be canceled if two conditions are met:

* Invoice status: not paid
* Payment page views: 0 views

## Request

```bash
curl -X POST https://api.bitsby.app/invoices/cancel \
  -H "Authorization: Token MSvL2ltaDZdWVjmZURURMVWhqSJLT2NURjhL2Fla1Z1T1IxQTltKs1T3Ay" \
	-F "invoiceId=ade9550d-3dc7-4fd3-b94e-3b4c12aaaa0c"
```

## Request parameters

<table data-full-width="true"><thead><tr><th>Parameter</th><th>Data type</th><th>Description</th><th>Example</th><th>Mandatory?</th></tr></thead><tbody><tr><td><code>invoiceId</code></td><td>UUID</td><td>Invoice ID in UUID format</td><td>ade9550d-3dc7-4fd3-b94e-3b4c12aaaa0c</td><td>yes</td></tr></tbody></table>

## Пример ответа

```json
{
   "result":"success",
   "data":"Invoice canceled"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bitsby.app/api-documentation/invoice-cancellation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
