TF Fiscal

NF-e Tax Codes

POST/api/category/edit

Edit tax category

Edits an existing tax category. The body is identical to /api/category/create, the only difference being that category_id is required and must match an existing category. The upsert fully replaces the icms, ipi, pis, cofins, ibs_cbs, is arrays — send all updated scenarios (there is no per-scenario merge; omitting ibs_cbs deletes the IBS/CBS scenarios).

Reusing the get_detail JSON: it can be sent back unchanged. All fields returned by get_detail (including aliquota_reducao_st, motivo_desoneracao_st, aliquota_diferimento, aliquota_diferimento_fcp and is) are accepted, and no data is lost.

Required headers

tokenstringstringCompany token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body

The full body structure is documented in /api/category/create. Only category_id is handled differently here:

category_id*stringstringID of the category to edit (must exist; otherwise returns an error).
descricao*stringstringDescription (the key is required; an empty value is accepted and saved)
icms[]*arrayarrayICMS scenarios (fully replaces)
ipi[]*arrayarrayIPI scenarios
pis[]*arrayarrayPIS scenarios
cofins[]*arrayarrayCOFINS scenarios
ibs_cbs[]arrayarrayIBS/CBS scenarios (optional)
is[]arrayarrayIS scenarios (optional) — omitting it erases the IS scenarios
disable_difalbooleanbooleanZeroes the DIFAL (see /api/category/create).
desconta_icms_pis_cofinsbooleanbooleanWhen true, the line's ICMS is deducted from the PIS/COFINS base and, in interstate sales to non-taxpayer final consumers, so is the destination-state DIFAL; the base becomes (base − ICMS − DIFAL), with a minimum of 0; applies only to percentage-based PIS/COFINS.
desconta_icms_pis_cofins_ibs_cbsbooleanbooleanComputes 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.

 * Required field. For the inner fields of each array (icms[].codigo_cfop etc.), see /api/category/create.

Examples

# sign = md5(token + path + body + timestamp)
# Template generated from the endpoint path; replace the placeholders
curl -X POST "https://api.tffiscal.com/api/category/edit" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json