Documentation › NF-e issuance
Products and tax engine
Product registry validated against the official tables, and NF-e tax calculation with the rule and source of each value.
Product registry
POST /v1/produtos registers the company's product with its code (SKU).
Validation happens at registration, not on the invoice:
| Refusal | Official table |
|---|---|
ncm_inexistente, ncm_fora_de_vigencia |
Current Siscomex nomenclature (Resolução Gecex nº 926/2026) |
cest_inexistente, cest_incompativel_ncm |
Convênio ICMS 142/18, CONFAZ consolidated text |
gtin_invalido, gtin_digito_invalido, gtin_prefixo_invalido |
GS1 rules for check digits and reserved prefixes |
SEFAZ homologação may even authorize a nonexistent NCM; production rejects the invoice. That is why registration checks it first. Each table comes from an official source, with the date of the copy and the SHA-256 of the source file.
The GTIN is also looked up in the SEFAZ Cadastro Centralizado de GTIN
(centralized GTIN registry), with the company's certificate: if SEFAZ knows the
GTIN with a different NCM, registration is refused with gtin_ncm_divergente.
What SEFAZ returned is stored in gtin_sefaz. A GTIN unknown to SEFAZ, or a
lookup that is down, does not block registration.
The invoice keeps a copy of the product as it was at issuance: changing the product later does not change an issued invoice.
Tax profile and approval
The product's tax profile states its ICMS treatment (tributado,
base_reduzida, isento, nao_tributado, imune, st_retida, st_substituto), its PIS/COFINS
treatment (tributado, monofasico, aliquota_zero, outros) and its IBS/CBS
CST and classification. The company's profile
(PUT /v1/nfe/perfil-fiscal/{empresa_id}) states its PIS/COFINS regime, whether
it is an IPI taxpayer and, under Simples Nacional, the month's credit rate
(CSOSN 101). Nothing is calculated without a profile approved by a person
from the company or the accounting firm:
POST /v1/produtos/{codigo}/aprovacao-perfil and
POST /v1/nfe/perfil-fiscal/{empresa_id}/aprovacao record who approved it and
when. Changing a tax field clears the approval.
Sandbox with its own registry. The sdr_test_ key creates, changes and
approves products and profiles in a separate registry of its own: nothing it
stores appears to the production key, and it neither sees nor changes the
production registry. This lets you test the whole calcular mode without
touching what issues for real. The product's ambiente field says which
registry it belongs to.
Wholesaler Termo de Acordo (Bahia)
For a wholesaler accredited under Decreto 7.799/2000, record the accreditation
in the company profile (termo_acordo with number, item of the Anexo Único and
validity period) and set termo_acordo: true on the products covered. The
engine applies the 41.176% base reduction (CST 20) only where the decree
applies: within the accreditation period, intrastate outbound to a taxpayer
registered in Bahia or a non-taxpayer legal entity (art. 1º and §3º), sale or
bonus, goods at the general rate (art. 5º), without ST (art. 4º), excluding
toilet paper (art. 2º-A). Otherwise, the invoice goes out without the
reduction and the reason comes in ajustes (termo_acordo_nao_aplicado).
The period conditions (share of sales to taxpayers, revenue, transfers) belong
to the accreditation: whoever approves the profile declares that they hold.
ICMS-ST
- Resale with ST previously withheld (CST 60 / CSOSN 500): the withheld-ST
fields come from the purchase invoices Sudrel already captures, through the
link between the product and the purchase item
(
POST /v1/produtos/{codigo}/vinculos-entrada, by GTIN, by supplier code or manually), from the latest acquisitions and proportional to the quantity going out (Convênio ICMS 142/18, cláusula décima quinta, §3º). Without a link, sendst_retidoon the item; with neither, the invoice goes out as you provide it, with a warning inajustes. - Substitute taxpayer on intrastate sales (
st_substituto): ICMS10 (or ICMS70 with reduction), MVA from Anexo 1 of RICMS/BA and the intrastate rate. A sale to a final consumer has no subsequent operation and goes out as ICMS00. Anexo 1 items that require review, with FECP or with adjusted MVA are outside coverage. - Interstate ST is outside coverage.
7% for ME/EPP (Bahia)
On an intrastate sale by a manufacturer to an ME or EPP opting for Simples
Nacional and registered in Bahia, the rate is 7% and the benefit goes as an
explicit discount on the invoice (Lei 7.014/96, art. 16, I, "c", and §1º): the
engine calculates the discount, puts it in vDesc and explains it in
infAdProd. The recipient's size comes from what you provide in
destinatario.optante_simples; otherwise, from the CNPJ lookup, with the
source in ajustes (nfe_destinatario_porte_consulta_cnpj). What you provide
takes precedence.
PIS/COFINS and ICMS in the base
The company profile has exclui_icms_base_pis_cofins (default true, STF
Tema 69): the PIS/COFINS base excludes the ICMS shown on the invoice and, on
resale with ST, the withheld ICMS-ST. With false, ICMS stays in the base,
which is the conservative choice for those not yet applying the exclusion.
Operations
operacao resolves CFOP, purpose and nature: venda,
venda_consumidor_final, remessa (with subtipo: conserto, demonstracao,
industrializacao or outras), transferencia, bonificacao and devolucao (with
chave_referenciada and subtipo comercializacao or industrializacao).
What the engine calculates
| Tax | Coverage |
|---|---|
| ICMS | Sudrel turns on the rule of the issuer's state when the company joins, in minutes and with no action from you. Bahia already comes with the full set, described here: intrastate operation, or interstate with a taxpayer recipient (12%, or 4% for imported goods). Simples Nacional: CSOSN 101 (with the month's credit), 102, 103, 300 and 500 (with ST withheld on purchases). Normal regime: CST 00, 20 (objective base reductions under BA law and the wholesaler Termo de Acordo), 40, 41, 60 (with ST withheld on purchases), 10 and 70 (substitute's ST on intrastate sales) and 7% for ME/EPP, with the BA FECP. |
| IPI | IPI taxpayer, own production, TIPI rate. Under Simples Nacional, not shown. |
| PIS/COFINS | Cumulative or non-cumulative regime, base without the ICMS shown (or with it, per the company profile) and without withheld ICMS-ST; zero rate. Under Simples Nacional, CST 49 not shown. |
| IBS/CBS | Normal regime, through the Receita Federal's official calculator. |
Never a guessed value. Anything the engine does not resolve yet returns 422
fora_de_cobertura, with the fora_de_cobertura list (item, tax and reason),
and the invoice can proceed in informado mode, which serves every state. If you need
the calculation by Sudrel in that case, talk to support: the rule goes in within
minutes. Examples: interstate ST, DIFAL,
issuer in a state whose rule Sudrel is about to turn on, an intrastate sale by a manufacturer to a taxpayer whose
size neither you nor the CNPJ lookup provided (Bahia has 7% for ME/EPP),
PIS/COFINS on resale with ICMS-ST without the value withheld on purchases, and
single-phase (monofásico) PIS/COFINS.
If the official IBS/CBS calculator does not respond, fora_de_cobertura comes
with temporario: true and retentavel: true: try again.
Conferir mode
The invoice goes out with YOUR values, and each difference comes back in
ajustes with acao: "divergente" and the rule nfe_conferencia_divergencia.
With recusar_divergencias: true in the company profile, an invoice with a
difference is refused with 422 conferencia_divergente and the
divergencias list.
Endpoints in this section, with in-page testing
- GET/v1/produtos · Lists products
- POST/v1/produtos · Registers a product
- GET/v1/produtos/{codigo} · Gets a product by code
- PATCH/v1/produtos/{codigo} · Updates a product
- POST/v1/produtos/{codigo}/aprovacao-perfil · Approves the product's tax profile
- GET/v1/produtos/{codigo}/vinculos-entrada · Lists the product's links to purchases
- POST/v1/produtos/{codigo}/vinculos-entrada · Links the product to purchases
- DELETE/v1/produtos/{codigo}/vinculos-entrada/{id} · Removes a link
- GET/v1/nfe/perfil-fiscal/{empresa_id} · Company tax profile
- PUT/v1/nfe/perfil-fiscal/{empresa_id} · Saves the company tax profile
- POST/v1/nfe/perfil-fiscal/{empresa_id}/aprovacao · Approves the company tax profile