cancel_invoice
Cancel an authorized invoice.
Legal cancellation, with fiscal and accounting effect, inside a window the NFS-e authorizer enforces for the municipality. Ask the human to confirm before calling; never call it speculatively. The reason reaches the tax authority verbatim and must be at least 15 characters.
Pass idempotency_key to make a retry safe: repeating the same key with the same access key and reason replays the first answer instead of cancelling a second time. Reuse the key only when retrying that exact call; a genuinely new cancellation needs a new key, or none. Nothing generates one for you — two calls without a key are two cancellations.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"access_key": "<access_key>",
"document_type": "<document_type>",
"reason": "<reason>"
},
"name": "cancel_invoice"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | Yes | Why the document is cancelled, 15 to 256 characters. It reaches the tax authority verbatim, e.g. Erro no valor do servico prestado. | |
| access_key | Yes | The access key (chave de acesso) the authorizer assigned, as issue_invoice and list_invoices return it. An NF-e key has 44 characters; the issuer's CNPJ inside it may carry letters since July 2026, so copy it exactly. | |
| company_id | No | UUID of the company acted for. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
| document_type | Yes | nfse for a service invoice, nfe for goods. | |
| company_tax_id | No | CNPJ or CPF of the company acted for, never the recipient or a taxpayer looked up. Omit for a single company; else see list_authorized_companies. Send one, never both. | |
| idempotency_key | No | One per business event, e.g. order-1042. Printable ASCII up to 255, no leading or trailing space. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Local id. Use it for reissue and for submissions, and when a document was rejected and has no key. | |
| status | No | issued, rejected or cancelled. | |
| protocol | No | The authorization protocol, when granted. | |
| access_key | No | The authorizer's key. Absent while the document is not authorized. |