# State registration lookup in the API

> Look up a CNPJ's or CPF's state registrations in the CCC via the API, in any state, with status and authorized tax documents, before issuing an NF-e.

> **Tip:** Concepts on this page: [State registration and CCC](https://cnpja.com/en-us/docs/data/state-registrations), [Summary and detailed](https://cnpja.com/en-us/docs/data/state-registrations#detail-levels), [Data freshness](https://cnpja.com/en-us/docs/data/freshness) and [Certificates](https://cnpja.com/en-us/docs/data/certificates).

The API returns the state registrations of a CNPJ or a CPF from the [CCC](https://cnpja.com/en-us/docs/glossary#ccc), with number, state, type, status, restrictions and, at the detailed level, activity, address and authorized tax documents. For a CNPJ, they are an optional resource of [Lookup CNPJ](https://cnpja.com/en-us/docs/api/reference#tag/establishments/GET/v2/establishments/%7btaxId%7d), requested in `expand`; for a CPF, they are the main content of [Lookup CPF](https://cnpja.com/en-us/docs/api/reference#tag/individuals/GET/v2/individuals/%7btaxId%7d). Both require an [API key](https://cnpja.com/en-us/docs/api/first-request).

## Request

State registrations appear in two operations, always requested in `expand`:

| Operation | Response content | `expand` | States queried |
|---|---|---|---|
| [Lookup CNPJ](https://cnpja.com/en-us/docs/api/reference#tag/establishments/GET/v2/establishments/%7btaxId%7d) | The CNPJ record, as in [CNPJ lookup](https://cnpja.com/en-us/docs/api/cnpj-lookup), plus the `stateRegistry` field | Optional: include `stateRegistry` | Default `ORIGIN`, the establishment's state |
| [Lookup CPF](https://cnpja.com/en-us/docs/api/reference#tag/individuals/GET/v2/individuals/%7btaxId%7d) | `taxId`, `legalName`, `updatedAt` and the requested resources | Required: `stateRegistry`, `suframa` or both | The states or `ALL` must be sent |

In both operations, registrations come from live queries or from cached data, depending on their age, and the parameters are the same:

| Parameter | Values | Effect |
|---|---|---|
| `expand` | `stateRegistry`, alone or with other resources, as in `stateRegistry,suframa` | Includes `stateRegistry` in the response |
| `stateRegistry.states` | `ORIGIN`, state abbreviations or `ALL`. Defaults to `ORIGIN` for a CNPJ; required for a CPF | States whose registrations go into `registrations` |
| `stateRegistry.view` | `SUMMARY` (default) or `DETAILED` | Level of detail of each registration, described in [Response fields](#response-fields) |
| `maxAge` | A duration, such as `1d` or `30d`. Defaults to `45d` | Maximum age accepted for all data in the request |
| `stateRegistry.maxAge` | A duration, such as `1d` or `30d` | [Max age](https://cnpja.com/en-us/docs/glossary#idade-máxima--maximum-data-age) accepted for the registrations only, in place of `maxAge` |

`stateRegistry.states` accepts these values, which add up:

- **`ORIGIN`:** the state of the establishment's address. Accepted only in Lookup CNPJ.
- **State abbreviation:** such as `SP` or `MG`. `ORIGIN,MG` requests the establishment's state and also MG.
- **`ALL`:** all 27 states, counting the Federal District.

Send several values separated by commas or by repeating the parameter. `registrations` holds only the registrations in the requested states.

`stateRegistry.states`, `stateRegistry.view` and `stateRegistry.maxAge` are accepted only with `stateRegistry` in `expand`. Without it, the request is rejected with `400` `REQUEST_VALIDATION_FAILED`, and `errors` holds an item with the code `DEPENDENCIES`, as shown in [Limits and errors](https://cnpja.com/en-us/docs/api/limits-and-errors). Keyless requests do not accept `expand`, so registrations are not available through [Public access](https://cnpja.com/en-us/docs/api/public-access).

### Lookup CNPJ

In Lookup CNPJ, request `expand=stateRegistry`. Without other parameters, the response holds the registrations in the establishment's state, at the `SUMMARY` level:

```http
GET /v2/establishments/37335118000180?expand=stateRegistry HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
```

To also request another state and the detailed level, combine the parameters:

```http
GET /v2/establishments/37335118000180?expand=stateRegistry&stateRegistry.states=ORIGIN,MG&stateRegistry.view=DETAILED HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
```

The response holds the CNPJ record, as in [CNPJ lookup](https://cnpja.com/en-us/docs/api/cnpj-lookup), and the `stateRegistry` field. `stateRegistry` can be requested together with other resources, as in `expand=company.taxRegime,stateRegistry`.

### Lookup CPF

Lookup CPF returns the registrations of an [individual](https://cnpja.com/en-us/docs/glossary#indivíduo--individual), a natural person with a state or SUFRAMA registration, such as a rural producer (`RURAL_PRODUCER`). It is not a CPF lookup at the Receita Federal, and the [masked CPF](https://cnpja.com/en-us/docs/glossary#cpf-mascarado--masked-cpf) of partners cannot be used in this operation, as explained in [Individuals with a registration](https://cnpja.com/en-us/docs/data/state-registrations#individuals).

Request rules:

- With `stateRegistry` in `expand`, `stateRegistry.states` is also required and does not accept `ORIGIN`, since there is no origin address: send the states or `ALL`.
- `stateRegistry.view` has the same levels as for a CNPJ, and `maxAge` and `stateRegistry.maxAge` work the same way.

```http
GET /v2/individuals/CPF_NUMBER?expand=stateRegistry&stateRegistry.states=SP,MG HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
```

The response has `taxId`, `legalName`, `updatedAt` and `stateRegistry`, with the same fields as for a CNPJ. `legalName` comes from the CCC or SUFRAMA, whichever was updated most recently.

> **Important:** `404` `INDIVIDUAL_NOT_FOUND` means no registration was found for the CPF. The CCC is queried only in the states in `stateRegistry.states`, so request every relevant state before concluding that the CPF has no state registration. On a CPF's first lookup there is no cached data to fall back on, and a CCC failure also results in a `404`: on an unexpected `404`, retry the request later.

## Response fields

Lookup CNPJ response with `expand=stateRegistry`, trimmed to the registrations:

```json
{
  "taxId": "37335118000180",
  "stateRegistry": {
    "updatedAt": "2026-01-27T03:00:00.000Z",
    "registrations": [
      {
        "updatedAt": "2026-01-27T03:00:00.000Z",
        "number": "936389130",
        "state": "SP",
        "type": { "code": "STATE_TAXPAYER", "label": "Contribuinte" },
        "statusDate": "2020-06-05",
        "isEnabled": true,
        "hasRestriction": false
      }
    ],
    "taxRestrictions": []
  }
}
```

`stateRegistry` has three fields:

| Field | Content |
|---|---|
| `updatedAt` | Last live query of the registrations at the CCC, in any state, not only the requested ones |
| `registrations` | List of registrations in the requested states, empty when there are none |
| `taxRestrictions` | List of restrictions on interstate tax documents |

The level of detail defines the fields of each registration:

| Level | Fields of each registration |
|---|---|
| `SUMMARY` (default) | Number, state, type and status: `updatedAt`, `number`, `state`, `type`, `statusDate`, `isEnabled`, `hasRestriction` |
| `DETAILED` | The same, plus activity, address, sublimit and authorized tax documents: `activityStartDate`, `activityEndDate`, `primaryActivity`, `address`, `hasExceededSublimit`, `authorizedTaxDocuments` |

The level also changes how updates and billing work, as described in [Sources and updates](#sources-and-updates) and [Billing](#billing). Prefer `SUMMARY` when it is enough to know whether the registration exists and is enabled.

A registration at the `DETAILED` level, trimmed:

```json
{
  "updatedAt": "2026-01-27T03:00:00.000Z",
  "number": "936389130",
  "state": "SP",
  "type": { "code": "STATE_TAXPAYER", "label": "Contribuinte" },
  "statusDate": "2020-06-05",
  "isEnabled": true,
  "hasRestriction": false,
  "activityStartDate": "2020-06-05",
  "activityEndDate": null,
  "hasExceededSublimit": false,
  "primaryActivity": {
    "code": "6311900",
    "label": "Tratamento de dados, provedores de serviços de aplicação e serviços de hospedagem na internet"
  },
  "address": {
    "street": "Avenida Brigadeiro Faria Lima",
    "number": "2369",
    "city": "São Paulo",
    "state": "SP",
    "postalCode": "01452922"
  },
  "authorizedTaxDocuments": [{ "code": "NFE", "label": "NF-e" }]
}
```

Each item in `registrations` has:

| Field | Content |
|---|---|
| `updatedAt` | Last update of the registration from the CCC, which can be earlier than `stateRegistry.updatedAt` |
| `number` | State registration number, 8 to 14 characters depending on the state |
| `state` | State of the registration |
| `type` | Registration type, with `code` and `label`, described in [Codes and values](#codes-and-values) |
| `statusDate` | Date of the registration's current status |
| `isEnabled` | `true` when the registration is enabled as a taxpayer in the state, and `false` otherwise |
| `hasRestriction` | `true` when the CNPJ or CPF has a restriction as a recipient in the registration's state |
| `activityStartDate` | Date the taxpayer started its activity in the state (`DETAILED`) |
| `activityEndDate` | Date the activity ended, or `null` (`DETAILED`) |
| `primaryActivity` | Primary economic activity registered in the state, with the [CNAE](https://cnpja.com/en-us/docs/glossary#cnae) code and description (`DETAILED`) |
| `address` | Address registered for the registration, in the same format as the CNPJ address, without `coordinates` (`DETAILED`) |
| `hasExceededSublimit` | `true` for a [Simples Nacional](https://cnpja.com/en-us/docs/glossary#simples-nacional) optant whose gross revenue exceeded the state sublimit, in which case ICMS is no longer paid through Simples Nacional (`DETAILED`) |
| `authorizedTaxDocuments` | Electronic [tax documents](https://cnpja.com/en-us/docs/glossary#documento-fiscal--tax-document) the registration is authorized to issue, such as NF-e and CT-e (`DETAILED`) |

Each item in `taxRestrictions` means a state has blocked the CNPJ or CPF as a recipient of interstate tax documents:

| Field | Content |
|---|---|
| `issuer` | State that issued the restriction |
| `recipient` | State blocked as recipient |

- `taxRestrictions` holds every known restriction, without the `stateRegistry.states` filter applied to `registrations`.
- Address and activity come from the state's registry and can differ from the CNPJ record at the Receita Federal.

## Pre-invoice verification

What to check before issuing an NF-e is in [Before issuing an invoice](https://cnpja.com/en-us/docs/data/state-registrations#before-invoicing). In the API, shorten only the registrations' age limit and keep the default for the rest of the record:

```http
GET /v2/establishments/37335118000180?expand=stateRegistry&stateRegistry.maxAge=1d HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
```

The rest of the CNPJ record keeps the `45d` default, and registrations are queried live if they are more than 1 day old. Each check maps to these fields:

| Check | Fields |
|---|---|
| Reading date | `stateRegistry.updatedAt` and `registrations[].updatedAt`, compared with the limit you asked for |
| Registration in the customer's state | `registrations[].state` and `isEnabled` |
| Type | `type.code`, such as `STATE_TAXPAYER` or `NON_TAXPAYER` |
| Restrictions | `hasRestriction` and `taxRestrictions` |
| Authorized documents | `authorizedTaxDocuments`, with `stateRegistry.view=DETAILED` |
| Record of the check | The `CCC_REGISTRATIONS` certificate, described in [Certificate](#certificate) |

## Codes and values

Base your logic on `code`. The `label` is for display only and changes with the language, as explained in [Response format](https://cnpja.com/en-us/docs/api/responses).

### Registration types

| `type.code` | Type |
|---|---|
| `STATE_TAXPAYER` | State taxpayer |
| `TAX_SUBSTITUTION` | Tax substitution |
| `NON_TAXPAYER` | Non-taxpayer |
| `INTERSTATE_TAXPAYER` | Interstate taxpayer |
| `RURAL_PRODUCER` | Rural producer |

The meaning of each type is in [Types and status](https://cnpja.com/en-us/docs/data/state-registrations#types-and-status). The registration status has no code of its own: use `isEnabled`, with its date in `statusDate`, and `hasRestriction` for restrictions.

### Authorized tax documents

| `authorizedTaxDocuments[].code` | Document |
|---|---|
| `NFE` | NF-e |
| `NFCE` | NFC-e |
| `CTE_ROAD`, `CTE_AIR`, `CTE_WATERWAY`, `CTE_RAIL`, `CTE_PIPELINE`, `CTE_MULTIMODAL` | CT-e for road, air, waterway, rail, pipeline and multimodal transport |
| `CTE_OTHER` | CT-e OS |
| `BPE`, `BPE_AIR`, `BPE_METROPOLITAN` | BP-e, BP-e TA and BP-e TM |
| `NFCOM` | NFCom |
| `NF3E` | NF3-e |
| `NFAG` | NFAg |
| `NFGAS` | NFGas |

What each document is is explained in [Authorized tax documents](https://cnpja.com/en-us/docs/data/state-registrations#authorized-tax-documents).

## Sources and updates

Registrations and restrictions come only from the [CCC](https://dfe-portal.svrs.rs.gov.br/Nfe/Ccc), queried live per state. In Lookup CPF, `legalName` comes from the CCC or [SUFRAMA](https://www4.suframa.gov.br/cadsuf/#/menu-externo), whichever of the two sources was queried most recently.

Registrations come from cached data when they are within the age limit, which is `stateRegistry.maxAge` or, without it, `maxAge`, with a `45d` default. If they are older, or were never queried, they are queried live at the CCC before the response. The general rules are in [Max age and partial success](https://cnpja.com/en-us/docs/api/max-age).

The age checked is `stateRegistry.updatedAt` with `SUMMARY`, and that of each requested state with `DETAILED`, or with `SUMMARY` for a CPF with no known state registration yet. Which states each level queries live is explained in [Summary and detailed](https://cnpja.com/en-us/docs/data/state-registrations#detail-levels).

`stateRegistry.updatedAt` shows the last live query in any state, and `registrations[].updatedAt` that of each registration. To know whether a registration is within the limit you asked for, compare its `updatedAt` with that limit.

### Partial success

Each live query has up to 30 seconds to complete. If the CCC query fails or exceeds that time, the request goes on and the response comes with status `206`, a [partial success](https://cnpja.com/en-us/docs/glossary#sucesso-parcial--partial-success):

- `stateRegistry` holds the registrations already in cached data, which may be older than the limit you asked for, or comes back empty if they were never queried.
- The failed query is not charged, under the [metering rules](https://cnpja.com/en-us/legal/metering#not-charged). With `DETAILED`, this applies to each state whose query failed. The other resources in the request are returned as usual.
- The response does not say which resource failed. Compare `stateRegistry.updatedAt`, or with `DETAILED` the `updatedAt` of each registration, with the limit you asked for.
- With `DETAILED`, a state whose query failed and that has no cached registration is missing from `registrations`. On a `206`, retry the request later before concluding that there is no registration.

> **Important:** treat `206` as success, but do not use stale registrations for decisions that need recent data, such as issuing an invoice. See [Max age and partial success](https://cnpja.com/en-us/docs/api/max-age).

## Certificate

The `CCC_REGISTRATIONS` certificate, the Comprovante de Inscrições no Cadastro Centralizado de Contribuintes, carries the registrations as a PDF, as explained in [What a certificate is](https://cnpja.com/en-us/docs/data/certificates#what-it-is). It is issued by the [certificate](https://cnpja.com/en-us/docs/api/certificates) operations:

- **[Issue CNPJ dossier](https://cnpja.com/en-us/docs/api/reference#tag/establishments/GET/v2/establishments/%7btaxId%7d/dossier):** for the state of the establishment's address, with no option to choose another. It is left out of the PDF for establishments with no state, such as those located abroad.
- **[Issue CPF dossier](https://cnpja.com/en-us/docs/api/reference#tag/individuals/GET/v2/individuals/%7btaxId%7d/dossier):** for a single state where the CPF has a known state registration, with no option to choose the state. When the CPF has no known state registration, the CCC is not queried and the certificate is left out: look up the CPF first with `expand=stateRegistry` and the states in `stateRegistry.states`.

```http
GET /v2/establishments/37335118000180/dossier?certificates=CCC_REGISTRATIONS HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
```

- The certificate comes from live queries at the CCC and follows the dossier's `maxAge`.
- The certificate consumes quota even when it is left out of the PDF because the CCC has no record of the CNPJ, under the [metering rules](https://cnpja.com/en-us/legal/metering#api-certificates).

## Billing

In Lookup CNPJ, `stateRegistry` is charged separately from the registration data. In both operations, consumption depends on the level and the requested states, as the metering rules set for [Lookup CNPJ](https://cnpja.com/en-us/legal/metering#api-cnpj), [Lookup CPF](https://cnpja.com/en-us/legal/metering#api) and [Issue certificates](https://cnpja.com/en-us/legal/metering#api-certificates).

> **Important:** with `stateRegistry.view=DETAILED`, each requested state with no registration is queried live on every request, regardless of the age limit, so, with `stateRegistry.states=ALL`, a CNPJ with no registration at all consumes 27 live queries per request. The same applies to Lookup CPF with `DETAILED` and, on a CPF's first lookup, also with `SUMMARY`. See how to spend less in [All states: mind the cost](https://cnpja.com/en-us/docs/data/state-registrations#all-states-cost).

## Frequent errors

| Status | Code | Cause | Action |
|---|---|---|---|
| `400` | `REQUEST_VALIDATION_FAILED` | `stateRegistry.states`, `stateRegistry.view` or `stateRegistry.maxAge` without `stateRegistry` in `expand`, or a value in the wrong format | Include `stateRegistry` in `expand` and fix the parameter shown in `errors`, following the accepted values in [Request](#request) |
| `400` | `REQUEST_VALIDATION_FAILED` | For a CPF, a missing `expand` or `stateRegistry.states`, or `ORIGIN` was sent | Send `expand` and, with `stateRegistry`, the states or `ALL` |
| `401` | `API_KEY_MISSING` | Request without an API key, or a public request with query parameters, such as `expand` | Send the key in the `Authorization` header, as explained in [First request](https://cnpja.com/en-us/docs/api/first-request) |
| `404` | `ESTABLISHMENT_NOT_FOUND` | The CNPJ is not registered with the Receita Federal | Check the CNPJ before repeating: the `404` is also charged, under the [metering rules](https://cnpja.com/en-us/legal/metering#charged-without-result) |
| `404` | `INDIVIDUAL_NOT_FOUND` | No state or SUFRAMA registration was found for the CPF in the requested states | Extend `stateRegistry.states` to the relevant states, or retry the request later in case the CCC failed |

Other errors are in [Limits and errors](https://cnpja.com/en-us/docs/api/limits-and-errors).

## Use cases

- **Invoice issuance:** support the check, before issuing the NF-e, that the recipient has an enabled registration with no restriction in the state, with a short `stateRegistry.maxAge`.
- **Customer onboarding:** tell from the registration's type and status whether a customer is an ICMS taxpayer, as support for setting the tax treatment of the sale.
- **Supplier qualification:** check periodically that suppliers' registrations are still enabled, and keep the CCC certificate as a record of the query.
- **State footprint:** find out in which states a CNPJ is registered with `stateRegistry.states=ALL` and `SUMMARY`, keeping in mind how the other states are refreshed, as described in [Summary and detailed](https://cnpja.com/en-us/docs/data/state-registrations#detail-levels).
- **Carriers and issuers:** check in `authorizedTaxDocuments` whether the registration is authorized for the expected document, such as CT-e or NFC-e.
- **Rural producers:** support the check, in Lookup CPF, of the registration of individual producers who sell to your company.

## In the app

On the platform, registrations appear in the **State registrations** section of the [company record](https://cnpja.com/en-us/docs/companies/record#state-registrations), with details queried per state, and can be included in spreadsheet exports for the states you choose, as explained in [States for state registrations](https://cnpja.com/en-us/docs/lists/export#states). Lookups by CPF are only available in the API.

## Notes

- State registrations are available only in Lookup CNPJ and Lookup CPF. [Lookup company](https://cnpja.com/en-us/docs/api/reference#tag/companies/GET/v2/companies/%7bid%7d) and [Search CNPJ](https://cnpja.com/en-us/docs/api/reference#tag/establishments/GET/v2/establishments) neither return nor filter by them.
- For an establishment with no state, such as those located abroad, `ORIGIN` matches no state and, with `SUMMARY`, the registrations are not queried live.
- Store the registration number as text, never as a number, to keep leading zeros, as explained in [Identifiers as text](https://cnpja.com/en-us/docs/data/format#identifiers).
- State registrations and the tax regime are separate data: the Simples Nacional option is in [Tax regime](https://cnpja.com/en-us/docs/api/tax-regime), and SUFRAMA registrations are in [SUFRAMA](https://cnpja.com/en-us/docs/api/suframa).
- Every parameter is in [Lookup CNPJ](https://cnpja.com/en-us/docs/api/reference#tag/establishments/GET/v2/establishments/%7btaxId%7d) and [Lookup CPF](https://cnpja.com/en-us/docs/api/reference#tag/individuals/GET/v2/individuals/%7btaxId%7d), and the `expand` rules in [Response expansion](https://cnpja.com/en-us/docs/api/reference#description/response-expansion).
