Through the NF-e Situation Consult service, it’s possible to obtain information about the current status of the NF-e in the Sefaz database.
This functionality is widely used in cases where it’s necessary to verify the existe and validity of an NF-e, as well as to obtain information about the events that occured with it (e.g.: alteration of values by a Correction Letter).
URL
Production: POST https://nfe.ns.eti.br/nfe/stats
Input data
Field | Description | Data Type | Occurrence | Notes |
---|---|---|---|---|
X-AUTH-TOKEN | User access token | String | 0-1 | |
licencaCnpj | CNPJ of the license interested in consulting the NF-e status | Int | 0-1 | Used to identify the digital certificate to be used. If not sent, the CNPJ will be extracted from the key sent in the chNFe field |
chNFe | NF-e access key | Int | 1-1 | |
tpAmb | NF-e authorization environment type: 1 - Production 2 - Homologation | Int | 1-1 | |
verao | NF-e version | String | 0-1 | Standard value: 4.00 |
Request example
Consult situation
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"X-AUTH-TOKEN": "YOUR_TOKEN",
"licencaCnpj": "07364617000135",
"chNFe": "43161107364617000135550000000099461000094833",
"tpAmb": "2",
"versao": "4.00"
}'\
https://nfe.ns.eti.br/nfe/stats
Returned data
Field | Description | Notes |
---|---|---|
status | Processing status code | |
motivo | Processing status literal description | |
retConsSitNFe | Object containing the NF-e authorization protocol data and all linked events | Only when status = 200 |
erro | Object containing the error data that occured during processing | Only when status is different from 200 |
erro.cStat | Error status code | |
erro.xMotivo | Error literal description |
Return example
Successful return (cStat 100 = authorized)
{
"status": 200,
"motivo": "Consulta realizada com sucesso",
"retConsSitNFe": {
"tpAmb": "2",
"verAplic": "RS201809061124",
"cStat": "100",
"xMotivo": "Autorizado o uso da NF-e",
"cUF": "43",
"dhRecbto": "2020-09-03T10:54:16-03:00",
"protNFe": [
{
"infProt": {
"Id": "ID143200000787484",
"tpAmb": "2",
"verAplic": "RS202008281347",
"chNFe": "43200907364617000135550000000518401004621869",
"dhRecbto": "2020-09-03T10:53:36-03:00",
"nProt": "143200000787484",
"digVal": "VBJVDHDVbPA1qoH/1RBC+wIBIU4=",
"cStat": "100",
"xMotivo": "Autorizado o uso da NF-e"
},
"versao": "4.00"
}
],
"versao": "4.00"
}
}
Returned cStats
According to the main cStat code, which is returned in the retConsSitNFe object, it’s possible to define the status of the document. Below is a table with some values that can be returned. There may be other returns as needed by Sefaz.
Code | Return |
---|---|
100 | Authorized document |
101 | Cancelled document |
110 | Denied document |
Return codes
Code | Description |
---|---|
200 | Consult carried out successfully |
-400 | NF-e access key or environment type not informed |
-3 | Invalid access key |
-6 | Error carrying out the consult. Check the "erro" object to identify the reason |