TF Fiscal
Documentation

NF-e

Issue NF-e

Accepts the issuance request immediately; authorization with SEFAZ happens asynchronously.

POST/openapi/v2/empresas/{empresaId}/nf-e

Requires 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

  • empresaIdstringrequired

    Company identifier returned by Register company.

    Example: 1934811222334455

Request body

  • idstringrequired

    Unique issuance request id (generated by you, up to 64); also the nfeId for query / cancellation and the idempotency key.

    Example: NFe-000014553
  • ambienteEmissaostringrequired

    Homologacao / Producao; must match the current environment of the company, otherwise 10004030.

  • finalidadestringoptional

    Normal (default) / Devolucao for return invoices, see the return invoices section.

  • notaReferenciadaobjectrequired for returns

    Reference to the original invoice being returned.

  • pedidoobjectrequired

    Order info.

  • clienteobjectrequired

    Recipient (buyer).

  • itensarrayrequired

    Line items.

Responses

200

Request accepted; no body. The invoice stays in AguardandoAutorizacao until SEFAZ replies.

No response body

Errors

CodeHTTP
GW001400

Customer IBGE municipality code does not exist. Check the UF and the IBGE code.

10003000404

empresaId does not exist or does not belong to this application.

10004004400

Company not issuable (not yet approved or certificate not ready). Wait for approval / link the certificate.

10004030400

ambienteEmissao does not match the current environment of the company. Submit under the company environment or ask operations to switch it.

10004031400

Value not supported (presencaConsumidor / unknown payment type / tipoPessoa inconsistent with the document / CPF buyer carrying inscricaoEstadual / IntegradoAoSistemaDeGestao). Adjust to the supported range.

10004032400

The same id was resent with changed key fields while the previous attempt is still processing or already authorized. Use a new id.

10004002400

Too many pending issuance tasks for the CNPJ. Retry later.

10005000400

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.

10004020400

codigoBeneficioFiscal missing on CST 20/30/40/41/50/51/70/90.

10004021400

Return invoice: line without notaReferenciada.numeroItem or invoice without notaReferenciada.chaveAcesso.

10004022400

Line reference on a non-return invoice.

10004023400

Original invoice not found or not owned by this company.

10004024400

Original invoice not authorized.

10004025400

Item not found on the original invoice.

10004026400

Quantity above the original line (aggregated across lines that reference the same original item).

10004034400

CNPJ buyer without cliente.inscricaoEstadual. Send the buyer state registration (ICMS taxpayer).

10004043400

Contract field missing (base reduction / ST margin and rate / deferral / unit tax amount / IPI code / pCredSN absent from both request and profile / cest on an ST item); the message names the field path. Fill the field per the matrix.

10004044400

Field not applicable to the tax code (substituicaoTributaria on a non-ST code, percentualCreditoSimples on a non-credit code, monofasico outside CST 02/15/53/61). Remove the group.

10004045400

The CNPJ buyer cliente.inscricaoEstadual fails the check-digit rule of the buyer state (SEFAZ would reject with 209 after numbering). Check the buyer IE and state.

10004046400

Tax code does not match the company regime (CRT 1/4 needs a 3-digit CSOSN, CRT 2/3 a 2-digit CST).

10004047400

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.

10001001400

Request field validation failed (one entry per field). Fix per mensagem.

Payment types (`formas[].tipo`)

ValueMeaning
DinheiroCash
ChequeCheque
CartaoDeCreditoCredit card
CartaoDeDebitoDebit card
CreditoLojaStore credit
ValeAlimentacaoFood voucher
ValeRefeicaoMeal voucher
ValePresenteGift voucher
ValeCombustivelFuel voucher
BoletoBancarioBank slip (boleto)
DepositoBancarioBank deposit
PagamentoInstantaneoPixPix
TransferenciaBancariaBank transfer
ProgramaDeFidelidadeLoyalty programme
SemPagamentoNo payment
OutrosOther

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.

GroupApplicable 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.substituicaoTributariaCST 10/30/70, CSOSN 201/202/203 (required); CST 90 / CSOSN 900 (optional); rejected elsewhere
icms.retencaoAnteriorCST 60, CSOSN 500
icms.difalInterstate sale to a non-taxpayer; computed automatically when omitted
pis / cofinsaliquota for CST 01/02 and 50–75/98; valorUnitarioTributo for CST 03
ipiOptional as a whole; situacaoTributaria required when present

Tax code × required parameters

ICMS codealiquotapercentualReducaoBasesubstituicaoTributaria.mva + .aliquotapercentualCreditoSimplespercentualDiferimento
00auto (CRT=3)----
10auto-required--
20autorequired---
30--required--
40 / 41 / 50-----
51autooptional--required
60-----
70autorequiredrequired--
90per groups sentoptionaloptional--
101---required (or company profile)-
102 / 103 / 300 / 400-----
201--requiredrequired-
202 / 203--required--
500-----
900per groups sentoptionaloptionaloptional-
PIS/COFINS codealiquotavalorUnitarioTributo
01auto (CRT=3, by regime) / otherwise required-
02required-
03-required
04–09--
49 / 99defaults 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 with 10004047; 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 with 10004020. SEFAZ-SP validates the same set with 930 (CST 90 without a code is rejected too) and rejects the literal SEM CBENEF with 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 with 10004043 (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

FieldTypeDescription
finalidadestring"Normal" (default) / "Devolucao". Example: "Devolucao"
notaReferenciada.chaveAcessostring44-digit access key of the original invoice. Required when finalidade=Devolucao
itens[].notaReferenciada.numeroItemintegerOriginal 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.

json
{
"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

json
{
"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.

GroupApplies toFields
icms.monofasicoRequired 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.partilhaCST 10 / 90 interstate split invoices, not combined with FCPpercentualBaseCalculoOperacaoPropria (pBCOp %) + ufSubstituicaoTributaria (UFST), paired
icms.substituicaoTributariaDestinoCST 41 / 60 interstate transfer, sent together with retencaoAnteriorbaseCalculo (vBCSTDest) + valor (vICMSSTDest), paired
icms.tributacaoEfetivaCST 60, required by some statespercentualReducaoBase (pRedBCEfet), aliquota (pICMSEfet; sending it outputs the effective group)
pis.substituicaoTributaria / cofins.substituicaoTributariaWithheld 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.percentualCargaTributariaAnyApproximate tax burden vTotTrib (%); computed from the IBPT table when omitted
impostos.ibsCbs2026 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.