---
title: "Cancel a DC-e"
method: POST
path: "/dce/cancelar"
tags: ["DC-e"]
---

# Cancel a DC-e

`POST /dce/cancelar`

## Request

- Base URL: `https://queries.test.envia.com`
- URL: `https://queries.test.envia.com/dce/cancelar`
- Auth: HTTP bearer

Cancel an existing DC-e (Declaração de Conteúdo Eletrônica) in the Brazilian fiscal system. The DC-e must have been previously authorized.

**When to use:** Call this endpoint when you need to cancel a previously issued DC-e — for example, if the shipment was cancelled or the declaration was issued in error.

**Prerequisites:**
- Valid JWT authentication token (Bearer)
- The 44-digit DC-e access key (`dceKey`) from the original DC-e authorization

**Key behaviors:**
- Returns the cancellation status from SEFAZ (Brazilian tax authority)
- The `cStat` field indicates the result: `135` means cancellation was approved
- Once cancelled, the DC-e cannot be reused
- The `nProt` field contains the cancellation protocol number for record-keeping

## Request body

- object
  - `dceKey` string, required: The 44-digit DC-e access key from the original authorization

## Response `200`

Successful DC-e cancellation

- object
  - `success` boolean: Whether the cancellation request was successful
  - `tpAmb` string: Environment type: 1 = Production, 2 = Homologation (testing)
  - `verAplic` string: Version of the SEFAZ application that processed the request
  - `cOrgao` string: IBGE code of the issuing state
  - `cStat` string: Status code from SEFAZ. 135 = Cancellation approved
  - `xMotivo` string: Human-readable reason for the status
  - `chDCe` string: The 44-digit DC-e access key that was cancelled
  - `tpEvento` string: Event type code. 110111 = Cancellation
  - `xEvento` string: Event name
  - `nSeqEvento` string: Sequence number of the event
  - `dhRegEvento` string, date-time: Date and time when the event was registered at SEFAZ
  - `nProt` string: Protocol number of the cancellation for record-keeping

---

[API](https://skmtc.dev/envia/apis/envia-queries-api.md) - [All operations](https://skmtc.dev/envia/apis/envia-queries-api/llms.txt) - [OpenAPI document](https://skmtc.dev/envia/apis/envia-queries-api/revisions/56f601a52f3f?raw)
