CT-e
Delivery failure
Registers event 110190, the delivery failure, on an authorized CT-e.
/openapi/v2/empresas/{empresaId}/cte/{cteId}/insucesso-entregatoken, timestamp and sign signature headers, see Authentication.The delivery failure is the event by which the carrier records with SEFAZ that it tried to deliver and could not, saying when it tried and why it failed. Sent synchronously; on success the event object is returned. Keep the protocolo of the response: it is the protocoloEvento used by Cancel delivery failure.
Path parameters
empresaId* | string | Company identifier |
cteId* | string | Document identifier |
* Required field
Request body
dataTentativa* | string | Attempt time |
numeroTentativa | int | Attempt number |
motivo* | int | Failure reason |
justificativa*required for `motivo=4` | string | Justification |
latitude | number | Attempt latitude |
longitude | number | Attempt longitude |
hashTentativa | string | Image fingerprint |
dataHashTentativa | string | Image time |
chavesNfe | array | Keys of the NF-e in the attempt |
* Required field
chaveAcesso | string | Access key |
tipo | string | Event type |
codigo | string | Event code |
sequencia | int | Sequence |
status | string | Return code |
motivo | string | Reason |
protocolo | string | Protocol |
data | string | Registration time |
linkXml | string | Event XML link |
Before measuring the length, the platform cleans text fields: accents are stripped and repeated whitespace collapses into a single space. This happens before the length validation; text that falls out of range after that cleanup returns 10017042.
motivoFailure reason
| Values | Meaning |
|---|---|
| 1 | Receiver not found |
| 2 | Receiver refused the load |
| 3 | Address does not exist |
| 4 | Other; requires justificativa |
tipoEvent type
| Values | Meaning |
|---|---|
| Cancelamento | CT-e cancellation; code 110111 |
| CartaCorrecao | Correction letter; code 110110 |
| Epec | EPEC contingency prior authorization, registered by the platform; code 110113 |
| ComprovanteEntrega | Delivery receipt; code 110180 |
| CancelamentoComprovanteEntrega | Delivery receipt cancellation; code 110181 |
| InsucessoEntrega | Delivery failure; code 110190 |
| CancelamentoInsucessoEntrega | Delivery failure cancellation; code 110191 |
| PrestacaoDesacordo | Service disagreement; code 610110 |
| CancelamentoPrestacaoDesacordo | Service disagreement cancellation; code 610111 |
codigoEvent code
| Values | Meaning |
|---|---|
| 110111 | CT-e cancellation (Cancelamento) |
| 110110 | Correction letter (CartaCorrecao) |
| 110113 | EPEC contingency prior authorization, registered by the platform (Epec) |
| 110180 | Delivery receipt (ComprovanteEntrega) |
| 110181 | Delivery receipt cancellation (CancelamentoComprovanteEntrega) |
| 110190 | Delivery failure (InsucessoEntrega) |
| 110191 | Delivery failure cancellation (CancelamentoInsucessoEntrega) |
| 610110 | Service disagreement (PrestacaoDesacordo) |
| 610111 | Service disagreement cancellation (CancelamentoPrestacaoDesacordo) |
statusRegistration return code
The platform only returns 200 with one of these codes; any other SEFAZ return becomes 10017043.
| Values | Meaning |
|---|---|
| 134 | Event registered; SEFAZ treats it as success |
| 135 | Event registered and linked to the CT-e |
| 136 | Event registered but not linked to the CT-e |
| Code | HTTP | |
|---|---|---|
| 10017003 | 404 | cteId not found or not owned by the company. Check the id and the empresaId. |
| 10003000 | 404 | empresaId not found. |
| 10017004 | 400 | The company is not in a condition to issue: disabled or certificate unavailable. Registering events also needs the certificate; re-enable the company or link a valid certificate. |
| 10017040 | 400 | The document status does not allow the event; the CT-e must be Autorizada. |
| 10017042 | 400 | Invalid event text: length out of range after sanitization. |
| 10017043 | 400 | SEFAZ rejected the event; mensagem carries its return code and reason. |
| 10001001 | 400 | Request field validation failed, one entry per field; fix per mensagem. |
