NF-e
Issue NF-e
Accepts the issuance request immediately; authorization with SEFAZ happens asynchronously.
/openapi/v2/empresas/{empresaId}/nf-eRequires the token, timestamp and sign signature headers, see Authentication.
Accepted requests return HTTP 200 with no body and enter the asynchronous issuance flow; the result arrives via webhook or the query endpoint. Re-submitting the same id reuses the original task; if the previous attempt was denied (Negada), resending the same id with corrected fields issues again with the new payload, no new id needed; changing key fields such as the recipient while the previous attempt is still processing or already authorized is rejected with 10004032. Authentication errors (10009xxx) are listed under Authentication.
Parameters
Path parameters
empresaIdstringrequiredCompany identifier returned by Register company.
Example:1934811222334455
Request body
idstringrequiredUnique issuance request id (generated by you, up to 64); also the
nfeIdfor query / cancellation and the idempotency key.Example:NFe-000014553ambienteEmissaostringrequiredHomologacao/Producao; must match the current environment of the company, otherwise10004030.finalidadestringoptionalNormal(default) /Devolucaofor return invoices, see the return invoices section.notaReferenciadaobjectrequired for returnsReference to the original invoice being returned.
pedidoobjectrequiredOrder info.
clienteobjectrequiredRecipient (buyer).
itensarrayrequiredLine items.
Responses
Request accepted; no body. The invoice stays in AguardandoAutorizacao until SEFAZ replies.
No response body
Errors
| Code | HTTP | |
|---|---|---|
| GW001 | 400 | Customer IBGE municipality code does not exist. Check the UF and the IBGE code. |
| 10003000 | 404 |
|
| 10004004 | 400 | Company not issuable (not yet approved or certificate not ready). Wait for approval / link the certificate. |
| 10004030 | 400 |
|
| 10004031 | 400 | Value not supported ( |
| 10004032 | 400 | The same |
| 10004002 | 400 | Too many pending issuance tasks for the CNPJ. Retry later. |
| 10005000 | 400 | Rejected by the tax engine (regime / tax code mismatch, ST code for a non-taxpayer buyer, rate out of range, ...). See the hard rules under the tax code matrix. |
| 10004020 | 400 |
|
| 10004021 | 400 | Return invoice: line without |
| 10004022 | 400 | Line reference on a non-return invoice. |
| 10004023 | 400 | Original invoice not found or not owned by this company. |
| 10004024 | 400 | Original invoice not authorized. |
| 10004025 | 400 | Item not found on the original invoice. |
| 10004026 | 400 | Quantity above the original line (aggregated across lines that reference the same original item). |
| 10004034 | 400 | CNPJ buyer without |
| 10004043 | 400 | Contract field missing (base reduction / ST margin and rate / deferral / unit tax amount / IPI code / pCredSN absent from both request and profile / |
| 10004044 | 400 | Field not applicable to the tax code ( |
| 10004045 | 400 | The CNPJ buyer |
| 10004046 | 400 | Tax code does not match the company regime (CRT 1/4 needs a 3-digit CSOSN, CRT 2/3 a 2-digit CST). |
| 10004047 | 400 | A non-taxpayer buyer with a taxpayer-only code (10/30/70, 101/201/202/203) or with pCredSN. Use 102 / 500 or 900 without credit. |
| 10001001 | 400 | Request field validation failed (one entry per field). Fix per |
Payment types (`formas[].tipo`)
| Value | Meaning |
|---|---|
| Dinheiro | Cash |
| Cheque | Cheque |
| CartaoDeCredito | Credit card |
| CartaoDeDebito | Debit card |
| CreditoLoja | Store credit |
| ValeAlimentacao | Food voucher |
| ValeRefeicao | Meal voucher |
| ValePresente | Gift voucher |
| ValeCombustivel | Fuel voucher |
| BoletoBancario | Bank slip (boleto) |
| DepositoBancario | Bank deposit |
| PagamentoInstantaneoPix | Pix |
| TransferenciaBancaria | Bank transfer |
| ProgramaDeFidelidade | Loyalty programme |
| SemPagamento | No payment |
| Outros | Other |
Tax groups
Every tax parameter is optional (nullable); requests that carry only tax codes keep working unchanged. Each parameter is resolved as request value > company profile > platform rate table (CRT=3 companies) > rejection naming the field path (itens[n].impostos..., n starting at 1). Percentages are written as 18 for 18 %; amounts are in BRL. The platform never infers a base reduction, an ST margin, a deferral percentage or a unit tax amount: send them whenever the tax code needs them.
| Group | Applicable codes |
|---|---|
icms (own fields) | All; aliquota for CST 00/10/20/51/70, percentualReducaoBase for 20/70, percentualDiferimento for 51, percentualCreditoSimples for CSOSN 101/201, codigoBeneficioFiscal for 20/30/40/41/50/51/70/90 |
icms.substituicaoTributaria | CST 10/30/70, CSOSN 201/202/203 (required); CST 90 / CSOSN 900 (optional); rejected elsewhere |
icms.retencaoAnterior | CST 60, CSOSN 500 |
icms.difal | Interstate sale to a non-taxpayer; computed automatically when omitted |
pis / cofins | aliquota for CST 01/02 and 50–75/98; valorUnitarioTributo for CST 03 |
ipi | Optional as a whole; situacaoTributaria required when present |
Tax code × required parameters
| ICMS code | aliquota | percentualReducaoBase | substituicaoTributaria.mva + .aliquota | percentualCreditoSimples | percentualDiferimento |
|---|---|---|---|---|---|
| 00 | auto (CRT=3) | - | - | - | - |
| 10 | auto | - | required | - | - |
| 20 | auto | required | - | - | - |
| 30 | - | - | required | - | - |
| 40 / 41 / 50 | - | - | - | - | - |
| 51 | auto | optional | - | - | required |
| 60 | - | - | - | - | - |
| 70 | auto | required | required | - | - |
| 90 | per groups sent | optional | optional | - | - |
| 101 | - | - | - | required (or company profile) | - |
| 102 / 103 / 300 / 400 | - | - | - | - | - |
| 201 | - | - | required | required | - |
| 202 / 203 | - | - | required | - | - |
| 500 | - | - | - | - | - |
| 900 | per groups sent | optional | optional | optional | - |
| PIS/COFINS code | aliquota | valorUnitarioTributo |
|---|---|---|
| 01 | auto (CRT=3, by regime) / otherwise required | - |
| 02 | required | - |
| 03 | - | required |
| 04–09 | - | - |
| 49 / 99 | defaults to 0 | - |
| 50–75 / 98 (inbound, return invoices) | required | - |
Hard rules (enforced by the tax engine, returned as 10005000):
- CRT 1/4 sellers must use 3-digit CSOSN codes, CRT 2/3 sellers must use 2-digit CST codes; a mismatch is rejected at acceptance with
10004046; - non-taxpayer buyers (individuals / no IE) cannot use CSOSN 101, the withheld-ST code family, or
percentualCreditoSimples; rejected at acceptance with10004047; MEI sellers (CRT 4) cannot use 101; - ST codes (10/30/70, 201/202/203) are rejected for non-taxpayer buyers (SEFAZ cStat 600): ST prepays the resale chain and a consumer is the end of it. B2C sales of ST goods use CST 60 / CSOSN 500 (withheld upstream) and, across states, DIFAL;
- State benefit code (cBenef): CST 20/30/40/41/50/51/70/90 must carry
codigoBeneficioFiscal; missing it is rejected on submission with10004020. SEFAZ-SP validates the same set with 930 (CST 90 without a code is rejected too) and rejects the literalSEM CBENEFwith 946; - non-ST codes must not carry
substituicaoTributaria(10004044); - items under ST codes (10/30/60/70, 201/202/203/500) must carry
cest; a missing CEST is rejected at acceptance with10004043(itens[n].cest); - CST 90 / CSOSN 900 are composite: send at least one of the own-tax, ST or credit groups.
Recipient (`cliente`)
cliente.inscricaoEstadual is the buyer state registration (NF-e dest/IE). Required for CNPJ buyers: it sets indIEDest=1; a CNPJ buyer without it is rejected with 10004034 before an invoice number is consumed (SEFAZ would reject with 232 after numbering). Not allowed for CPF buyers (10004031). Formatting characters are stripped. Example: "123.456.789.012".
The B2B scenario (ICMS-taxpayer buyer) depends on this field: CSOSN 101 / 201 and CST 10 / 30 / 70 are only valid for taxpayer buyers.
Return invoices
| Field | Type | Description |
|---|---|---|
finalidade | string | "Normal" (default) / "Devolucao". Example: "Devolucao" |
notaReferenciada.chaveAcesso | string | 44-digit access key of the original invoice. Required when finalidade=Devolucao |
itens[].notaReferenciada.numeroItem | integer | Original item number (nItem, from 1). Required on every line of a return invoice |
Rules: a return line without a reference → 10004021; a reference on a non-return invoice → 10004022; original not found or not owned by this company → 10004023; original not authorized → 10004024; item not found on the original → 10004025; quantity above the original line (aggregated across lines that reference the same original item) → 10004026. Use inbound CFOPs (1xxx / 2xxx) and inbound PIS/COFINS codes (50–75 / 98, aliquota required); the tax parameters of the original invoice are mirrored per line.
{"id": "DEV-000014553","ambienteEmissao": "Producao","finalidade": "Devolucao","notaReferenciada": { "chaveAcesso": "35241204893402000113650010000117691017244265" },"pedido": { "presencaConsumidor": "OperacaoPelaInternet", "pagamento": { "formas": [ { "tipo": "SemPagamento", "valor": 0 } ] } },"cliente": { "tipoPessoa": "F", "nome": "Demo Client", "cpfCnpj": "88533234775", "endereco": { "uf": "PR", "cidade": "4106902", "logradouro": "Rua Presidente Wilson", "numero": "911", "bairro": "Uberaba", "cep": "81570440" } },"itens": [{"cfop": "2202", "codigo": "000068", "descricao": "Pendrive Kingston 16GB", "ncm": "85235190","quantidade": 1, "unidadeMedida": "UN", "valorUnitario": 28.47,"notaReferenciada": { "numeroItem": 1 },"impostos": {"icms": { "situacaoTributaria": "102" },"pis": { "situacaoTributaria": "70", "aliquota": 0 },"cofins": { "situacaoTributaria": "70", "aliquota": 0 }}}]}
Full example: regular-regime seller (CRT=3), CST 20 with base reduction, PIS/COFINS 01
{"id": "NFe-000014554","ambienteEmissao": "Producao","pedido": { "presencaConsumidor": "OperacaoPelaInternet", "pagamento": { "formas": [ { "tipo": "PagamentoInstantaneoPix", "valor": 100.00 } ] } },"cliente": {"tipoPessoa": "J", "nome": "Revenda Demo LTDA", "cpfCnpj": "11222333000181", "inscricaoEstadual": "123456789012","endereco": { "uf": "SP", "cidade": "3550308", "logradouro": "Av. Paulista", "numero": "1000", "bairro": "Bela Vista", "cep": "01310100" }},"itens": [{"cfop": "5102", "codigo": "SKU-100", "descricao": "Produto demo", "ncm": "85235190", "origem": 0,"quantidade": 2, "unidadeMedida": "UN", "valorUnitario": 50.00, "valorDesconto": 0,"impostos": {"icms": { "situacaoTributaria": "20", "aliquota": 18, "percentualReducaoBase": 33.33, "codigoBeneficioFiscal": "SP800001" },"pis": { "situacaoTributaria": "01", "aliquota": 1.65 },"cofins": { "situacaoTributaria": "01", "aliquota": 7.6 }}}]}
Special tax groups
Optional; fuel, energy, specific interstate operations and the 2026 IBS/CBS overrides.
| Group | Applies to | Fields |
|---|---|---|
icms.monofasico | Required for ICMS CST 02 / 15 / 53 / 61, rejected on any other code (10004044) | quantidadeBaseCalculo, aliquotaAdRem (required for 02/15/53), quantidadeBaseCalculoRetencao, aliquotaAdRemRetencao (required for 15), percentualReducaoAdRem + motivoReducaoAdRem (paired, reason 1/9), quantidadeBaseCalculoRetida, aliquotaAdRemRetida (required for 61); CST 53 takes its deferral from icms.percentualDiferimento |
icms.partilha | CST 10 / 90 interstate split invoices, not combined with FCP | percentualBaseCalculoOperacaoPropria (pBCOp %) + ufSubstituicaoTributaria (UFST), paired |
icms.substituicaoTributariaDestino | CST 41 / 60 interstate transfer, sent together with retencaoAnterior | baseCalculo (vBCSTDest) + valor (vICMSSTDest), paired |
icms.tributacaoEfetiva | CST 60, required by some states | percentualReducaoBase (pRedBCEfet), aliquota (pICMSEfet; sending it outputs the effective group) |
pis.substituicaoTributaria / cofins.substituicaoTributaria | Withheld PIS/COFINS (PISST / COFINSST groups) | ad valorem baseCalculo + aliquota or per-unit quantidadeBaseCalculo + valorUnitarioTributo (one or the other); somarAoTotal adds the amount to the invoice total |
impostos.percentualCargaTributaria | Any | Approximate tax burden vTotTrib (%); computed from the IBPT table when omitted |
impostos.ibsCbs | 2026 IBS/CBS overrides; omitted → company-regime defaults (CST 000 / class code 000001) | situacaoTributaria (3 digits), classificacaoTributaria (6 digits), percentualDiferimento (required for 510/515), tributacaoRegular{situacaoTributaria, classificacaoTributaria}, transferenciaCredito{valorIbs, valorCbs} (800), monofasico{...} (620), zonaFrancaManaus{periodoApuracao, tipo, valor} (810), ajuste{periodoApuracao, valorIbs, valorCbs} (811), creditoPresumido{codigo, percentualIbs, percentualCbs, suspensivo, deduzir}; either every line carries the group or none does |
Pairing rules, applicable codes and the per-CST ad rem requirements of these groups are validated by the tax engine, which returns 10005000 with the internal field name.
