1. Regras fiscais
  2. Criar regra fiscal
POST
/tax-rules
curl --request POST \
     --url https://api.treeunfe.com.br/api/v1/tax-rules \
     --header 'x-api-key: <api-key>' \
     --header 'x-api-key: <x_api_key>' \
     --header 'Content-Type: application/json' \
     --data '{
  "tpNF": 123.45,
  "finNFe": 123.45,
  "natOp": "<string>",
  "states": "<value>",
  "ncmList": "<value>",
  "CFOPIntra": 123.45,
  "CFOPInter": 123.45,
  "CFOPIntraNC": 123.45,
  "CFOPInterNC": 123.45,
  "CST": "<string>",
  "CSTNC": "<string>",
  "PICMS": 123.45,
  "UseAliqICMS": true,
  "PICMSST": 123.45,
  "PMVAST": 123.45,
  "IndFCP": true,
  "IndIPIBCICMS": true,
  "IndOutroBCICMS": true,
  "CSTIPI": "<string>",
  "CEnq": "<string>",
  "PIPI": 123.45,
  "CSTPIS": "<string>",
  "PPIS": 123.45,
  "CSTCOFINS": "<string>",
  "PCOFINS": 123.45,
  "isExcluirICMSFromPisCofinsBC": true,
  "PCredSN": 123.45,
  "IBSCBSCst": "<string>",
  "IBSCBSCClassTrib": "<string>",
  "PIBSUF": 123.45,
  "PIBSMun": 123.45,
  "PCBS": 123.45,
  "AdRemICMS": 123.45,
  "PRedAdRem": 123.45,
  "MotRedAdRem": 123.45,
  "VAliqProdCIDE": 123.45,
  "IndEmailAuto": true
}'

Cria uma regra fiscal da empresa. Ela define CFOP, CST e alíquotas que a emissão com cálculo vai usar para os NCMs e UFs informados. A regra da empresa tem prioridade sobre a regra padrão.

​
Autenticação

x-api-key
required
string

API Key da empresa.

​
Body

application/json

tpNF
required
number

Tipo da operação: 0 = entrada, 1 = saída.

finNFe
required
number

Finalidade: 1 = normal, 2 = complementar, 3 = ajuste, 4 = devolução.

natOp
required
string

Natureza da operação, por exemplo Venda.

states
string[]

UFs às quais a regra se aplica.

ncmList
string[]

NCMs cobertos pela regra (8 dígitos).

CFOPIntra
number

CFOP para operação dentro do estado, com destinatário contribuinte.

CFOPInter
number

CFOP para operação interestadual, com destinatário contribuinte.

CFOPIntraNC
number

CFOP para operação dentro do estado, com destinatário não contribuinte.

CFOPInterNC
number

CFOP para operação interestadual, com destinatário não contribuinte.

CST
string

CST (ou CSOSN) do ICMS para destinatário contribuinte.

CSTNC
string

CST (ou CSOSN) do ICMS para destinatário não contribuinte.

PICMS
number

Alíquota do ICMS (%).

UseAliqICMS
boolean

true para usar a alíquota de ICMS informada na regra.

PICMSST
number

Alíquota do ICMS-ST (%).

PMVAST
number

Margem de valor agregado da ST (%).

IndFCP
boolean

true para calcular o FCP.

IndIPIBCICMS
boolean

true para incluir o IPI na base do ICMS.

IndOutroBCICMS
boolean

true para incluir outras despesas na base do ICMS.

CSTIPI
string

CST do IPI.

CEnq
string

Código de enquadramento do IPI. Ex.: 999.

PIPI
number

Alíquota do IPI (%).

CSTPIS
string

CST do PIS.

PPIS
number

Alíquota do PIS (%).

CSTCOFINS
string

CST da COFINS.

PCOFINS
number

Alíquota da COFINS (%).

isExcluirICMSFromPisCofinsBC
boolean

true para excluir o ICMS da base de PIS e COFINS.

PCredSN
number

Alíquota de crédito do Simples Nacional (%).

IBSCBSCst
string

CST do IBS/CBS.

IBSCBSCClassTrib
string

Classificação tributária (cClassTrib) do IBS/CBS.

PIBSUF
number

Alíquota do IBS estadual (%).

PIBSMun
number

Alíquota do IBS municipal (%).

PCBS
number

Alíquota da CBS (%).

AdRemICMS
number

Alíquota ad rem do ICMS monofásico (combustíveis).

PRedAdRem
number

Percentual de redução da alíquota ad rem.

MotRedAdRem
number

Motivo da redução da alíquota ad rem.

VAliqProdCIDE
number

Alíquota da CIDE por unidade.

IndEmailAuto
boolean

true para enviar a nota por e-mail automaticamente.

​
Respostas

StatusDescrição
201Regra criada.
400Body inválido.
401x-api-key ausente ou inválida.
curl -X POST "https://api.treeunfe.com.br/api/v1/tax-rules" \
  -H "x-api-key: SUA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tpNF": 1,
    "finNFe": 1,
    "natOp": "Venda",
    "states": [
      "PR"
    ],
    "ncmList": [
      "85176241"
    ],
    "CFOPIntra": 5102,
    "CFOPInter": 6102,
    "CFOPIntraNC": 5102,
    "CFOPInterNC": 6102,
    "CST": "00",
    "CSTNC": "00",
    "CSTIPI": "53",
    "CEnq": "999",
    "CSTPIS": "07",
    "CSTCOFINS": "07",
    "IndFCP": true,
    "IndIPIBCICMS": false,
    "IndOutroBCICMS": true,
    "isExcluirICMSFromPisCofinsBC": false,
    "IndEmailAuto": false
  }'