Look up the State Registration (IE)
CNPJAPI looks up a company's Inscrição Estadual (IE, the Brazilian state tax registration) for a CNPJ straight from the official source (the State Revenue offices' registry, over their web service - not scraping). It is a premium feature: it requires an API key on a plan that includes IE quota.
- Method and path:
GET /consulta/ie/{cnpj} - Base URL:
https://api.cnpjapi.com.br - Path parameter: the 14 digits of the CNPJ only, without punctuation.
- Authentication: API key in the
Authorizationheader (see Authentication). There is no anonymous version; the plan must include IE.
Query parameters
| Parameter | Description |
|---|---|
uf |
Target state (e.g. SP). Omitted = nationwide sweep across the covered states. |
incluir_baixadas |
true also includes cancelled registrations (nao_habilitado). Defaults to false: returns only the active ones (taxpayer or exempt). |
Coverage (16 states): AC, AM, BA, ES, GO, MT, MS, MG, PB, PR, PE, RJ, RN, RS, SC, SP.
On a query with
uf, if the CNPJ is not a taxpayer in that state the item is still returned, withIndicador: 9and an emptyIE(it is the definitive answer for the state you asked about) - do not read "non-taxpayer" as "empty list". On the nationwide sweep, non-taxpayers are omitted: only states with a registration are listed.
Example (curl)
A single state:
curl "https://api.cnpjapi.com.br/consulta/ie/00776574000156?uf=SP" \
-H "Authorization: Bearer cnpj_sua_chave"
Nationwide sweep (no uf):
curl "https://api.cnpjapi.com.br/consulta/ie/00776574000156" \
-H "Authorization: Bearer cnpj_sua_chave"
Response (200 OK, application/json)
{
"CNPJ": "00776574000156",
"Fonte": "sefaz",
"DoCache": false,
"ConsultadoEm": "2026-09-04T12:00:00Z",
"Resultados": [
{
"UF": "SP",
"IE": "111111111111",
"Indicador": 1,
"Situacao": "habilitado",
"Tipo": "sede",
"RazaoSocial": "...",
"NomeFantasia": "...",
"DataBaixa": null,
"ConsultadoEm": "2026-09-04T12:00:00Z"
}
],
"UFsIndisponiveis": [],
"UFsDaBase": []
}
Response fields
| Field | Description |
|---|---|
CNPJ |
The CNPJ you queried (14 digits) |
Fonte |
Data source (sefaz) |
DoCache |
true when served from the 24h cache (does not spend a credit) |
ConsultadoEm |
Timestamp (ISO-8601) of the oldest result in the response |
Resultados |
List of registrations, one per state found |
UFsIndisponiveis |
States that could not be looked up right now (SEFAZ down and no stored data). The result does not include them; empty in the normal case |
UFsDaBase |
States where SEFAZ did not respond and the response carries the last looked-up data (see below). Empty in the normal case |
Each Resultados item:
| Field | Description |
|---|---|
UF |
State of the registration |
IE |
State Registration number (empty when non-taxpayer) |
Indicador |
1 ICMS taxpayer, 2 exempt, 9 non-taxpayer |
Situacao |
habilitado (active) or nao_habilitado (inactive) |
Tipo |
sede (the IE in the head office's state) or outra_uf (a registration in another state) |
RazaoSocial |
Legal name as held in the state registry |
NomeFantasia |
Trade name, when present |
DataBaixa |
Cancellation date when nao_habilitado; null otherwise |
ConsultadoEm |
Timestamp (ISO-8601) when this result was obtained from SEFAZ |
When SEFAZ does not respond
Each state's SEFAZ is always queried first. If it does not respond (down or too slow) and CNPJ API has looked up that CNPJ before, the response carries the last looked-up data instead of an error:
- the state is listed in
UFsDaBase; - each result carries in
ConsultadoEmthe date it was obtained from SEFAZ.
The IE number rarely changes, but its status (active, cancelled) may have changed since that date. If the status matters to you (for example, before issuing an invoice), check UFsDaBase and ConsultadoEm and repeat the lookup later.
Without stored data, a single-state lookup returns 502, and in a sweep the state goes to UFsIndisponiveis.
Credits and quota
- A nationwide sweep (no
uf) costs 3 credits; a single state (?uf=SP) costs 1 credit. - Cached responses (
DoCache: true) do not spend a credit. - A response with the last looked-up data (
UFsDaBase) is charged as a regular lookup. It does not go to the 24h cache: repeating the lookup tries SEFAZ again and is charged again. States inUFsIndisponiveis, with no data at all, do not cause a charge by themselves. - IE has its own monthly quota per plan, separate from the CNPJ lookup quota; some plans also allow top-up credits that never expire. Manage everything in the portal.
Together with the CNPJ data
Need the registration data and the IE in one call? Use GET /{cnpj}?incluir=ie - the CNPJ response gains an InscricoesEstaduais field (same shape as Resultados above), plus InscricoesEstaduaisUFsDaBase and InscricoesEstaduaisUFsIndisponiveis. See Look up a CNPJ. Native format only (the ReceitaWS compatibility ignores the parameter).
Errors
| Status | Meaning |
|---|---|
401 |
Missing or invalid API key |
403 |
Your plan does not include State Registration lookups |
422 |
Invalid CNPJ, or uf outside the coverage |
429 |
Monthly IE quota or rate limit exceeded - honor Retry-After |
502 |
Official source (SEFAZ) temporarily unavailable and no stored data for that state - try again |
503 |
Service temporarily unavailable - try again |
See every code in Errors.
Next steps
- Look up a CNPJ - the registration data, with the
?incluir=ieoption. - Authentication - generate your API key.
- Limits and plans - compare the plans with IE.
- Errors - what each status code means.
- Availability by state - the IE lookup status in each state.
Create your account at https://app.cnpjapi.com.br and subscribe to a plan with IE to get started.