TF Fiscal
Documentation

DC-e

Cancel DC-e

Requests the cancellation of an authorized DC-e (within 24 hours after authorization); asynchronous, result via webhook.

DELETE/openapi/v2/empresas/{empresaId}/dc-e/{dceId}

Requires the token, timestamp and sign signature headers, see Authentication.

Acceptance returns HTTP 200 with no body, the document moves to CancelamentoPendente, and the platform registers event 110111 (nSeqEvento=1) with SEFAZ asynchronously. The result arrives through the webhook dce.canceled (Cancelada) or dce.cancel_rejected (CancelamentoNegado), and can also be polled through the query. The body is optional: { "motivo": "..." } with 15-255 characters after sanitization; when omitted, the fixed default Cancelamento solicitado pelo emitente por erro de preenchimento. is used. The official DC-e has cancellation only: no correction letter, no number invalidation.

Parameters

Path parameters

  • empresaIdstringrequired

    Identifier returned by Register company.

    Example: 1934811222334455
  • dceIdstringrequired

    The id sent at issuance.

    Example: DCe-000012333

Request body

  • motivostringoptional

    Cancellation reason, 15-255 characters after sanitization (10019043 when shorter than 15). When omitted, Cancelamento solicitado pelo emitente por erro de preenchimento. is used.

    Example: Cancelamento solicitado pelo emitente por erro de preenchimento.

Responses

200

Cancellation accepted; no response body. The document moves to CancelamentoPendente; the SEFAZ verdict arrives through the webhook.

No response body

Errors

CodeHTTP
DCe0001404

dceId not found, not owned by the company, or the document was not materialized yet (still Pendente without a key). Cancel Pendente documents only after authorization.

10003000404

empresaId not found.

10019040400

Status does not allow cancellation: the document must be Autorizada (already cancelled documents also return this code).

10019041400

24-hour window after authorization exceeded (Manual DC-e). The document can only be kept.

10019042400

Cancellation already accepted for this document (in progress). Only one cancellation is accepted per document.

10019043400

Invalid motivo: shorter than 15 characters after sanitization.

Signing a DELETE with a body

A DELETE without a body signs with the empty string as body; a DELETE with a body (cancellation with a reason) signs the raw JSON with CR/LF removed, exactly like the JSON endpoints. If you send { "motivo": ... }, include that same text in the signature. See Authentication.

Constraints and outcome

  • The document must be Autorizada (10019040) and within 24 hours after authorization (10019041), counted from the authorization time.
  • Only one cancellation is accepted per document: further calls while cancelling / after cancellation return 10019042 / 10019040.
  • A motivo shorter than 15 characters after sanitization returns 10019043; a document not yet materialized (still Pendente without a key) returns 404 DCe0001.
  • Outcome: dce.canceled with dceStatus=Cancelada (dceDataAutorizacao is the cancellation registration time and dceNumeroProtocolo the event protocol; the DACE is re-rendered with the CANCELADA watermark), or dce.cancel_rejected with dceStatus=CancelamentoNegado (the document stays Autorizada, the query carries the reason in motivoStatus, and a corrected DELETE may be sent again). Event payloads in DC-e.