/api/tax/importImport taxes
From the DI or DUIMP data, calculates II, IPI, import PIS, import COFINS, import ICMS and FCP, apportions customs expenses by customs value and returns the groups of the import entry NF-e, the credit × cost split (same format as /api/tax/purchase) and the suggested entry CFOP.
The call only calculates. The importer is the token company; the ICMS rate is its state's internal rate. The engine does not fetch exchange rates: amounts arrive in BRL and the declaration rate is only recorded. Rates by registration date: TEC (tec table), TIPI and import PIS/COFINS exceptions.
Required headers
tokenstring | string | Company token; CNPJ, state and tax regime are read from the company's registration |
signstring | string | MD5 signature: md5(token + "/api/tax/import" + body without line breaks + timestamp) |
timestampstring | string | Unix timestamp in seconds, 5-minute tolerance |
Body
data_*string | string | DI/DUIMP registration date (YYYY-MM-DD).Date-time (ISO 8601) is also accepted |
taxa_*number | number | Rate used in the declaration (recorded in the response) |
uf_*string | string | Clearance state |
regime_string | string | real or presumido (CRT 3); overrides the registration |
despesasobject | object | siscomex, afrmm and outras_aduaneiras, in BRL, apportioned by customs value.Allocation is done in cents by the largest remainder method: it adds up to the total and no item is negative. Negative value: pending item despesa_negativa |
itens[]array | array | |
ncm*string | string | 8-digit NCM |
valor_*number | number | In BRL: goods + international freight + insurance |
finalidade*string | string | revenda, industrializacao, uso_consumo or ativo_imobilizado |
ex_string | string | II tariff exception (ex-tarifário) |
aliquota_number | number | Overrides TEC (agreement or reduction in the DI); the response returns the warning aliquota_ii_erp.Outside 0 to 100: pending item aliquota_ii_invalida |
beneficio_string | string | Code of the registered state benefit; without a rule, pending item beneficio_sem_regra |
insumoboolean | boolean | Use and consumption under lucro real (PIS/COFINS credit) |
detalhadoboolean | boolean | Legal basis and table versions |
* Required field.
Calculation
II = customs value × TECIPI = (customs value + II) × TIPIPIS = customs value × 2.10%andCOFINS = customs value × 9.65%(Law 10,865/2004, art. 8), unless a registered exception applies- ICMS "inside":
base = (CV + II + IPI + PIS + COFINS + Siscomex + AFRMM + other) / (1 − (rate + FCP)) - Registered benefit: deferral (CST 51), effective rate (CST 20) or presumed credit (reported in
credito_presumido_icms) - IBS/CBS: in 2026, informative, at the test-year rates; from 2027, from the
ibs_cbs_aliquotatable (with no rate for the year, pending itemibs_cbs_aliquota_ausente), and PIS/COFINS-import are no longer charged
Credit × cost
IInever | never | cost |
IPIresale or manufacturing (importer treated as manufacturer) | resale or manufacturing (importer treated as manufacturer) | cost |
ImportPIS/COFINSlucro real, purpose with credit right; the additional COFINS never | lucro real, purpose with credit right; the additional COFINS never | cost |
ImportICMSresale or manufacturing; fixed assets through CIAP | resale or manufacturing; fixed assets through CIAP | cost |
Siscomex,AFRMM,othernever | never | cost |
Suggested CFOP: 3101 (manufacturing), 3102 (resale), 3551 (fixed assets), 3556 (use and consumption).
The TEC is loaded by file upload in /admin/tax-tables (Camex spreadsheet as xlsx, CSV or JSON).
Response fields
itens[]array | array | |
nfeobject | object | NF-e groups: II (vBC, vDespAdu, vII, vIOF), IPI, PIS, COFINS and ICMS with CST and base |
rateioobject | object | Item's Siscomex, AFRMM and other expenses |
itens[].object | object | Credit × cost, as in /api/tax/purchase |
totaisobject | object | |
nfeobject | object | NF-e totals: vProd, vII, vIPI, vPIS, vCOFINS, vBC, vICMS, vFCP, vDespAdu |
Common errors
| Message | Cause |
|---|---|
| Empresa não cadastrada para este token / 该token未关联公司 | The token is not linked to a registered company |
| Corpo da requisição inválido: envie um objeto JSON / 请求体无效,请传入 JSON 对象 | The body is not a valid JSON object |
| Falha no cálculo da importação. Tente novamente mais tarde. / 进口税额计算失败,请稍后重试 | Internal calculation failure; the request can be retried later |
Examples
# sign = md5(token + path + body + timestamp) # Template generated from the endpoint path; replace the placeholders curl -X POST "https://api.tffiscal.com/api/tax/import" \ -H "Content-Type: application/json" \ -H "token: $TOKEN" \ -H "timestamp: $TIMESTAMP" \ -H "sign: $SIGN" \ -d @body.json
{
"data_registro": "2026-11-10",
"taxa_cambio": 5.4321,
"uf_desembaraco": "SC",
"despesas": { "siscomex": 154.23, "afrmm": 0, "outras_aduaneiras": 0 },
"itens": [
{ "ncm": "84713012", "valor_aduaneiro": 10000.00, "finalidade": "revenda" }
]
}
{
"success": true,
"data": {
"status": "determinado",
"itens": [{
"nItem": 1, "status": "determinado", "CFOP": "3102", "NCM": "84713012",
"nfe": {
"II": { "vBC": 10000.00, "vDespAdu": 154.23, "vII": 1400.00, "vIOF": 0.00 },
"IPI": { "CST": "00", "vBC": 11400.00, "pIPI": 10.0, "vIPI": 1140.00 },
"PIS": { "CST": "50", "vBC": 10000.00, "pPIS": 2.10, "vPIS": 210.00 },
"COFINS": { "CST": "50", "vBC": 10000.00, "pCOFINS": 9.65, "vCOFINS": 965.00 },
"ICMS": { "orig": "1", "CST": "00", "modBC": 3, "vBC": 16709.92, "pICMS": 17.0, "vICMS": 2840.69 }
},
"rateio": { "siscomex": 154.23, "afrmm": 0.00, "outras_aduaneiras": 0.00 },
"total_recuperavel": 5155.69,
"custo_aquisicao": 11554.23
}],
"totais": { "nfe": { "vProd": 10000.00, "vII": 1400.00, "vIPI": 1140.00, "vICMS": 2840.69, "vDespAdu": 154.23 } }
}
}