TF Fiscal

NCM Codes

POST/api/ncm/list

NCM list (paginated)

Returns the official NCM nomenclature page by page. The result can be narrowed to a subtree by code prefix, searched by keyword, or limited to the 8-digit codes that may be used on an invoice. Filters travel in the JSON request body; all of them are optional and combinable, and an empty body ({}) returns the whole nomenclature (over fifteen thousand entries) one page at a time. Entries always come in ascending code order. This endpoint is free of charge.

Required headers

tokenstringstringEither an integrator token or a company token; no subscription is required.
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body

FieldTypeRequiredDescription
pageintNoPage number, starting at 1; defaults to 1. A value below 1 returns an error
page_sizeintNoEntries per page; defaults to 50, from 1 to 200; a value outside this range returns an error
prefixostringNoCode prefix restricting the result to one subtree: 2, 4, 5, 6, 7 or 8 digits. "8517", for instance, returns every code under that heading
termostringNoKeyword matched against the full description; at least 2 characters. The match runs over the whole chain, so when the word appears in a parent title the entire subtree is returned; narrow it with prefixo or somente_folhas
somente_folhasstringNoSend "1" ("true", "sim", "yes", "s" and "y" are also accepted, here and below) to return only 8-digit codes, the sole level accepted on an invoice line
incluir_extintosstringNoSend "1" to include codes already revoked; by default only codes in force are returned
incluir_impostosstringNoSend "0" to omit ipi, cest and consta_lista_st for a smaller response; included by default
incluir_hierarquiastringNoSend "0" to omit hierarquia for a smaller response; included by default

Only 8-digit codes may be written on an invoice line (valido_para_nota is true); levels of 2 to 7 digits are classification steps, useful for browsing and filtering but not valid on a document.

The official nomenclature carries codes, descriptions and validity dates only, never rates. ipi comes from the IPI rate table, and excecoes lists the exception rates under the same code; ipi is null when the code does not have 8 digits or is not in the rate table, and aliquota is null when nao_tributado is true (NT); cest comes from the tax substitution list, and appearing in that list means the goods fall within the scope where tax substitution may apply, while whether it actually applies depends on the agreement between the two states involved.

The descricao of a leaf is often a fragment such as "Outras", unreadable on its own. Prefer descricao_completa, or assemble the text from hierarquia.

The nomenclature is replaced whenever a new official act is published. Cache it by versao and resynchronise when that value changes.

Common errors

MessageCause
Prefixo inválido. Use 2, 4, 5, 6, 7 ou 8 dígitos / ...prefixo has an invalid number of digits after removing punctuation
O termo de busca precisa de pelo menos 2 caracteres / ...termo has only 1 character
Página inválida / 页码无效page is less than 1
page_size deve ficar entre 1 e 200 / ...page_size is out of range
Nomenclatura NCM ainda não carregada. Contate o suporte. / NCM 名录尚未加载,请联系技术支持The platform has not loaded the NCM nomenclature yet
Falha na consulta. Tente novamente mais tarde. / 查询失败,请稍后重试The platform query failed; retry 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/ncm/list" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json