Look up State Registration (IE) via API

CNPJAPI looks up a CNPJ's State Registration (Inscrição Estadual, IE) from the official source - the state tax authorities' (SEFAZ) ICMS taxpayer registry, via web service, not scraping. The lookup requires authentication: your API key needs a plan with an IE quota - every registered plan includes one, the free plan too. This guide shows the call and how to read the response.

Endpoint

  • Method and path: GET /consulta/ie/{cnpj} (the 14 digits only, no punctuation)
  • Base URL: https://api.cnpjapi.com.br
  • uf (optional): a single state (e.g. SP) costs 1 credit; omitting it runs the nationwide sweep across the covered states and costs 3 credits.
  • Authentication: API key in the Authorization: Bearer header (see Authentication).

Coverage (16 states): AC, AM, BA, ES, GO, MT, MS, MG, PB, PR, PE, RJ, RN, RS, SC, SP.

Example (curl)

curl "https://api.cnpjapi.com.br/consulta/ie/00776574000156?uf=SP" \
  -H "Authorization: Bearer cnpj_your_key"

Code example

The Node examples use native fetch (Node 18+) and top-level await - run them as an ES module (.mjs, or "type": "module" in package.json), or wrap the code in an async function.

Python:

import requests

cnpj = "00776574000156"
r = requests.get(
    f"https://api.cnpjapi.com.br/consulta/ie/{cnpj}",
    params={"uf": "SP"},              # omit for the nationwide sweep
    headers={"Authorization": "Bearer cnpj_your_key"},
)
r.raise_for_status()
for ie in r.json()["resultados"]:
    print(ie["uf"], ie["ie"], ie["situacao"])

Node.js:

const cnpj = "00776574000156";
const response = await fetch(
  `https://api.cnpjapi.com.br/consulta/ie/${cnpj}?uf=SP`, // omit ?uf to sweep the country
  { headers: { Authorization: "Bearer cnpj_your_key" } },
);
const { resultados } = await response.json();
for (const ie of resultados) {
  console.log(ie.uf, ie.ie, ie.situacao);
}

Reading the response

Each item in resultados carries uf, ie (the number, empty when non-taxpayer), indicador (1 ICMS taxpayer, 2 exempt, 9 non-taxpayer), situacao (habilitado/nao_habilitado), razao_social and more.

In a per-uf lookup, if the CNPJ is not a taxpayer in that state the item still comes back, with indicador: 9 and an empty ie - it's the definitive answer for the state asked. In the nationwide sweep, non-taxpayers are omitted: only the states with a registration are returned.

The full field list is in Look up State Registration.

Quota, credits and availability

  • IE has its own monthly quota per plan, separate from the CNPJ lookup quota. Top-up credits do not expire.
  • Cache responses (24h) do not spend a credit.
  • Per-state status is on Availability by state.

Alongside the CNPJ data

Need the registration data and the IE in a single call? Use GET /{cnpj}?incluir=ie - the CNPJ response gains an inscricoes_estaduais field. Native format only. See Look up a CNPJ.

Next steps

Create your account at https://app.cnpjapi.com.br and subscribe to a plan with IE to get started.