POST
/api/category/createCreate tax category
Creates a new tax category (tax template) bound to the authenticated company. Each category aggregates scenarios of ICMS, IPI, PIS, COFINS, and optionally IBS/CBS and IS. To edit an existing one, use /api/category/edit.
Required headers
tokenstring | string | Company token |
signstring | string | MD5 signature |
timestampstring | string | Unix timestamp in seconds |
Body — top-level
descricao*string | string | Category description (the key is required; an empty value is accepted and saved) |
category_string | string | Custom ID. When omitted, auto-generated as "TF" + incremental number (e.g., "TF123"). Warning: if the given ID already exists in the company, the category is overwritten without notice |
disable_boolean | boolean | Zeroes the DIFAL for this category: the ICMSUFDest group is still issued, but with the internal rate equal to the interstate rate (difference 0).No effect for Simples Nacional issuers (CRT 1/4), which do not issue the group anyway. Default: false |
desconta_boolean | boolean | When 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. Default false: the base does not deduct ICMS |
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 |
icms[]*array | array | ICMS scenarios (structure below) |
tipo_*string | string | Tax regime of the company, using the same value as the company's invoice_type (e.g., "lucro_normal", "simples_nacional").Required in every ICMS scenario and must match the company. The scenario's situacao_tributaria must be consistent with this regime: CSOSN under Simples Nacional, CST under Lucro Normal |
cenario*string | string | Scenario, in lowercase: "saida_dentro_estado", "saida_fora_estado", "entrada_dentro_estado" or "entrada_fora_estado".For ICMS the value "padrao" is not accepted at issuance (the invoice fails with "ICMS não resolvido") — see "How the category is applied at issuance" below |
tipo_*string | string | "fisica" or "juridica" |
codigo_*string | string | CFOP |
situacao_*string | string | ICMS CST (regular regime): 00, 02, 10, 15, 20, 30, 40, 41, 50, 51, 53, 60, 61, 70, 90 — or CSOSN (Simples, CRT 1/4): 101, 102, 103, 201, 202, 203, 300, 400, 500, 900.CRT 2 (Simples above the sub-limit) also uses the 2-digit CST. At issuance, a CST/CSOSN that does not match the company's CRT is refused before reaching the tax authority (Rejection 590/591) |
nao_boolean | boolean | Legacy — stored, but not used when issuing NF-e (the taxpayer indicator comes from the recipient) |
aliquota_string | string | Legacy — stored, but not used at issuance |
aliquota_decimal | decimal | Credit rate (% for Simples Nacional) |
aliquota_decimal | decimal | Deferral percentage (CST 51) |
aliquota_string | string | Legacy — stored, but not used at issuance. The legacy name aliquota_diferimentoFcp is also accepted |
aliquota_decimal | decimal | ICMS base reduction percentage |
aliquota_decimal | decimal | ICMS-ST base reduction percentage (CST 10, 30, 70, 90 / CSOSN 201, 202, 203, 900). The legacy name aliquota_reducaoSt is also accepted; when both are sent, aliquota_reducao_st prevails |
motivo_string | string | ICMS exemption reason code — used by CST 20 only when aliquota_reducao > 0, and by CST 40, 41, 50 and 90 only when valor_desoneracao > 0 (the text "outros" becomes "9") |
motivo_string | string | Legacy — stored, but not used at issuance. The legacy name motivo_desoneracaoSt is also accepted |
ad_decimal | decimal | Single-phase ICMS — ad rem rate in BRL/unit (CST 02, 15, 53) |
ad_decimal | decimal | Single-phase ICMS — withheld ad rem in BRL/unit (CST 15, 61) |
p_decimal | decimal | Single-phase ICMS — deferral percentage (CST 53) |
q_decimal | decimal | Single-phase ICMS — taxed quantity (liters/kg); 0 uses the item quantity (CST 02, 15, 53, 61) |
valor_decimal | decimal | Exempted ICMS amount in BRL — emits vICMSDeson (CST 40, 41, 50, 90) |
v_decimal | decimal | Calculation base of the ICMS-ST withheld in the previous operation (provided, not calculated — CST 60, CSOSN 500) |
p_decimal | decimal | Rate borne by the final consumer, in % (provided, not calculated — CST 60, CSOSN 500) |
v_decimal | decimal | ICMS-ST amount withheld in the previous operation (provided, not calculated — CST 60, CSOSN 500) |
v_decimal | decimal | Substitute's own ICMS amount (provided, not calculated — CST 60, CSOSN 500) |
v_decimal | decimal | Calculation base of the FCP withheld by ST (provided, not calculated — CST 60, CSOSN 500) |
p_decimal | decimal | FCP rate withheld by ST, in % (provided, not calculated — CST 60, CSOSN 500) |
v_decimal | decimal | FCP amount withheld by ST (provided, not calculated — CST 60, CSOSN 500) |
| Per-state rates within each icms[] item — optional | ||
aliquota_array | array | MVA per UF of the recipient — items: { estado, aliquota } |
aliquota_array | array | Own ICMS rate per issuer UF — items: { estado, aliquota }.The value found also applies to interstate sales. With no row (or rate 0), only CST 00 and 10 obtain the rate on their own (the state's internal rate for intrastate, the 4/7/12% table for interstate); for CST 20, 51, 70, 90 and CSOSN 900 ICMS goes out at rate 0. So in the saida_fora_estado row, put the interstate rate here — omitting the array only works for CST 00/10 |
aliquota_array | array | ICMS-ST rate per UF of the recipient — items: { estado, aliquota } |
aliquota_array | array | FCP rate per UF of the recipient — items: { estado, aliquota } |
aliquota_array | array | FCP-ST rate per UF of the recipient — items: { estado, aliquota } |
beneficio_array | array | Tax benefit code (cBenef) per UF of the recipient — items: { estado, codigo } |
ipi[]*array | array | IPI scenarios (structure below) |
cenario*string | string | Scenario (the same as ICMS, or "padrao", used when there is no row for the exact scenario) |
tipo_*string | string | "fisica" or "juridica" |
situacao_*string | string | IPI CST |
codigo_*string | string | Legal framework code — 3 numeric digits (e.g., "999"); a non-numeric value causes an error at issuance |
aliquota*string | string | IPI rate |
valor_string | string | IPI by quantity — value in BRL/unit; only used when there is no percentage rate (CST 00, 50, 49, 99) |
pis[]*array | array | PIS scenarios (structure below) |
cofins[]*array | array | COFINS scenarios (structure below) |
ibs_array | array | IBS/CBS scenarios — tax reform (structure below) |
cenario*string | string | Scenario (the same as ICMS, or "padrao") |
tipo_*string | string | "fisica" or "juridica" |
situacao_*string | string | IBS/CBS CST (3 digits). Supported: 000, 010, 011, 200, 220, 221, 222, 400, 410, 510, 515, 550, 620, 800, 810, 811, 820, 830. Registration does not validate the list: any other CST produces an empty IBSCBS group and the invoice is rejected |
classificacao_*string | string | cClassTrib — 6 digits, starting with the CST (e.g., CST 000 → "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).The defaults are fixed: they do not change on their own when 2027 begins |
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) |
is[]array | array | IS scenarios — Selective Tax (structure below). Currently only stored: not issued in the XML (IS starts in 2027) |
cenario*string | string | Scenario (the same as ICMS, or "padrao") |
tipo_*string | string | "fisica" or "juridica" |
situacao_*string | string | IS CST |
aliquota*string | string | IS rate |
Body — pis[] and cofins[] (same structure)
cenario*string | string | Scenario (the same as ICMS, or "padrao") |
tipo_*string | string | "fisica" or "juridica" |
situacao_*string | string | PIS/COFINS CST |
aliquota*string | string | Rate |
valor_string | string | PIS/COFINS by quantity — value in BRL/unit; v = quantity × value (CST 03 and other per-quantity forms) |
* Required field.
How the category is applied at issuance
- For each item, issuance looks for the row whose
tipo_pessoamatches the recipient and whosecenariomatches the operation:saida_dentro_estado/saida_fora_estado(outbound invoice) orentrada_dentro_estado/entrada_fora_estado(inbound invoice and/api/invoice/return). The comparison is exact (lowercase). - ICMS: requires the row for the exact scenario — there is no fallback to
"padrao". Register at leastsaida_dentro_estadoandsaida_fora_estadofor eachtipo_pessoayou serve. - IPI, PIS, COFINS, IBS/CBS and IS: without the exact row, they use the
"padrao"row of the sametipo_pessoa. - Incoming invoice with no
entrada_*row: ICMS uses the matchingsaida_*row; IPI, PIS, COFINS, IBS/CBS and IS try"padrao"first and only thensaida_*(compatibility with older categories). - Export (
transaction_type="3"): the normal rule applies first (tipo_pessoa+ scenario; IPI, PIS, COFINS, IBS/CBS and IS also try"padrao"). Only if nothing matches does ICMS use the first row of the same scenario for anytipo_pessoa(or, if none, the first row), and the other taxes use the first row of the list. - Import (
transaction_type="2"): ignorescenarioandtipo_pessoa— ICMS uses the first row whose CFOP starts with 3 (or, if none, the first row) and the other taxes use the first row. - In
/api/invoice/returnthe CFOP is required in the request (fieldcfop) and replaces the category'scodigo_cfop. - With no applicable
ibs_cbsrow, the invoice is issued without the IBS/CBS group (the 0.10/0/0.90 defaults only apply when the row exists).
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/create" \ -H "Content-Type: application/json" \ -H "token: $TOKEN" \ -H "timestamp: $TIMESTAMP" \ -H "sign: $SIGN" \ -d @body.json
{
"descricao": "Venda de mercadoria padrão",
"icms": [{
"tipo_tributacao": "lucro_normal",
"cenario": "saida_dentro_estado",
"tipo_pessoa": "juridica",
"codigo_cfop": "5102",
"situacao_tributaria": "00",
"aliquota_icms": [{ "estado": "SP", "aliquota": 18 }]
}, {
"tipo_tributacao": "lucro_normal",
"cenario": "saida_fora_estado",
"tipo_pessoa": "juridica",
"codigo_cfop": "6102",
"situacao_tributaria": "00"
}],
"ipi": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "99",
"codigo_enquadramento": "999",
"aliquota": "0"
}],
"pis": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "01",
"aliquota": "0.65"
}],
"cofins": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "01",
"aliquota": "3"
}],
"ibs_cbs": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "000",
"classificacao_tributaria": "000001",
"p_ibs_uf": "0.1",
"p_ibs_mun": "0",
"p_cbs": "0.9"
}]
}
{
"descricao": "Venda com substituição tributária",
"category_id": "TF2001",
"disable_difal": false,
"desconta_icms_pis_cofins": true,
"desconta_icms_pis_cofins_ibs_cbs": false,
"icms": [{
"tipo_tributacao": "lucro_normal",
"cenario": "saida_dentro_estado",
"tipo_pessoa": "juridica",
"codigo_cfop": "5401",
"situacao_tributaria": "10",
"nao_contribuinte": false,
"aliquota_importacao": "",
"aliquota_credito": 0,
"aliquota_diferimento": 0,
"aliquota_diferimentoFcp": "",
"aliquota_reducao": 0,
"aliquota_reducaoSt": 0,
"motivo_desoneracao": "",
"motivo_desoneracaoSt": "",
"ad_rem_icms": 0,
"ad_rem_icms_ret": 0,
"p_dif_mono": 0,
"q_bc_mono": 0,
"valor_desoneracao": 0,
"v_bc_st_ret": 0,
"p_st": 0,
"v_icms_st_ret": 0,
"v_icms_substituto": 0,
"v_bc_fcp_st_ret": 0,
"p_fcp_st_ret": 0,
"v_fcp_st_ret": 0,
"aliquota_mva": [
{ "estado": "SP", "aliquota": 40.00 },
{ "estado": "RJ", "aliquota": 45.00 }
],
"aliquota_icms": [
{ "estado": "SP", "aliquota": 18.00 },
{ "estado": "RJ", "aliquota": 20.00 }
],
"aliquota_icms_st": [
{ "estado": "SP", "aliquota": 18.00 },
{ "estado": "RJ", "aliquota": 20.00 }
],
"aliquota_fcp": [
{ "estado": "RJ", "aliquota": 2.00 }
],
"aliquota_fcp_st": [
{ "estado": "RJ", "aliquota": 2.00 }
],
"beneficio_fiscal": [
{ "estado": "SP", "codigo": "SP800001" }
]
}],
"ipi": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "50",
"codigo_enquadramento": "999",
"aliquota": "5",
"valor_unidade": ""
}],
"pis": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "01",
"aliquota": "0.65",
"valor_unidade": ""
}],
"cofins": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "01",
"aliquota": "3",
"valor_unidade": ""
}],
"ibs_cbs": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "000",
"classificacao_tributaria": "000001",
"p_ibs_uf": "0.1",
"p_ibs_mun": "0",
"p_cbs": "0.9",
"p_red_aliq": "",
"p_dif": "",
"p_red_bc": "",
"proporcao": "",
"aliquota_cbs_mono": "",
"aliquota_ibs_mono": "",
"valor_unidade_cbs": "",
"valor_unidade_ibs": "",
"valor_deducao_legal": ""
}],
"is": [{
"cenario": "padrao",
"tipo_pessoa": "juridica",
"situacao_tributaria": "000",
"aliquota": "0"
}]
}
{
"success": true,
"data": {
"category_id": "TF123"
}
}