- Guides
- Issuing NF-e
Guides
Issuing NF-e
Issue NF-e model 55 with or without automatic tax calculation.
POST /nfe issues an NF-e model 55 for the organization that owns the x-api-key.
With or without tax calculation
With calculation (default)
Without calculation (calculateTaxes: false)
Treeunfe calculates the taxes for each item and the totals (ICMS, ST, DIFAL, FCP, IPI, PIS, COFINS, IBS, and CBS) using the organization’s issuing rules.
Use this when your system doesn’t have its own tax engine.
Body structure
{
"calculateTaxes": true,
"NFe": {
"infNFe": {
"ide": { },
"emit": { },
"dest": { },
"autXML": [ ],
"det": [ ],
"total": { },
"transp": { },
"pag": { },
"infRespTec": { }
}
}
}
| Field | Description |
|---|---|
calculateTaxes | true (default) to have Treeunfe calculate the taxes; false to send the taxes already calculated. |
NFe.infNFe | The invoice groups, with the same tags as the official NF-e layout (MOC). |
Tag names follow the SEFAZ layout. The only difference is CNPJCPF: send either the CNPJ or the CPF in this one field, digits only.
Main groups
| Group | Contents |
|---|---|
ide | Identification: state, series, number, dates, operation type, purpose. |
emit | Issuer: CNPJ, legal name, address (enderEmit), state registration (IE), and CRT. |
dest | Recipient: CNPJ/CPF, name, address (enderDest), indIEDest, email. |
autXML | CNPJs/CPFs authorized to download the XML. |
det | Items: prod (product) and imposto (taxes). |
total | Totals: ICMSTot and IBSCBSTot. |
transp | Shipping. modFrete: 9 = no freight. |
pag | Payment (detPag). |
infRespTec | Technical contact responsible for the system. |
The invoice’s environment comes from the API Key: a HOMOLOGACAO key issues in the sandbox and a PRODUCAO key in production. Do not send the environment in the payload.
Tax regime
The example below uses the normal regime (emit.CRT: 3, ICMS CST 00). For Simples Nacional, use emit.CRT: 1 and the ICMSSN groups with CSOSN (for example, ICMSSN102).
Full example
Response
When SEFAZ authorizes the invoice:
{
"outcome": "SUCCESS",
"chaveAcesso": "41261012345678000195554650000000101585524161",
"protocolo": "141260000000000"
}
Response statuses
| Status | Meaning |
|---|---|
200 | Invoice processed. Check outcome. |
400 | Invalid body. |
401 | x-api-key missing or invalid. |
402 | Issuing blocked by the account’s plan or balance. |
403 | Organization inactive, or the key lacks the nfe:emit scope. |
422 | Invoice rejected during validation or by SEFAZ. |
503 | SEFAZ unavailable. Try again later. |
See also Errors.