TF Fiscal

Tax Calculation

POST/api/tax/import

Import 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

tokenstringstringCompany token; CNPJ, state and tax regime are read from the company's registration
signstringstringMD5 signature: md5(token + "/api/tax/import" + body without line breaks + timestamp)
timestampstringstringUnix timestamp in seconds, 5-minute tolerance

Body

data_registro*stringstringDI/DUIMP registration date (YYYY-MM-DD).
taxa_cambio*numbernumberRate used in the declaration (recorded in the response)
uf_desembaraco*stringstringClearance state
regime_federalstringstringreal or presumido (CRT 3); overrides the registration
despesasobjectobjectsiscomex, afrmm and outras_aduaneiras, in BRL, apportioned by customs value.
itens[]arrayarray
detalhadobooleanbooleanLegal basis and table versions

 * Required field.

Calculation

  1. II = customs value × TEC
  2. IPI = (customs value + II) × TIPI
  3. PIS = customs value × 2.10% and COFINS = customs value × 9.65% (Law 10,865/2004, art. 8), unless a registered exception applies
  4. ICMS "inside": base = (CV + II + IPI + PIS + COFINS + Siscomex + AFRMM + other) / (1 − (rate + FCP))
  5. Registered benefit: deferral (CST 51), effective rate (CST 20) or presumed credit (reported in credito_presumido_icms)
  6. IBS/CBS: in 2026, informative, at the test-year rates; from 2027, from the ibs_cbs_aliquota table (with no rate for the year, pending item ibs_cbs_aliquota_ausente), and PIS/COFINS-import are no longer charged

Credit × cost

IInevernevercost
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 neverlucro real, purpose with credit right; the additional COFINS nevercost
ImportICMSresale or manufacturing; fixed assets through CIAPresale or manufacturing; fixed assets through CIAPcost
Siscomex,AFRMM,othernevernevercost

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[]arrayarray
itens[].tributos/custo_aquisicaoobjectobjectCredit × cost, as in /api/tax/purchase
totaisobjectobject

Common errors

MessageCause
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