Through this endpoint, it’s possible to carry out the Delivery Receipt event of an already authorized CT-e.
Obs.: The Delivery Receipt event has rules and deadlines defined by Secretaria da Fazenda that must be considered and respected. For more information, click here and verify the most updated version of the Sefaz Contributors’ Guidance Manual.
URL
POST https://cte.ns.eti.br/cte/compentrega
Input data
Field | Description | Occurrence | Data Type | Notes |
---|---|---|---|---|
X-AUTH-TOKEN | User access token | 0-1 | String | Can be sent in the header |
chCTe | CT-e access key | 1-1 | Int | |
tpAmb | CT-e authorization environment type | 1-1 | Int | 1 - Production 2 - Homologation |
dhEvento | Date and time of the event issuance | 1-1 | Date | Sefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC E.g.: 2016-06-13T15:04:10-02:00 |
nProt | CT-e authorization protocol number | 1-1 | Int | |
nSeqEvento | Event sequential number | 1-1 | Int | In most cases it will be 1. However, when more than one event of the same type is generated for the same CT-e, this number must be sequentially incremented. |
dhEntrega | Date and time of the delivery completion | 1-1 | Date | Sefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC E.g.: 2016-06-13T15:04:10-02:00 |
nDoc | Identification document of the person who received the delivery | 1-1 | String | |
xNome | Name of the person who received the delivery | 1-1 | String | |
latitude | Latitude of the delivery point | 0-1 | Int | 6 precision decimal digits required |
longitude | Longitude of the delivery point | 0-1 | Int | 6 precision decimal digits required |
hashEntrega | HASH (SHA1) in the Base64 format resulting from the concatenation of: the CT-e access key + the Base64 of the delivery image captured | 1-1 | String | 28 characters |
chavesEntregues | NF-es access keys that are being delivered | 0-2000 | Array | Inform only for CT-e with Normal service type |
Request example
Issue delivery receipt request
curl -X POST
\-H "Content-Type: application/json"
\-d '{
"X-AUTH-TOKEN": "YOUR_TOKEN",
"chCTe": "99999999999999999999999999999999999999999999",
"tpAmb": 2,
"dhEvento": "2019-08-09T19:28:30-03:00",
"nSeqEvento": "1",
"nProt": "999999999999999",
"dhEntrega": "2019-08-09T19:27:40-03:00",
"nDoc": "99999999999",
"xNome": "Name of who received",
"hashEntrega": "NzgzNkM3QTUwRDZGNg==",
"dhHashEntrega": "2019-08-09T19:28:00-03:00",
"latitude": "-31.776000",
"longitude": "-52.359400",
"chavesEntregues":[
"99999999999999999999999999999999999999999999",
"99999999999999999999999999999999999999999999"
]
}' \
https://cte.ns.eti.br/cte/compentrega
Returned data
Field | Description | Notes |
---|---|---|
status | Processing status code | |
motivo | Processing status literal description | |
retEvento | Object containing the CT-e processing data at Sefaz | Only when statys = 200 |
retEvento.cStat | Code of the processing situation at Sefaz | |
retEvebto.xMotivo | Literal description of the processing situation at Sefaz | |
retEvento.chCTe | CT-e access key | |
retEvento.dhRegEvento | Date and time of event registration at Sefaz | Sefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC E.g.: 2016-06-13T15:04:10-02:00 |
retEvento.nProt | Document receipt number by Sefaz | |
xml | Distribution XML of the Delivery Receipt event | Only when status = 200 |
erros | Array containing the list of errors occurred during the information validation of the delivery receipt according to the data type | Only when status = -4 |
codigo | Occurred error code | Only when status = -5 |
descricao | Occured error literal description | Only when status = -5 |
Return example
Successful return
{
"status": 200,
"motivo": "Comprovação de Entrega vinculada ao CT-e com sucesso",
"retEvento": {
"cStat": 135,
"xMotivo": "Evento registrado e vinculado a CT-e",
"chCTe": "99999999999999999999999999999999999999999999",
"dhRegEvento": "2019-08-09T19:41:09-03:00","nProt": "999999999999999"
},
"xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?><procEventoCTe versao...."
}
Return codes
Code | Description |
---|---|
200 | Delivery receipt linked to the CT-e successfully |
-2 | Mandatory fields in the request not informed |
-3 | Invalid access key |
-4 | Error information according to the data type |
-5 | Error or rejection when carrying out the delivery receipt. Check the "codigo" and "descricao" fields for more information |
-6 | The access key of the NFe informed at inf.Entrega is invalid: (access key) |