/api/invoice/createIssue a new invoice
Issues an NF-e (model 55). The issuing company is identified by the token header; do not send company_id in the body.
Required headers
tokenstring | string | Issuing company token |
signstring | string | MD5 signature: MD5(token + path + body + timestamp) |
timestampstring | string | Unix timestamp in seconds (5-minute window) |
Body — top-level fields
| Identification and operation | ||
idstring | string | Order ID in your system. Goes into the XML as xPed (no spaces, up to 15 characters). Deduplication: only in production (ambiente="1"), with finalidade empty or "1" and without is_reopen. If an invoice with the same id already exists, the API does not issue again: it returns the existing invoice with success: true and the same uuid (status Success, Processing or Contingencia); on simultaneous calls it responds "O pedido X já está em processamento" (order X is already being processed). The comparison uses the full id (before the 15-character cut) and also the transaction_type (0≡2, 1≡3) |
nature_*string | string | Operation nature (e.g., "Sale of goods") |
transaction_*string | string | Type: "0"=inbound, "1"=outbound, "2"=import, "3"=export |
model*string | string | Document model: "55"=NF-e |
issuance_*string | string | Issuance type — use "1" (normal).SVC contingency is triggered automatically by the platform when the origin tax authority is down; do not send "9" (it is the NFC-e-only offline contingency and is rejected for model 55) |
ambiente*string | string | "1"=production, "2"=homologation.In homologação the recipient name is replaced by "NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL" and a CPF is replaced by 12345678909 |
finalidadestring | string | Purpose: "1"=normal (default), "2"=complementary, "3"=adjustment, "4"=return.Any value outside this list is treated as "1" without warning. Purposes 5/6 (credit/debit note from NT 2025.002) are not supported yet |
ref_string | string | 44-digit access key of the referenced NF-e (complementary/adjustment/return). The API does not check presence or format: a missing or invalid key is only rejected by the tax authority |
is_boolean | boolean | Skips the deduplication by id and issues a new NF-e (new number), even if an invoice already exists for that order.It does not change or overwrite the previous invoice |
dh_string | string | Exit or entry datetime (ISO 8601). Default: current timestamp |
ieststring | string | IEST for this invoice (emit/IEST), up to 14 digits; overrides the IEST stored on the company. Omitted: the company's IEST for the destination state is used, only when the destination is another state and the invoice has ICMS-ST withheld |
| Amounts and discounts | ||
total_decimal | decimal | Total invoice discount. Warning: it only fills the vDesc total and is not apportioned across the items — the sum of the item discounts differs from the total and the tax authority rejects it. Prefer providing the discount in products[].discount_price and omitting this field |
price_boolean | boolean | Whether unit prices already include IPI. When true, IPI is back-calculated from the gross price and the invoice total equals the quoted price; default false. Can be overridden per product |
trocodecimal | decimal | Change amount (typical for NFC-e) |
segurodecimal | decimal | Insurance amount (goes to the items' vSeg) — split in proportion to each item's quantity (not its value) and rounded per item; the sum may differ from the amount sent by a few cents |
outras_decimal | decimal | Other expenses (go to the items' vOutro) — split in proportion to each item's quantity (not its value) and rounded per item; the sum may differ from the amount sent by a few cents |
| Indicators and additional info | ||
ind_string | string | End consumer: "0"=no (B2B), "1"=yes (B2C).Default: "1" |
ind_string | string | Presence indicator: "0"=not applicable, "1"=in-person, "2"=internet, "3"=tele-service, "4"=home delivery, "5"=in-person off-premises, "9"=other.Default: "2". The intermediary indicator (indIntermed) is always 0 — there is no field for infIntermed |
informacoes_string | string | Complementary info — appended to infAdic.infCpl after the automatic text (approximate taxes, DIFAL), separated by " | " |
informacoes_string | string | Information for the tax authority (written to infAdic.infAdFisco) |
clienteobject | object | object, required
For domestic operations ( transaction_type 0 or 1): cpf or cnpj, name, endereco, bairro (min. 2 chars), city, uf, and cep are required. For import/export (transaction_type 2 or 3): only name is required.
|
cpfstring | string | Customer CPF (alternative to cnpj) |
cnpjstring | string | Customer CNPJ (alternative to cpf) |
iestring | string | State Registration (Inscrição Estadual).indIEDest is derived: CNPJ with IE → 1; CNPJ without IE (or "ISENTO") → 9; CPF → always 9 and the IE is not sent. indIEDest cannot be provided directly |
name*string | string | Company / customer name |
enderecostring | string | Street address |
complementostring | string | Address complement |
numerostring | string | Address number (note: in cliente the field is numero; number is ignored and the XML gets "S/N") |
bairrostring | string | Neighborhood (minimum 2 characters for domestic operations) |
citystring | string | City |
ufstring | string | State (UF) — overwritten by the UF resolved from the CEP |
cepstring | string | CEP (postal code). The XML's UF and municipality come from the CEP: the uf and city sent are ignored when the CEP is found; an unknown CEP returns an error |
telefonestring | string | Phone |
emailstring | string | |
id_string | string | Foreign ID (used for import/export) |
c_int | int | BACEN country code. Default: 1058 (Brazil) |
x_string | string | Country name. Default: "BRASIL" |
products[]array | array | array, at least 1 item
Each product requires taxation: either category_id (reference to a pre-registered tax category), or the impostos object with inline configuration. Use the same mode for all items of the invoice: if any item comes with impostos, categories are not loaded and items with category_id fail with "ICMS não resolvido". With impostos, all four groups icms, ipi, pis and cofins are required (a missing group, or "impostos": {}, is refused).
|
codigostring | string | Internal product code |
name*string | string | Product description (xProd, up to 120 characters).Only unaccented letters and digits are kept: spaces, punctuation, accented letters and CJK characters are removed (e.g. "Ação 10 kg" → "Ao10kg") |
ncm*string | string | NCM with 8 digits |
ceststring | string | CEST code — required for goods listed in ICMS Agreement 142/2018 (segments subject to ST/advance payment), even when the operation has no separately stated ST |
gtinstring | string | GTIN / barcode |
gtin_string | string | Taxable-unit GTIN |
count*decimal | decimal | Quantity |
unit*string | string | Commercial unit (e.g., "UN", "KG", "MT") |
unit_*decimal | decimal | Unit price |
total_*decimal | decimal | Item total. Required, but not checked: the XML vProd is always unit_price × count |
discount_decimal | decimal | Discount applied to the item |
price_boolean | boolean | Per-product override of price_includes_ipi; omit to follow the invoice-level setting |
origem*int | int | Goods origin (0=Domestic, 1=Foreign — direct import, etc.) |
indicador_*int | int | Included in the NF-e total: 0=no, 1=yes |
category_string | string | ID of a pre-registered tax category (required if impostos is not provided) |
impostosobject | object | Inline tax configuration (alternative to category_id).Structure below. The former name tax_info is still accepted. |
icmsobject | object | |
industriastring | string | Legacy — not used in the calculation (may be omitted) |
codigo_string | string | CFOP |
situacao_string | string | ICMS CST/CSOSN — CSOSN (3 digits) for CRT 1/4; CST (2 digits) for CRT 2/3. A wrong combination is refused before the tax authority (Rejection 590/591) |
tipo_string | string | Person type: "fisica" or "juridica" |
codigo_string | string | cBenef (tax-benefit code) |
aliquotastring | string | Own ICMS rate in % (CST 00, 10, 20, 51, 70, 90). If empty, only CST 00 and 10 derive the rate (the state's internal rate or the interstate table); for CST 20, 51, 70, 90 and CSOSN 900 always send it, or ICMS comes out as 0 |
aliquota_string | string | Own ICMS base reduction percentage (CST 20, 51, 70, 90) |
aliquota_string | string | ICMS-ST rate of the destination state in % (CST 10, 30, 70, 90) |
aliquota_string | string | ICMS-ST base reduction percentage (CST 10, 30, 70, 90) |
aliquota_string | string | MVA/IVA-ST in % (CST 10, 30, 70, 90) |
aliquota_string | string | Own FCP rate in % — emits pFCP/vFCP in the ICMS group (CST 00, 10, 20, 51, 70, 90). In an interstate operation with ind_final="1" (default), all FCP fields of the ICMS group (FCP, FCP-ST and withheld FCP-ST) are removed (rule NA13); FCP only reappears in pFCPUFDest when the DIFAL group is generated (issuer CRT 2/3 and recipient with indIEDest=9) — otherwise it is not stated |
aliquota_string | string | FCP-ST rate in % (CST 10, 30, 70, 90) |
aliquota_string | string | Destination state’s FCP rate % (pFCPUFDest). Falls back to aliquota_fcp when omitted |
aliquota_string | string | Destination state’s ICMS rate %. Usually not needed — the platform keeps standard rates per state. Only override when the product has a differentiated rate in the destination state (beverages, tobacco, electricity). Destination state, not the sender’s. Use a dot as the decimal separator: here a comma is read as a thousands separator |
difal_boolean | boolean | Deduct the interstate ICMS already paid from the DIFAL base — the "com exclusão" in state rules. See "Interstate: how to set the DIFAL base" on this page |
difal_boolean | boolean | Gross up the DIFAL base because the tax is included in the price — the "base dupla" in state rules. See "Interstate: how to set the DIFAL base" on this page |
v_string | string | If you already computed the DIFAL base, pass the amount (R$) here. The two options above stop applying. Use a dot as the decimal separator: here a comma is read as a thousands separator |
aliquota_string | string | Simples Nacional credit rate in % (CSOSN 101, 201, 900) |
aliquota_string | string | ICMS deferral percentage (CST 51) |
motivo_string | string | ICMS exemption reason code (CST 20, 40, 41, 50, 90) |
ad_string | string | Single-phase ICMS — ad rem rate in BRL/unit (CST 02, 15, 53) |
ad_string | string | Single-phase ICMS — withheld ad rem in BRL/unit (CST 15, 61) |
p_string | string | Single-phase ICMS — deferral percentage (CST 53) |
q_string | string | Single-phase ICMS — taxed quantity (liters/kg). Empty uses the item quantity (CST 02, 15, 53, 61) |
valor_string | string | Exempted ICMS amount in BRL — emits vICMSDeson (CST 40, 41, 50, 90) |
v_string | string | Calculation base of the ICMS-ST withheld in the previous operation (provided, not calculated — CST 60, CSOSN 500) |
p_string | string | Rate borne by the final consumer, in % (provided, not calculated — CST 60, CSOSN 500) |
v_string | string | ICMS-ST amount withheld in the previous operation (provided, not calculated — CST 60, CSOSN 500) |
v_string | string | Substitute's own ICMS amount (provided, not calculated — CST 60, CSOSN 500) |
v_string | string | Calculation base of the FCP withheld by ST (provided, not calculated — CST 60, CSOSN 500) |
p_string | string | FCP rate withheld by ST, in % (provided, not calculated — CST 60, CSOSN 500) |
v_string | string | FCP amount withheld by ST (provided, not calculated — CST 60, CSOSN 500) |
| icms | ||
| ipi | ||
ipiobject | object | |
codigo_string | string | IPI legal framework code — 3 numeric digits (e.g., "999") |
situacao_string | string | IPI CST |
aliquotastring | string | IPI rate |
valor_string | string | IPI by quantity — value in BRL/unit. Only used when there is no percentage rate; if aliquota is present, the percentage takes precedence (CST 00, 50, 49, 99) |
tipo_string | string | Person type |
| pis | ||
pisobject | object | |
situacao_string | string | PIS CST |
aliquotastring | string | PIS rate |
valor_string | string | PIS by quantity — value in BRL/unit. vPIS = quantity × value (CST 03 and other per-quantity forms) |
tipo_string | string | Person type |
| cofins | ||
cofinsobject | object | |
situacao_string | string | COFINS CST |
aliquotastring | string | COFINS rate |
valor_string | string | COFINS by quantity — value in BRL/unit. vCOFINS = quantity × value (CST 03 and other per-quantity forms) |
tipo_string | string | Person type |
| is (Selective Tax) — accepted, but not yet issued in the XML | ||
isobject | object | |
cenariostring | string | IS scenario |
situacao_string | string | IS CST |
aliquotastring | string | IS rate |
tipo_string | string | Person type |
| ibs_cbs (Tax Reform) | ||
ibs_object | object | |
situacao_string | string | IBS/CBS CST. Supported: 000, 010, 011, 200, 220, 221, 222, 400, 410, 510, 515, 550, 620, 800, 810, 811, 820, 830; any other CST produces an empty IBSCBS group and a rejection. Optional: without impostos.ibs_cbs the invoice has no IBS/CBS group; with the object and empty rates, 0.10 / 0 / 0.90 are used |
tipo_string | string | Person type |
classificacao_string | string | cClassTrib — 6 digits, starting with the CST (e.g., "000001") |
p_string | string | IBS state rate in % (optional; empty or "0" uses the transition default, 0.10 in 2026).Accepts dot or comma |
p_string | string | IBS municipal rate in % (optional; default 0 in 2026) |
p_string | string | CBS rate in % (optional; empty or "0" uses the default 0.90 in 2026) |
p_string | string | Rate reduction percentage — always provide it for CST 011, 200 and 515 (without it the full rate is applied) |
p_string | string | Deferral percentage (CST 510, 515) |
p_string | string | Tax base reduction percentage (CST 222) |
proporcaostring | string | Operation proportion in % — always provide it for CST 221 (without it the tax is 0) |
aliquota_string | string | Single-phase CBS — rate in % over the base; takes precedence over valor_unidade_cbs (CST 620).If either aliquota_cbs_mono or aliquota_ibs_mono is greater than 0, both taxes use the percentage and both valor_unidade_* are ignored |
aliquota_string | string | Single-phase IBS — rate in % over the base; takes precedence over valor_unidade_ibs (CST 620) |
valor_string | string | Single-phase CBS — ad rem in BRL/unit; only used when there is no percentage rate (CST 620) |
valor_string | string | Single-phase IBS — ad rem in BRL/unit; only used when there is no percentage rate (CST 620) |
valor_string | string | Legal base deduction value in BRL (CST 830) |
| difal | ||
difalobject | object | |
disable_boolean | boolean | Disables DIFAL for the item (alternative to disable_difal at the product level) |
disable_boolean | boolean | Disables DIFAL calculation for this item (the ICMSUFDest group is still emitted, with a zero difference).Combined (OR) with the category flag |
desconta_boolean | boolean | Deducts the line's ICMS and, in interstate sales to non-taxpayer final consumers, also the destination-state DIFAL before computing PIS/COFINS — tax on (amount − ICMS − DIFAL), floor 0 (Supreme Court Tema 69; Superior Court of Justice Tema 1372); default false (no deduction, higher tax). Combined (OR) with the category flag: either one being true is enough |
desconta_boolean | boolean | Computes the IBS/CBS base with the official RFB formula (unified base of the regular-regime calculator): item value (product + freight + insurance + other − discount) + II − ICMS − FCP − single-phase ICMS − DIFAL and destination-state FCP − ISSQN − PIS − COFINS, floor 0 (PIS and COFINS are only deducted in 2026); if desconta_icms_pis_cofins is also true, the already-reduced PIS/COFINS is used; default false. Combined (OR) with the category flag: either one being true is enough |
iiobject | object | Import Tax — only emitted with transaction_type="2" (the CFOP does not matter) and the API does not check that it is present.See structure below |
vBCdecimal | decimal | II calculation base |
vDespAdudecimal | decimal | Customs expenses |
vIIdecimal | decimal | II amount |
vIOFdecimal | decimal | IOF amount |
import_array | array | Import Declarations (DI) — required when transaction_type="2".Structure below (only emitted in that case; the API does not check that it is present) |
nDIstring | string | DI number |
dDIstring (date) | string (date) | DI date |
xLocDesembstring | string | Customs clearance location |
UFDesembstring | string | Customs clearance state |
dDesembstring (date) | string (date) | Customs clearance date |
cExportadorstring | string | Exporter code |
tpViaTranspint | int | International transport mode |
tpIntermedioint | int | Intermediation type |
vAFRMMdecimal | decimal | AFRMM amount |
additionsarray | array | DI additions (fields: nAdicao, nSeqAdic, cFabricante, vDescDI, nDraw) |
nItemPedint | int | Purchase Order Item (I61). Sequential item number within the order referenced by xPed (which comes from root id). Valid range: 1–999999. Default: omitted. Accepted alias: n_item_ped. |
ipi_object | object | Returned IPI (impostoDevol/UA group) — only issued with finalidade="4" (return).Fields: percentual_devolvido (% of the goods returned) and valor_ipi_devolvido (BRL). Also accepted inside impostos. Zero is a valid value: the group is issued whenever the key is present |
Interstate: how to set the DIFAL base
This section applies only to interstate sales to non-taxpayer recipients (indIEDest=9: individuals or a CNPJ without IE). It does not apply to intrastate operations or to taxpayer recipients. Simples Nacional issuers (CRT 1/4) do not generate the ICMSUFDest group, so nothing in this section applies to them.
Step 1 — look up the buyer’s state
| Buyer’s state | Send in addition to aliquota, aliquota_fcp |
|---|---|
| PE, RJ | nothing else |
| SE | only difal_base_por_dentro: true |
| the other 24 states AC AL AM AP BA CE DF ES GO MA MG MS MT PA PB PI PR RN RO RR RS SC SP TO | difal_desconta_icms_inter: truedifal_base_por_dentro: true |
Important: the DIFAL base method directly determines the tax due; choosing the wrong one leads to underpayment (with exposure to assessments and penalties) or overpayment. The table above reflects the prevailing practice per state and is provided for reference only — state legislation changes, and specific goods may follow differentiated rules. Confirm the applicable method for the destination state with your accountant or tax advisor before going live. If unsure, send neither difal_desconta_icms_inter nor difal_base_por_dentro: the base equals the invoice amount, which is the most conservative treatment.
Step 2 — request examples by scenario
Selling to RJ — difal_desconta_icms_inter and difal_base_por_dentro not required (FECP 2%)
{
"icms": { "codigo_cfop": "6102", "situacao_tributaria": "00",
"aliquota": "4", "aliquota_fcp": "2" }
}Selling to AL — difal_desconta_icms_inter and difal_base_por_dentro both set to true (FECP 1%)
{
"icms": { "codigo_cfop": "6102", "situacao_tributaria": "00",
"aliquota": "4", "aliquota_fcp": "1",
"difal_desconta_icms_inter": true,
"difal_base_por_dentro": true }
}If your system already calculates the DIFAL base, send v_bc_uf_dest; difal_desconta_icms_inter and difal_base_por_dentro then no longer apply
{
"icms": { "aliquota": "4", "aliquota_fcp": "1", "v_bc_uf_dest": "122.29" }
}What each option produces
| How to send | DIFAL base | DIFAL due |
|---|---|---|
| neither difal_desconta_icms_inter nor difal_base_por_dentro | 100.00 | 16.50 |
| both true | 122.29 | 21.07 |
| v_bc_uf_dest=150 | 150.00 | 26.75 |
Invoice 100.00, interstate ICMS paid 4.00, destination rate 20.5%, FECP 1%. The 4% interstate rate applies only to imported goods (origem 1, 2, 3 or 8); for domestic goods use 7% or 12%, depending on the states.
Why states differ (background, safe to skip)
ICMS is a tax-inclusive tax. Some states require the DIFAL itself to be added back into its own base (base dupla) after deducting the interstate ICMS already paid (com exclusão); others use the operation amount directly (base única). difal_desconta_icms_inter and difal_base_por_dentro correspond to these two steps. The destination rate itself is maintained by the platform.
Body — shipping_address / delivery_address (objects, optional)
shipping_address is the pickup location (physical origin, if different from the issuer). delivery_address is the delivery location (physical destination, if different from the customer). When present, both require: cpf or cnpj, name, endereco, bairro (min. 2 chars), city, uf, and cep. Both objects share the same structure.
cpfstring | string | CPF (alternative to cnpj) |
cnpjstring | string | CNPJ (alternative to cpf) |
iestring | string | State Registration |
name*string | string | Company / name |
endereco*string | string | Street address |
complementostring | string | Complement |
numberstring | string | Number (note: the field is number, not numero).Without it nro is empty and the API itself refuses the invoice at schema validation, before sending it to the tax authority (success:false with the reason in message). Send "S/N" if there is no number |
bairro*string | string | Neighborhood |
city*string | string | City |
uf*string | string | State |
cep*string | string | ZIP code |
telefonestring | string | Phone |
emailstring | string | |
transportationobject | object | object, optional
If transportation is omitted, the system assumes transport_mode="9" (no freight).
|
transport_string | string | Freight mode: "0"=paid by issuer, "1"=paid by recipient, "2"=paid by third party, "3"=sender's own transport, "4"=recipient's own transport, "9"=no freight.Required when transportation is sent: without it (or outside the list) the XML gets modFrete=3 and only the freight amount is used. In modes "3" and "4" the carrier is not emitted; with "9" no carrier, vehicle, trailer, packages or retention are emitted, but freight_amount is still split across the items (send 0). transport_tax_retention_info is only emitted with "0" |
freight_decimal | decimal | Total freight amount — split in proportion to each item's quantity (not its value) and rounded per item; the sum may differ from the amount sent by a few cents |
| carrier_info — carrier | ||
carrier_object | object | |
cpfstring | string | Carrier CPF (alternative to cnpj). Required (CPF or CNPJ) whenever carrier_info is sent |
cnpjstring | string | Carrier CNPJ (alternative to cpf). Required (CPF or CNPJ) whenever carrier_info is sent |
iestring | string | State Registration (only emitted together with a CNPJ; in modes "0" and "2", with a CNPJ, send the IE or "ISENTO" — if empty, the invoice is refused at schema validation) |
namestring | string | Company name — without it the transporta group is not emitted |
enderecostring | string | Street address |
citystring | string | City |
ufstring | string | State |
cepstring | string | ZIP code — read, but not written to the XML (the transporta group has no CEP) |
| vehicle_info — vehicle | ||
vehicle_object | object | |
platestring | string | License plate |
ufstring | string | Plate state |
rntcstring | string | RNTC (National Cargo Carrier Registration) |
| trailer_info — trailer (same structure as vehicle_info) | ||
trailer_object | object | |
platestring | string | Trailer plate |
ufstring | string | State |
rntcstring | string | RNTC |
| packages[] — volumes | ||
packages[]array | array | |
qtyint | int | Quantity |
gross_decimal | decimal | Gross weight |
net_decimal | decimal | Net weight |
packaging_string | string | Packaging type |
numberstring | string | Numbering |
markstring | string | Mark |
sealsarray<string> | array<string> | Seals |
| transport_tax_retention_info — ICMS retention on freight | ||
transport_object | object | |
freight_decimal | decimal | Transport service amount |
tax_decimal | decimal | Retention calculation base |
tax_decimal | decimal | Retention rate |
cfopstring | string | CFOP |
cepstring | string | ZIP code |
pag_array | array | array, optional
If omitted, the system assumes [{ "payment_method": "01", "payment_indicator": "0" }] (cash, paid upfront).
|
payment_*string | string | Payment method: "01"=cash, "02"=check, "03"=credit card, "04"=debit card, "05"=store credit, "10"=food voucher, "11"=meal voucher, "12"=gift card, "13"=fuel voucher, "14"=trade bill (duplicata mercantil), "15"=bank slip, "16"=bank deposit, "17"=dynamic PIX, "18"=transfer/digital wallet, "19"=loyalty/cashback, "20"=static PIX, "21"=store credit (crédito em loja), "22"=electronic payment hardware failure, "90"=no payment, "91"=deferred payment, "99"=others |
payment_string | string | Payment method description (xPag) — required when payment_method="99" (without it the API refuses; at the tax authority it would be Rejection 441) |
payment_*string | string | Indicator: "0"=paid in full (à vista), "1"=deferred / installments (a prazo) |
payment_decimal | decimal | Amount paid. If omitted, the invoice total is used ( vNF, which includes freight, insurance, other expenses, IPI and ST). With more than one payment method, provide it in all of them. For methods "90" and "91", vPag is always 0 |
card_info — card details (for payment_method 03/04). If omitted, the XML gets tpIntegra=1 and the Visa brand (01) — provide it to avoid incorrect data | ||
card_object | object | |
integration_*string | string | Integration type: "1"=integrated with the automation system (TEF), "2"=not integrated (POS).Required if card_info is present |
brand_*string | string | Brand (tBand): "01"=Visa, "02"=Mastercard, "03"=American Express, "04"=Sorocred, "05"=Diners, "06"=Elo, "07"=Hipercard, "08"=Aura, "09"=Cabal, "99"=others (among other codes of the tBand table).Required if card_info is present |
acquirer_string | string | Acquirer CNPJ |
authorization_string | string | Authorization code |
* Required field.
Examples
# sign = md5(token + path + body + timestamp) # Template generated from the endpoint path; replace the placeholders curl -X POST "https://api.tffiscal.com/api/invoice/create" \ -H "Content-Type: application/json" \ -H "token: $TOKEN" \ -H "timestamp: $TIMESTAMP" \ -H "sign: $SIGN" \ -d @body.json
{
"nature_of_operation": "Venda de mercadoria",
"transaction_type": "1",
"model": "55",
"issuance_type": "1",
"ambiente": "2",
"cliente": {
"cnpj": "11222333000181",
"name": "Cliente Exemplo LTDA",
"endereco": "Rua Exemplo",
"numero": "100",
"bairro": "Centro",
"city": "São Paulo",
"uf": "SP",
"cep": "01001000",
"email": "cliente@exemplo.com"
},
"products": [
{
"codigo": "PROD001",
"name": "Produto Exemplo",
"ncm": "85176277",
"count": 2,
"unit": "UN",
"unit_price": 150.00,
"total_price": 300.00,
"category_id": "SEU_CATEGORY_ID",
"origem": 0,
"indicador_total": 1
}
],
"pag_info": [
{ "payment_method": "01", "payment_indicator": "0", "payment_value": 300.00 }
]
}
{
"id": "PEDIDO-2026-0001",
"nature_of_operation": "Venda de mercadoria",
"transaction_type": "1",
"model": "55",
"issuance_type": "1",
"ambiente": "2",
"finalidade": "1",
"ref_nfe_chave": "",
"is_reopen": false,
"dh_sai_ent": "",
"total_discount_amount": 0.0,
"troco": 0.0,
"seguro": 0.0,
"outras_despesas": 0.0,
"price_includes_ipi": false,
"ind_final": "1",
"ind_pres": "9",
"informacoes_complementares": "Entrega via transportadora",
"informacoes_fisco": "ICMS recolhido conforme legislação",
"cliente": {
"cpf": "",
"cnpj": "12345678000195",
"ie": "110030010189",
"name": "Cliente Exemplo LTDA",
"endereco": "Av. Paulista",
"numero": "1000",
"complemento": "Sala 200",
"bairro": "Bela Vista",
"city": "São Paulo",
"uf": "SP",
"cep": "01310100",
"telefone": "11999998888",
"email": "cliente@exemplo.com",
"id_estrangeiro": "",
"c_pais": 1058,
"x_pais": "BRASIL"
},
"shipping_address": {
"cnpj": "98765432000198",
"name": "Depósito Origem LTDA",
"ie": "123456785016",
"endereco": "Rua do Depósito",
"number": "50",
"complemento": "Galpão 3",
"bairro": "Industrial",
"city": "Guarulhos",
"uf": "SP",
"cep": "07000000",
"telefone": "11988887777",
"email": "deposito@exemplo.com"
},
"delivery_address": {
"cnpj": "12345678000195",
"name": "Cliente Exemplo LTDA",
"ie": "110030010189",
"endereco": "Rua de Entrega",
"number": "25",
"complemento": "Loja 2",
"bairro": "Centro",
"city": "Campinas",
"uf": "SP",
"cep": "13010000",
"telefone": "11977776666",
"email": "entrega@exemplo.com"
},
"products": [
{
"codigo": "PROD001",
"name": "Notebook Dell",
"ncm": "84713012",
"cest": "",
"gtin": "7891234567895",
"gtin_tributavel": "7891234567895",
"count": 2,
"unit": "UN",
"unit_price": 3500.0,
"total_price": 7000.0,
"discount_price": 0.0,
"origem": 0,
"indicador_total": 1,
"impostos": {
"icms": { "codigo_cfop": "5102", "situacao_tributaria": "00", "tipo_pessoa": "juridica", "aliquota": "18" },
"ipi": { "codigo_enquadramento": "999", "situacao_tributaria": "99", "aliquota": "0" },
"pis": { "situacao_tributaria": "01", "aliquota": "0.65" },
"cofins": { "situacao_tributaria": "01", "aliquota": "3.00" },
"ibs_cbs": { "situacao_tributaria": "000", "classificacao_tributaria": "000001" }
},
"nItemPed": 1,
"price_includes_ipi": false,
"desconta_icms_pis_cofins": false,
"desconta_icms_pis_cofins_ibs_cbs": false,
"disable_difal": false
},
{
"codigo": "PROD002",
"name": "Mouse sem fio",
"ncm": "84716053",
"count": 5,
"unit": "UN",
"unit_price": 80.0,
"total_price": 400.0,
"origem": 0,
"indicador_total": 1,
"nItemPed": 2,
"impostos": {
"icms": {
"codigo_cfop": "5102",
"situacao_tributaria": "00",
"industria": "",
"tipo_pessoa": "juridica",
"codigo_beneficio_fiscal": "",
"aliquota": "18",
"aliquota_fcp": "0",
"aliquota_reducao": "0",
"aliquota_st": "0",
"aliquota_reducao_st": "0",
"aliquota_mva": "0",
"aliquota_fcp_st": "0",
"aliquota_credito": "0",
"motivo_desoneracao": "",
"valor_desoneracao": "0"
},
"ipi": {
"codigo_enquadramento": "999",
"situacao_tributaria": "99",
"aliquota": "0.00",
"tipo_pessoa": "juridica"
},
"pis": {
"situacao_tributaria": "01",
"aliquota": "0.65",
"tipo_pessoa": "juridica"
},
"cofins": {
"situacao_tributaria": "01",
"aliquota": "3.00",
"tipo_pessoa": "juridica"
},
"ibs_cbs": {
"situacao_tributaria": "000",
"tipo_pessoa": "juridica",
"classificacao_tributaria": "000001",
"p_ibs_uf": "0.1",
"p_ibs_mun": "0",
"p_cbs": "0.9"
},
"is": {},
"difal": {
"disable_difal": false
}
},
"discount_price": 0.0,
"price_includes_ipi": false,
"desconta_icms_pis_cofins": true,
"desconta_icms_pis_cofins_ibs_cbs": false
}
],
"transportation": {
"transport_mode": "0",
"freight_amount": 150.0,
"carrier_info": {
"cnpj": "11222333000181",
"ie": "110042490114",
"name": "Transportadora Exemplo LTDA",
"endereco": "Rod. BR-101, km 50",
"city": "Santos",
"uf": "SP",
"cep": "11000000"
},
"vehicle_info": {
"plate": "ABC1D23",
"uf": "SP",
"rntc": "12345"
},
"trailer_info": {
"plate": "DEF4G56",
"uf": "SP",
"rntc": "67890"
},
"packages": [
{
"qty": 3,
"gross_weight": 12.5,
"net_weight": 11.0,
"packaging_type": "CAIXA",
"number": "001-003",
"mark": "FRAGIL",
"seals": [
"LACRE001",
"LACRE002"
]
}
],
"transport_tax_retention_info": {
"freight_service_amount": 150.0,
"tax_base": 150.0,
"tax_rate": 12.0,
"cfop": "5353",
"cep": "11000000"
}
},
"pag_info": [
{
"payment_indicator": "1",
"payment_method": "03",
"payment_value": 7550.0,
"card_info": {
"integration_type": "1",
"brand_code": "01",
"acquirer_cnpj": "01234567000195",
"authorization_code": "AUTH987654"
}
}
]
}
{
"success": true,
"data": {
"uuid": "4663a257-adf1-4561-971f-6aaffbd30ca8",
"status": "Success",
"motivo": "Rejeição 100: Autorizado o uso da NF-e",
"nfe": 100,
"serie": 1,
"chave": "35260111444777000161550010000001001000000010",
"modelo": "nfe",
"epec": false,
"xml": "https://oss.example.com/.../chave.xml"
}
}Fields by scenario
The following sections list, for each field group, the parameters required for each possible value. Each section provides a minimal request fragment containing only that field group, together with the fields required in that case; fields not listed need not be sent. Complete requests are given in "Simplified example" and "Complete example (all fields)" at the end of this page.
- Invoice purpose
finalidadeand referenced invoiceref_nfe_chave - Final consumer
ind_finaland buyer presenceind_pres - Buyer
cliente - Pickup address
shipping_addressand delivery addressdelivery_address - Product lines
products[] - Two ways of specifying product taxes
- ICMS under the normal regime (CRT 2, 3)
- ICMS under Simples Nacional (CRT 1, 4)
- PIS and COFINS
- IPI
- IBS and CBS (2026 tax reform)
- Payment
pag_info[] - Transport
transportation - Import and export
- Issuance type
issuance_type
Scenario 1: Simples Nacional company selling to an individual (CSOSN 102)
A company under the Simples Nacional regime sells online to an individual consumer; the product taxes are given directly in the product line.
{
"id": "PED-000014553",
"nature_of_operation": "Venda de mercadoria",
"transaction_type": "1",
"model": "55",
"issuance_type": "1",
"ambiente": "2",
"cliente": {
"cpf": "88533234775", "name": "Cliente Demo", "email": "cliente.demo@mail.com",
"endereco": "Rua Presidente Wilson", "numero": "911", "bairro": "Uberaba",
"city": "Curitiba", "uf": "PR", "cep": "81570440"
},
"products": [
{
"codigo": "000068", "name": "Pendrive 16GB", "ncm": "85235190",
"count": 2, "unit": "UN", "unit_price": 28.47, "total_price": 56.94,
"origem": "0", "indicador_total": "1",
"impostos": {
"icms": { "codigo_cfop": "6102", "situacao_tributaria": "102" },
"ipi": { "situacao_tributaria": "53", "codigo_enquadramento": "999" },
"pis": { "situacao_tributaria": "49" },
"cofins": { "situacao_tributaria": "49" }
}
}
],
"pag_info": [ { "payment_indicator": "0", "payment_method": "17", "payment_value": 56.94 } ]
}Scenario 2: Normal-regime company selling to a business (CST 00)
A company under the normal tax regime sells to a business holding a state registration (IE); the product taxes reference a tax category previously saved on the platform (category_id), and the CFOP and tax rates are determined by that tax category.
{
"id": "PED-000014554",
"nature_of_operation": "Venda de mercadoria",
"transaction_type": "1",
"model": "55",
"issuance_type": "1",
"ambiente": "2",
"ind_final": "0",
"cliente": {
"cnpj": "12345678000199", "ie": "123456789", "name": "Empresa Cliente Ltda",
"endereco": "Rua Exemplo", "numero": "123", "bairro": "Centro",
"city": "São Paulo", "uf": "SP", "cep": "01234567"
},
"products": [
{
"codigo": "PROD001", "name": "Smartphone XYZ", "ncm": "85171231",
"count": 2, "unit": "UN", "unit_price": 1500.00, "total_price": 3000.00,
"origem": "0", "indicador_total": "1", "category_id": "SEU_CATEGORY_ID"
}
],
"pag_info": [ { "payment_indicator": "1", "payment_method": "15", "payment_value": 3000.00 } ]
}Invoice purpose finalidade and referenced invoice ref_nfe_chave 3 blocks
finalidade and referenced invoice ref_nfe_chave 3 blocksWhen finalidade is omitted, the invoice is a normal invoice (1). The complementary, adjustment and return purposes each issue a new invoice (new number, new access key) that references the authorized original invoice in ref_nfe_chave (44-digit access key; a single key only). For complementary and return invoices, the API returns an error directly when the reference to the original invoice is missing. Each of these invoices consumes one unit of quota, in the same way as a normal invoice. When only registration data is corrected and no amounts or tax values are affected, a correction letter (CC-e) is used instead of a new invoice.
Complementary invoice (2)
When the original invoice under-declared the price, quantity or tax value, a separate complementary invoice is issued for the difference only. For example, when the original invoice declared ICMS at 12% and the correct rate is 18%, the complementary invoice declares the difference. A complementary invoice normally involves no payment, so pag_info uses 90 (no payment).
"finalidade": "2",
"ref_nfe_chave": "35241022762481000105550030002811221166419985",
"pag_info": [ { "payment_indicator": "0", "payment_method": "90" } ]Adjustment invoice (3)
Used for tax adjustments provided for in the legislation, such as ICMS assessment adjustments, transfers of credits between branches and inventory adjustments. Whether an adjustment invoice applies should first be confirmed with the accountant.
"finalidade": "3", "ref_nfe_chave": "35241022762481000105550030002811221166419985"
Return invoice (4)
Returns should preferably be issued through /api/invoice/return: that endpoint automatically sets the inbound direction, the return purpose, no payment (90) and the reference to the original invoice. To issue a return invoice through this endpoint, finalidade must be sent as "4" and transaction_type as "0" (inbound), and the original invoice must be referenced; this endpoint does not adjust the inbound direction automatically. Returned IPI is declared through ipi_devolvido in the product line and takes effect only in return invoices.
"finalidade": "4",
"transaction_type": "0",
"ref_nfe_chave": "35241022762481000105550030002811221166419985",
"pag_info": [ { "payment_indicator": "0", "payment_method": "90" } ]Final consumer ind_final and buyer presence ind_pres
ind_final and buyer presence ind_presWhen ind_final is omitted, the sale is treated as a sale to a final consumer (1); it is declared as a business-to-business transaction only when "0" is sent. "0" must be sent for sales to businesses that purchase for resale or production. When ind_pres is omitted, the sale is an internet sale (2); a value not listed in the table below leaves the default value unchanged.
"ind_final": "0", "ind_pres": "1"
| ind_pres | Description |
|---|---|
| 0 | Not applicable (for example, complementary or adjustment invoices) |
| 1 | In-person transaction |
| 2 | Internet (default) |
| 3 | Telephone |
| 4 | NFC-e with home delivery |
| 5 | In-person transaction outside the establishment |
| 9 | Other non-in-person transaction |
Buyer cliente 4 blocks
cliente 4 blocksDomestic transactions (transaction_type 0 or 1) require a document number and a complete address. The state and city codes are taken from the cep lookup result; uf and city are only checked for being non-empty. The key for the street number is numero; when omitted, it is declared as S/N. telefone is not declared when it has fewer than 10 digits. When both cpf and cnpj are sent, the buyer is treated as a CPF holder, and cnpj and ie have no effect.
Individual consumer
cpf is sent. Individuals are always declared as non-taxpayers of ICMS; for interstate sales, the platform calculates DIFAL.
"cliente": {
"cpf": "88533234775", "name": "Cliente Demo",
"endereco": "Rua Presidente Wilson", "numero": "911", "bairro": "Uberaba",
"city": "Curitiba", "uf": "PR", "cep": "81570440"
}Business buyer, ICMS taxpayer
cnpj and ie (state registration) are sent. A business with a state registration is declared as an ICMS taxpayer, and DIFAL is not calculated for interstate sales.
"cliente": {
"cnpj": "12345678000199", "ie": "123456789", "name": "Empresa Cliente Ltda",
"endereco": "Rua Exemplo", "numero": "123", "bairro": "Centro",
"city": "São Paulo", "uf": "SP", "cep": "01234567"
}Business buyer without a state registration
Only cnpj is sent. A business without a state registration is declared as a non-taxpayer of ICMS, and for interstate sales DIFAL is calculated in the same way as for individuals. Only the digits of ie are kept; sending "ISENTO" has the same effect as omitting the field.
"cliente": {
"cnpj": "12345678000199", "name": "Prestadora de Servicos Ltda",
"endereco": "Av. Brasil", "numero": "500", "bairro": "Centro",
"city": "Rio de Janeiro", "uf": "RJ", "cep": "20040002"
}| Field | Type | Description |
|---|---|---|
| cpf / cnpj * | string | One of the two is required; punctuation is allowed |
| ie | string | State registration; takes effect only together with cnpj |
| name * | string | Characters beyond the 60th are truncated |
| endereco * | string | Street |
| numero | string | Street number; S/N when omitted |
| bairro * | string | Neighborhood, at least 2 characters |
| city / uf * | string | City and state; the declared values are taken from the cep lookup result |
| cep * | string | ZIP code; must be found by the lookup |
| telefone / email / complemento | string | Optional |
Foreign buyer (export)
When transaction_type is "3" (export) or "2" (import), only name is required, and no ZIP code lookup is performed. c_pais and x_pais must always be sent: when omitted, the country is declared as Brazil and the invoice is rejected.
"transaction_type": "3",
"cliente": {
"name": "Foreign Buyer Inc.", "id_estrangeiro": "PA1234567",
"c_pais": "2496", "x_pais": "ESTADOS UNIDOS",
"endereco": "5th Avenue 100", "city": "New York"
}| Field | Type | Description |
|---|---|---|
| name * | string | Buyer name |
| id_ | string | Foreign identification document number (passport or similar) |
| c_ | string | Central Bank of Brazil country code, for example 2496 (United States) |
| x_ | string | Country name |
| endereco / bairro / city | string | Declared as EXTERIOR when omitted |
Pickup address shipping_address and delivery address delivery_address
shipping_address and delivery address delivery_addressshipping_address is sent when the goods are dispatched from a location other than the invoice address, and delivery_address is sent when the goods are delivered to a location other than the buyer's address. Both have the same structure and are independent of the transport mode. When provided, cpf or cnpj, name, endereco, bairro, city, uf and cep are all required; the key for the street number is number (unlike cliente.numero); telefone may contain digits only.
"delivery_address": {
"cnpj": "11222333000181", "name": "Deposito Demo",
"endereco": "Rua B", "number": "20", "bairro": "Centro",
"city": "Curitiba", "uf": "PR", "cep": "80010000", "telefone": "41999990000"
}Product lines products[]
products[]The product amount is calculated as unit_price × count; total_price is recorded only and is not used in the calculation. discount_price is the discount for the line and reduces the tax base of every tax. The invoice-level freight_amount, seguro and outras_despesas are apportioned among the lines in proportion to their quantities. When codigo is omitted, the product name is used instead; when gtin is omitted, it is declared as SEM GTIN.
{
"codigo": "SKU-001", "name": "Camiseta Algodao", "ncm": "61091000", "cest": "2806300",
"gtin": "7891234567895", "n_item_ped": "1",
"count": 3, "unit": "UN", "unit_price": 50.00, "total_price": 150.00, "discount_price": 15.00,
"origem": "0", "indicador_total": "1", "category_id": "SEU_CATEGORY_ID"
}Two ways of specifying product taxes 2 blocks
Each product line must use exactly one of two options: a reference to a tax category saved on the platform (category_id), or impostos given directly in the product line. All product lines of the same invoice must use the same option; when the options are mixed, issuance fails for the lines that reference a tax category. When both are sent, category_id prevails, and in impostos only the DIFAL-related fields and ipi_devolvido take effect. The type of ICMS tax code is determined by the company's tax regime: Simples Nacional (CRT 1, 4) accepts only three-digit CSOSN codes, and the normal regime (CRT 2, 3) accepts only two-digit CST codes; when the wrong type is used, the API returns an error.
Tax category reference category_id
Tax categories are configured on the platform separately by buyer type (individual, business) and by scenario (outbound or inbound, intrastate or interstate); the CFOP, CST and tax rates are determined by the matching row. This option is suited to cases in which product taxes are fixed and maintained centrally by the accountant.
{ "name": "Smartphone XYZ", "ncm": "85171231", "count": 1, "unit": "UN",
"unit_price": 1500.00, "total_price": 1500.00, "origem": "0", "indicador_total": "1",
"category_id": "SEU_CATEGORY_ID" }Inline impostos
All four groups icms, ipi, pis and cofins must be provided; when any group is missing, the API returns an error. icms.codigo_cfop is required. ibs_cbs is optional. Rates are sent as percentage strings, for example "18" for 18%. The fields required by each tax code in each group are described in the following sections.
"impostos": {
"icms": { "codigo_cfop": "5102", "situacao_tributaria": "00", "aliquota": "18" },
"ipi": { "situacao_tributaria": "53", "codigo_enquadramento": "999" },
"pis": { "situacao_tributaria": "01", "aliquota": "1.65" },
"cofins": { "situacao_tributaria": "01", "aliquota": "7.60" }
}ICMS under the normal regime (CRT 2, 3) 10 blocks
The tax base is the product amount plus the apportioned freight, insurance and other expenses, minus the discount. For sales to a final consumer, IPI is added to the tax base for CST 00, 20, 51 and 90. All fragments below are the content of impostos.icms.
CST 00: fully taxed
aliquota may be omitted: when omitted or 0, the internal rate of the state of origin applies to intrastate sales, and the interstate rate applies to interstate sales (4% for imported goods).
{ "codigo_cfop": "5102", "situacao_tributaria": "00", "aliquota": "18", "aliquota_fcp": "2" }| Field | Description |
|---|---|
| aliquota | ICMS rate (%); optional |
| aliquota_ | FCP rate (%); declared when greater than 0 |
CST 10: taxed, with ICMS-ST collected for subsequent operations
aliquota_st is required. The ST tax base is (product amount + IPI) × (1 + MVA%), then reduced by aliquota_reducao_st; the amount collected equals the ST tax minus the operation's own ICMS.
{ "codigo_cfop": "5401", "situacao_tributaria": "10", "aliquota": "18",
"aliquota_st": "18", "aliquota_mva": "40", "aliquota_fcp_st": "2" }| Field | Description |
|---|---|
| aliquota | Rate of the operation's own ICMS; optional (same rule as CST 00) |
| aliquota_ | ST rate (%) |
| aliquota_ | MVA (%); when omitted, the ST base is calculated on the transaction amount |
| aliquota_ | ST tax base reduction (%) |
| aliquota_ | FCP and FCP-ST rates (%) |
CST 20: reduced tax base
aliquota is required (the default rate is not applied automatically). When there is a reduction, the platform calculates the relieved ICMS amount automatically, and motivo_desoneracao must be provided.
{ "codigo_cfop": "5102", "situacao_tributaria": "20", "aliquota": "18",
"aliquota_reducao": "33.33", "motivo_desoneracao": "9" }| Field | Description |
|---|---|
| aliquota * | ICMS rate (%) |
| aliquota_ | Tax base reduction (%) |
| motivo_ | ICMS exemption reason code (numeric) |
| aliquota_ | FCP rate (%) |
CST 30: exempt operation, with ICMS-ST collected for subsequent operations
The operation's own ICMS is 0; only ST is calculated. The fields are the same as the ST part of CST 10; aliquota has no effect.
{ "codigo_cfop": "5403", "situacao_tributaria": "30", "aliquota_st": "18", "aliquota_mva": "40" }CST 40, 41, 50: exempt, not taxed, suspended
No tax is calculated, and the rate fields have no effect. When there is a relieved ICMS amount, valor_desoneracao and motivo_desoneracao are sent.
{ "codigo_cfop": "5102", "situacao_tributaria": "40" }CST 51: deferral
aliquota is required; aliquota_diferimento is the deferral percentage, and the platform calculates the ICMS of the operation, the deferred ICMS and the ICMS payable.
{ "codigo_cfop": "5101", "situacao_tributaria": "51", "aliquota": "18", "aliquota_diferimento": "100" }CST 60: ICMS-ST previously collected
No tax is calculated. The amounts previously collected are provided by the caller and declared as received; each field is declared only when greater than 0.
{ "codigo_cfop": "5405", "situacao_tributaria": "60",
"v_bc_st_ret": "100.00", "p_st": "18", "v_icms_st_ret": "18.00", "v_icms_substituto": "12.00" }| Field | Description |
|---|---|
| v_ | Tax base, rate and tax amount previously collected |
| v_ | The substitute taxpayer's own ICMS |
| v_ | FCP previously collected |
CST 70: reduced tax base, with ICMS-ST collected for subsequent operations
A combination of CST 20 and CST 10: aliquota, aliquota_reducao and aliquota_st are required.
{ "codigo_cfop": "5401", "situacao_tributaria": "70", "aliquota": "18", "aliquota_reducao": "33.33",
"aliquota_st": "18", "aliquota_mva": "40" }CST 90: other
When aliquota is 0 or omitted, the operation's own tax is not calculated and ST is not declared either; the ST fields take effect only when aliquota_st is greater than 0.
{ "codigo_cfop": "5949", "situacao_tributaria": "90", "aliquota": "12", "aliquota_reducao": "0" }CST 02, 15, 53, 61: single-phase ICMS on fuels, levied by quantity
The tax is calculated by quantity; ad_rem_icms is the tax amount per unit (in reais). When q_bc_mono is omitted, the product quantity is used. CST 15 additionally requires ad_rem_icms_ret, CST 53 additionally requires p_dif_mono, and CST 61 requires only ad_rem_icms_ret.
{ "codigo_cfop": "5656", "situacao_tributaria": "02", "ad_rem_icms": "1.47", "q_bc_mono": "1000" }ICMS under Simples Nacional (CRT 1, 4) 5 blocks
Only three-digit CSOSN codes are accepted. All fragments below are the content of impostos.icms.
CSOSN 102, 103, 300, 400: no credit allowed to the buyer
The most common case; only the CFOP and the CSOSN are required, and the rate fields have no effect.
{ "codigo_cfop": "5102", "situacao_tributaria": "102" }CSOSN 101: credit allowed to the buyer
The credit rate aliquota_credito must be provided; the platform calculates the credit amount on the product amount.
{ "codigo_cfop": "5101", "situacao_tributaria": "101", "aliquota_credito": "1.25" }CSOSN 201, 202, 203: ICMS-ST collected for subsequent operations
aliquota_st must be provided; aliquota_mva, aliquota_reducao_st and aliquota_fcp_st are optional. CSOSN 201 additionally requires aliquota_credito.
{ "codigo_cfop": "5401", "situacao_tributaria": "201", "aliquota_credito": "1.25",
"aliquota_st": "18", "aliquota_mva": "40" }CSOSN 500: ICMS-ST previously collected
The fields are the same as for CST 60; the amounts previously collected are provided by the caller.
{ "codigo_cfop": "5405", "situacao_tributaria": "500", "v_bc_st_ret": "100.00", "p_st": "18", "v_icms_st_ret": "18.00" }CSOSN 900: other
aliquota, aliquota_reducao and aliquota_credito may be provided; the ST fields take effect only when aliquota_st is greater than 0.
{ "codigo_cfop": "5949", "situacao_tributaria": "900", "aliquota": "12" }PIS and COFINS 6 blocks
Both groups follow the same rules and are filled in impostos.pis and impostos.cofins respectively. The CST must be one of the values below; otherwise the group is not declared and the invoice is rejected.
CST 01, 02: taxed at a rate
"pis": { "situacao_tributaria": "01", "aliquota": "1.65" },
"cofins": { "situacao_tributaria": "01", "aliquota": "7.60" }CST 03: taxed by quantity
valor_unidade is the tax amount per unit (in reais); the tax equals the quantity multiplied by this value.
"pis": { "situacao_tributaria": "03", "valor_unidade": "0.0864" }CST 04 to 09: not taxed
Only the CST is declared; the rate fields have no effect.
"pis": { "situacao_tributaria": "07" }CST 49, 99: other outbound operations
Simples Nacional companies usually use 49. When aliquota is sent, the tax is calculated at that rate; otherwise the tax is 0.
"pis": { "situacao_tributaria": "49" }CST 50 to 56, 60 to 67, 70 to 75, 98: inbound
Used only in inbound and return invoices. For 70 to 75, the tax is always 0.
"pis": { "situacao_tributaria": "50", "aliquota": "1.65" }Deducting ICMS and DIFAL from the PIS/COFINS base
When "desconta_icms_pis_cofins": true is sent at the top level of the product line, the PIS and COFINS tax base becomes the product base minus the line's own ICMS and, in interstate sales to non-taxpayer final consumers, also minus the destination-state DIFAL (vICMSUFDest) of the ICMSUFDest group. FCP is not deducted. The legal basis is Supreme Court Tema 69 and Superior Court of Justice Tema 1372.
IPI 3 blocks
codigo_enquadramento in impostos.ipi is the legal classification code (numeric); 999 is used when IPI does not apply.
Taxed: CST 50, 99 (outbound), 00, 49 (inbound)
When aliquota is sent, the tax is calculated at that rate; when no rate is sent but valor_unidade is, the tax is calculated by quantity. When the unit price already includes IPI, "price_includes_ipi": true is sent at the top level of the request or in the product line; the product line setting takes precedence.
"ipi": { "situacao_tributaria": "50", "codigo_enquadramento": "999", "aliquota": "10" }Not taxed: CST 51 to 55 (outbound), 01 to 05 (inbound)
Only the CST is declared; the rate has no effect. Trading companies not subject to IPI usually use 53.
"ipi": { "situacao_tributaria": "53", "codigo_enquadramento": "999" }Returned IPI in return invoices ipi_devolvido
Declared only in return invoices; it has no effect in other invoices. The returned IPI amount must be calculated by the caller.
"ipi_devolvido": { "percentual_devolvido": 100, "valor_ipi_devolvido": 15.00 }IBS and CBS (2026 tax reform) 6 blocks
impostos.ibs_cbs is optional; it is declared only when situacao_tributaria is provided. classificacao_tributaria is filled according to the official cClassTrib classification table (the first three digits match the CST; xxx in the examples must be replaced with the actual code); the platform declares it as received without validation. The default rates for the 2026 test period are 0.1% for state IBS, 0% for municipal IBS and 0.9% for CBS; when p_ibs_uf and p_cbs are sent as 0, the default rates are also used.
CST 000, 010, 220: fully taxed
"ibs_cbs": { "situacao_tributaria": "000", "classificacao_tributaria": "000001" }CST 011, 200: reduced rate
The rate reduction percentage p_red_aliq must be provided.
"ibs_cbs": { "situacao_tributaria": "200", "classificacao_tributaria": "200xxx", "p_red_aliq": "60" }CST 221, 222, 830: proportional, reduced base or legal deduction
CST 221 requires proporcao (when omitted, the tax is 0); CST 222 requires p_red_bc; CST 830 requires valor_deducao_legal (in reais).
"ibs_cbs": { "situacao_tributaria": "222", "classificacao_tributaria": "222xxx", "p_red_bc": "20" }CST 510, 515: deferral
The deferral percentage p_dif must be provided; CST 515 additionally requires p_red_aliq.
"ibs_cbs": { "situacao_tributaria": "510", "classificacao_tributaria": "510xxx", "p_dif": "100" }CST 620: single-phase taxation of fuels by quantity
The percentage rates aliquota_ibs_mono and aliquota_cbs_mono take precedence; when they are not provided, the per-unit tax amounts valor_unidade_ibs and valor_unidade_cbs are used.
"ibs_cbs": { "situacao_tributaria": "620", "classificacao_tributaria": "620xxx",
"valor_unidade_ibs": "0.05", "valor_unidade_cbs": "0.10" }CST 400, 410, 550, 800, 810, 811, 820: exemption, suspension, credit transfer and similar
Only the CST and the classification code are declared; no tax is calculated.
"ibs_cbs": { "situacao_tributaria": "410", "classificacao_tributaria": "410xxx" }Payment pag_info[] 7 blocks
pag_info[] 7 blocksEach payment requires payment_indicator and payment_method. payment_method is a two-character string (for example "01"); the number 1 is rejected. When pag_info is omitted or sent as an empty array, the invoice is issued as a cash payment, paid in full at sale, for an amount equal to the invoice total. When payment_value is omitted, the invoice total is used; with multiple payments, payment_value must be sent for each payment. The API does not validate the sum of the payments, and an invoice whose payment sum differs from the invoice total is rejected by the tax authority.
Cash, check, bank slip, transfer and vouchers
Applies to 01, 02, 05, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22. Only the payment method, the payment timing and the amount are sent. For these methods, card_info is not written to the invoice.
"pag_info": [
{ "payment_indicator": "0", "payment_method": "15", "payment_value": 56.94 }
]| Field | Type | Description |
|---|---|---|
| payment_ | string | "0" paid in full at sale, "1" paid in installments |
| payment_ | string | Payment method code; see Payment Parameters in the knowledge base |
| payment_ | decimal | Amount of this payment. When omitted, the invoice total is used |
Credit and debit cards: card terminal not integrated with the invoicing system
This is the case for e-commerce and most physical stores. payment_method is "03" (credit card) or "04" (debit card), and integration_type is sent as "2". When card_info is omitted, the platform declares the payment as integrated with brand Visa, which does not reflect the actual transaction; therefore card_info must always be sent.
"pag_info": [
{
"payment_indicator": "0", "payment_method": "03", "payment_value": 56.94,
"card_info": { "integration_type": "2", "brand_code": "02" }
}
]| Field | Type | Description |
|---|---|---|
| card_ | string | "2" not integrated |
| card_ | string | Card brand code; see Payment Parameters in the knowledge base |
Credit and debit cards: card terminal integrated with the invoicing system
Used when the store's point-of-sale system is directly integrated with the card terminal. integration_type is sent as "1", and the acquirer's CNPJ and the authorization code must also be provided.
"pag_info": [
{
"payment_indicator": "0", "payment_method": "04", "payment_value": 56.94,
"card_info": {
"integration_type": "1", "brand_code": "01",
"acquirer_cnpj": "01027058000191", "authorization_code": "123456"
}
}
]| Field | Type | Description |
|---|---|---|
| card_ | string | "1" integrated |
| card_ | string | Card brand code |
| card_ | string | Acquirer's CNPJ; punctuation is allowed and is removed by the platform |
| card_ | string | Transaction authorization code |
Other payment methods (99)
Payment methods with no corresponding entry in the code table. payment_description is required; when it is missing, the API returns an error.
"pag_info": [
{ "payment_indicator": "0", "payment_method": "99", "payment_value": 56.94, "payment_description": "Vale-troca" }
]| Field | Type | Description |
|---|---|---|
| payment_ | string | Description of the payment method |
Multiple payments and change
When an invoice is paid with several methods, pag_info contains several payments, each with payment_value. When the customer overpays and change is due, troco is sent at the top level of the request. The sum of the payments minus troco must equal the invoice total exactly.
"troco": 3.06,
"pag_info": [
{ "payment_indicator": "0", "payment_method": "01", "payment_value": 40.00 },
{ "payment_indicator": "0", "payment_method": "17", "payment_value": 20.00 }
]| Field | Type | Description |
|---|---|---|
| pag_ | decimal | Amount of each payment |
| troco | decimal | Change amount, at the top level of the request. When 0 or omitted, no change is declared |
Installment payment
When the amount is paid in installments after the invoice is issued, payment_indicator is sent as "1", usually together with a bank slip (15).
"pag_info": [
{ "payment_indicator": "1", "payment_method": "15", "payment_value": 100.00 }
]No payment (90) and deferred payment (91)
90 is used for invoices that involve no collection of payment, such as returns, transfers and gifts; 91 is used for deferred payment. For both, the platform sets the amount to 0, and payment_value has no effect. A regular sales invoice that uses 90 is rejected by the tax authority. Return invoices issued through /api/invoice/return use 90 automatically, and pag_info need not be sent.
"pag_info": [
{ "payment_indicator": "0", "payment_method": "90" }
]Transport transportation 4 blocks
transportation 4 blocksWhen transportation is omitted, the invoice is issued as "no freight" (9), and no freight or carrier information is declared. When transportation is provided, transport_mode must also be sent; it accepts only 0, 1, 2, 3, 4 and 9, and any other value is rejected. The table below shows the fields that take effect for each transport mode; fields marked "Not applicable" are not written to the invoice even when sent.
| transport_mode | carrier_info | vehicle_info / trailer_info | packages | transport_tax_retention_info |
|---|---|---|---|---|
| 0 Freight contracted by the issuer | Applicable | Applicable | Applicable | Applicable |
| 1 Freight contracted by the recipient | Applicable | Applicable | Applicable | Not applicable |
| 2 Freight contracted by a third party | Applicable | Applicable | Applicable | Not applicable |
| 3 Sender's own transport | Not applicable | Applicable | Applicable | Not applicable |
| 4 Recipient's own transport | Not applicable | Applicable | Applicable | Not applicable |
| 9 No freight | Not applicable | Not applicable | Not applicable | Not applicable |
vehicle_info and trailer_info must not be provided. The tax authority rejects such invoices (rejection code 868), and the API returns an error before submission. The same restriction applies to intrastate transport in the state of MG. For interstate transport, carrier_info and packages may be provided.Transport by a contracted carrier (0, 1, 2)
The goods are carried by a logistics company. In mode 0 the issuer contracts the carrier and bears the freight cost; in mode 1 the recipient contracts the carrier; in mode 2 a third party contracts the carrier. All sub-objects are optional and are filled according to the information available.
"transportation": {
"transport_mode": "0",
"carrier_info": {
"cnpj": "12345678000195", "ie": "123456789", "name": "Transportadora Demo LTDA",
"endereco": "Rua A, 10", "city": "Curitiba", "uf": "PR"
},
"packages": [
{ "qty": 2, "packaging_type": "CAIXA", "number": "001-002", "net_weight": 1.250, "gross_weight": 1.500 }
]
}| Field | Type | Description |
|---|---|---|
| transport_ | string | "0", "1" or "2" |
| carrier_ | string | Carrier document number; when carrier_info is provided, one of the two is required |
| carrier_ | string | Carrier name; when not provided, no carrier information is written to the invoice |
| carrier_ | string | Carrier state registration (written only with a CNPJ) |
| carrier_ | string | Carrier address, city and state |
| packages[] | array | Packages: qty, packaging_type, mark, number, net_weight, gross_weight, seals[] |
Own-vehicle transport (3, 4)
In mode 3 the sender transports the goods with its own vehicle; in mode 4 the recipient collects the goods itself. In this case carrier_info has no effect. Vehicles and trailers may be declared only for intrastate transport; for interstate transport, only packages is provided.
"transportation": {
"transport_mode": "3",
"vehicle_info": { "plate": "ABC1D23", "uf": "PR", "rntc": "000123456" },
"trailer_info": { "plate": "XYZ9Z99", "uf": "PR" },
"packages": [ { "qty": 10, "packaging_type": "PALLET" } ]
}| Field | Type | Description |
|---|---|---|
| transport_ | string | "3" or "4" |
| vehicle_ | string | License plate, state of the license plate, National Registry of Road Cargo Carriers number (RNTC); intrastate transport only |
| trailer_ | string | Trailer information, same structure as vehicle_info; intrastate transport only |
| packages[] | array | Packages; same fields as above |
ICMS withholding on freight (mode 0 only)
Provided when the issuer withholds the ICMS on the transport service; written to the invoice only when transport_mode is "0". The withheld amount is calculated by the platform as tax_base × tax_rate, and the city code is obtained from cep.
"transportation": {
"transport_mode": "0",
"transport_tax_retention_info": {
"freight_service_amount": 100.00, "tax_base": 100.00, "tax_rate": 12,
"cfop": "5352", "cep": "80010000"
}
}| Field | Type | Description |
|---|---|---|
| freight_ | decimal | Transport service amount |
| tax_ | decimal | Withholding tax base |
| tax_ | decimal | Withholding rate (%) |
| cfop * | string | CFOP of the transport service |
| cep * | string | ZIP code of the place where the transport starts; when not provided, the whole group is not written to the invoice |
Freight amount freight_amount
freight_amount is included in the invoice under every transport mode: the platform apportions it among the product lines in proportion to their quantities and includes it in the invoice total and in the tax base of every tax. It is filled in only when the freight is borne by the buyer and included in the amount of this invoice; otherwise it is sent as 0 or omitted.
Import and export
When transaction_type is "2" (import) or "3" (export), the transaction is declared as a foreign transaction and DIFAL is not calculated. The buyer fields are described in "Foreign buyer (export)". For imports, each product line must provide ii (Import Tax; keys in camelCase) and import_declarations, with the fields given in the field tables above; when ii is not provided, it is declared with all values set to 0.
"ii": { "vBC": 1000.00, "vDespAdu": 50.00, "vII": 140.00, "vIOF": 0.00 }Tax bases on import invoices are calculated as follows. IPI base = item amount + freight + insurance − discount + ii.vII, excluding outras_despesas. ICMS base = (item amount + freight + insurance + outras_despesas − discount + ii.vII + IPI + ii.vIOF) ÷ (1 − ICMS rate − FCP rate); the ICMS itself is therefore part of its own base (Complementary Law 87/96, art. 13), and the IPI is included regardless of ind_final. Import PIS/COFINS, the Siscomex fee, AFRMM and other customs charges are summed from the import declaration and sent in outras_despesas; the import duty is sent only in ii.vII and is not added to outras_despesas. ii.vDespAdu and import_declarations[].vAFRMM are declarative only and do not enter any calculation.
Issuance type issuance_type
issuance_typeOnly "1" (normal) should be sent. When the tax authority's service is unavailable, the platform automatically switches to contingency issuance and fills in the contingency date and time and justification; when the caller sends a contingency type, these are not filled in and the invoice is rejected.
Response fields (data)
| Field | Type | Description |
|---|---|---|
| uuid | string | Internal NF-e identifier. Use it in follow-up calls (/api/invoice/get_detail, /refresh, /cancel). On a rejection, uuid and nfe are informative only: the invoice is not stored and the number is reused on the next issuance |
| status | string | Status: on a new issuance, "Success" (authorized) or "Failed" (rejected/failed). "Processing" and "Contingencia" only appear when deduplication by id returns an existing invoice |
| motivo | string | Tax authority text for the cStat; mapped rejections come in PT / 中文. Today an authorization comes back as "Rejeição 100: Autorizado o uso da NF-e" — decide by success/status, never by the text |
| nfe | int | Issued NF-e number |
| serie | int | NF-e series |
| chave | string | 44-digit access key (empty when the invoice was not authorized) |
| modelo | string | Document model: "nfe" |
| epec | boolean | Issued under EPEC contingency |
| xml | string | URL of the authorized XML. The DANFE (PDF) and other formats come from /api/invoice/get_detail |
Response — rejection / error
success is false and data.motivo holds the reason; chave comes back empty. Field validation errors (before reaching the tax authority) return success: false with the message in message and no data object. Every response also has message ("成功" on success and "失败" when the tax authority rejects). Failures before the tax authority — field validation, XML schema, certificate, tax authority unavailable — come back with success: false, the text in message and no data. Failures also carry an error code in code (see "Error handling"); a rejection by the tax authority has TAX_AUTHORITY_REJECTED. Where deduplication by id applies, if the request reached the tax authority but no definitive answer came back (for example, a timeout), the API returns success: false with a message stating that the result is not yet confirmed; the order is protected against duplicate issuance, and the same request must be resubmitted a few minutes later with the same id to obtain the invoice. The id must not be changed.
{
"success": false,
"message": "失败",
"code": "TAX_AUTHORITY_REJECTED",
"data": {
"uuid": "4663a257-adf1-4561-971f-6aaffbd30ca8",
"status": "Failed",
"motivo": "Rejeição 226: Código da UF do Emitente diverge da UF autorizadora / 拒绝 226: 发件人所在州代码与授权州不一致",
"nfe": 100,
"serie": 1,
"chave": "",
"modelo": "nfe",
"epec": false,
"xml": ""
}
}Complete NF-e Issuance Examples
Complete Example with Transportation
{
"nature_of_operation": "Venda de mercadoria",
"transaction_type": "1",
"model": "55",
"issuance_type": "1",
"ambiente": "2",
"ind_final": "0",
"ind_pres": "1",
"cliente": {
"cnpj": "12345678000195",
"ie": "110030010189",
"name": "Empresa Cliente Ltda",
"endereco": "Rua Exemplo",
"numero": "123",
"complemento": "Sala 45",
"bairro": "Centro",
"city": "São Paulo",
"uf": "SP",
"cep": "01310100",
"telefone": "11999999999",
"email": "contato@empresa.com"
},
"products": [
{
"codigo": "PROD001",
"name": "Smartphone XYZ",
"ncm": "85171300",
"count": 2,
"unit": "UN",
"unit_price": 1500.00,
"total_price": 3000.00,
"category_id": "SEU_CATEGORY_ID",
"origem": 0,
"indicador_total": 1
}
],
"transportation": {
"transport_mode": "0",
"freight_amount": 30.00,
"carrier_info": {
"cnpj": "11222333000181",
"name": "Transportadora Expressa",
"endereco": "Rua da Transportadora",
"city": "São Paulo",
"uf": "SP"
},
"vehicle_info": {
"plate": "ABC1234",
"uf": "SP",
"rntc": "123456"
},
"packages": [
{
"qty": 1,
"packaging_type": "CX",
"gross_weight": 2.500,
"net_weight": 2.000
}
]
},
"shipping_address": {
"cnpj": "12345678000195",
"name": "Remetente Ltda",
"endereco": "Rua do Remetente",
"number": "100",
"bairro": "Centro",
"city": "São Paulo",
"uf": "SP",
"cep": "01001000"
},
"delivery_address": {
"cnpj": "98765432000198",
"name": "Destinatário Ltda",
"endereco": "Rua do Destinatário",
"number": "200",
"bairro": "Centro",
"city": "Rio de Janeiro",
"uf": "RJ",
"cep": "20040020"
},
"pag_info": [
{
"payment_method": "03",
"payment_indicator": "0",
"card_info": {
"integration_type": "1",
"brand_code": "01"
}
}
],
"informacoes_complementares": "Sem informações adicionais",
"informacoes_fisco": "ICMS recolhido conforme legislação"
}Complete Import Example
{
"id": "PED-IMP-001",
"nature_of_operation": "Importação para revenda",
"transaction_type": "2",
"model": "55",
"issuance_type": "1",
"ambiente": "2",
"finalidade": "1",
"ind_final": "0",
"ind_pres": "9",
"cliente": {
"name": "EXPORTADOR EXTERIOR CO LTD",
"endereco": "Pudong District",
"numero": "456",
"city": "Shanghai",
"id_estrangeiro": "CN-EXP-001",
"c_pais": 1600,
"x_pais": "CHINA"
},
"products": [
{
"name": "Fonte chaveada 12V 2A Quickfitting",
"codigo": "123450000888",
"ncm": "85044090",
"count": 2,
"unit": "PC",
"unit_price": 0.25,
"total_price": 0.50,
"origem": 1,
"indicador_total": 1,
"category_id": "SEU_CATEGORY_ID",
"ii": {
"vBC": 0.50,
"vDespAdu": 0.00,
"vII": 0.00,
"vIOF": 0.00
},
"import_declarations": [
{
"nDI": "2312345678",
"dDI": "2026-04-12",
"xLocDesemb": "PORTO DE SANTOS",
"UFDesemb": "SP",
"dDesemb": "2026-04-15",
"tpViaTransp": 1,
"vAFRMM": 1.00,
"tpIntermedio": 1,
"cExportador": "EXP-CN-001",
"additions": [
{
"nAdicao": 1,
"nSeqAdic": 1,
"cFabricante": "FAB-CN-001",
"vDescDI": 0,
"nDraw": ""
}
]
}
]
},
{
"name": "Quick fitting MA",
"codigo": "123450000157",
"ncm": "85044090",
"count": 2,
"unit": "PC",
"unit_price": 0.25,
"total_price": 0.50,
"origem": 1,
"indicador_total": 1,
"category_id": "SEU_CATEGORY_ID",
"ii": {
"vBC": 0.50,
"vDespAdu": 0.00,
"vII": 0.00,
"vIOF": 0.00
},
"import_declarations": [
{
"nDI": "2312345678",
"dDI": "2026-04-12",
"xLocDesemb": "PORTO DE SANTOS",
"UFDesemb": "SP",
"dDesemb": "2026-04-15",
"tpViaTransp": 1,
"vAFRMM": 1.00,
"tpIntermedio": 1,
"cExportador": "EXP-CN-001",
"additions": [
{
"nAdicao": 1,
"nSeqAdic": 2,
"cFabricante": "FAB-CN-001",
"vDescDI": 0,
"nDraw": ""
}
]
}
]
}
],
"pag_info": [
{
"payment_method": "90",
"payment_indicator": "0"
}
]
}transaction_type: "2"— inbound (import) operation.clientewithoutcnpj/cpf/uf/cep; usesid_estrangeiro,c_pais(BACEN table — China = 1600) andx_pais.category_idmust point to a tax category with CFOP 3.xxx and CST/CSOSN compatible with import.- Product
origem=1(foreign — direct import) or6(foreign — direct import, no domestic equivalent, on the CAMEX list). Origin2is for foreign goods bought in the domestic market, not for the import itself. - The
iiblock (Import Tax) is emitted whentransaction_type="2"(it does not depend on the CFOP) and should be sent in that case — the API does not check it. Values come from the DI issued by the customs broker (vBC, vDespAdu, vII, vIOF). May be zero for testing. - The
import_declarationsblock (Import Declaration) contains customs clearance data: nDI, dDI, clearance location/state/date, transport mode, intermediary, exporter and additions. vAFRMMis required whentpViaTransp = 1(Sea).