Skip to content
CNPJ search and lists in the API
API · Features

CNPJ search and lists in the API

Search companies via the API by CNAE, address, size, tax regime and status, with free text, sorting, paging and lists to restrict or exclude CNPJs.

Tip: Concepts on this page: How company search matching works, Companies and establishments and Create and manage lists.

Search CNPJ finds establishments by their characteristics, such as economic activity, address, company size, tax regime or registration status, instead of by CNPJ number. The response comes in pages of up to 1,000 records, sorted by relevance or by a chosen field, each holding the establishment’s registration data and the company data. Lists complement the search: they gather CNPJs your organization already knows, to search only among them or to leave them out. Search and lists always require an API key.

Each record is an establishment, and a filter on the company returns every establishment of that company that matches the other filters. Combine it with type.code.in=HEAD to get one record per company, as explained in Each result is an establishment.

Search uses cached data only and serves to find establishments without knowing their CNPJ. For a known CNPJ, Lookup CNPJ accepts maxAge and optional resources. A common flow combines both: the search selects the establishments, and Lookup CNPJ returns the current data of each one or the resources the search does not return, such as state registrations.

Request

OperationMethod and pathPurpose
Search CNPJGET /v2/establishmentsSearches establishments by filters
Create listPOST /v2/listsCreates a list with a name and CNPJs
Search listsGET /v2/listsSearches the organization’s lists by name
Lookup listGET /v2/lists/{listId}Returns the name, type and number of CNPJs of a list
Update listPATCH /v2/lists/{listId}Renames the list or adds, removes or replaces CNPJs
Delete listDELETE /v2/lists/{listId}Deletes the list and its CNPJs

List operations are described in Lists. Search CNPJ accepts the query parameters below, all optional:

ParameterValuesEffect
limitFrom 1 to 1000, default 10Number of records per page
cursorThe nextCursor of a previous responseReads the next page; cannot be combined with any other parameter
searchFree textReturns records containing every word, in any order
sortDescribed in Sorting, default relevanceField used to order the records
orderASC or DESC, default depends on sortSort direction, ascending or descending
FiltersDescribed in FiltersNarrow the result; each added filter combines with the others

This request finds active establishments in SP or RJ, opened in 2020, with padaria or confeitaria in the legal name or trade name:

GET /v2/establishments?status.code.in=ACTIVE&address.state.in=SP,RJ&incorporationDate.gte=2020-01-01&incorporationDate.lte=2020-12-31&names.some=padaria,confeitaria HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY

Search accepts neither maxAge nor expand. Requests without a key are rejected with 401 API_KEY_MISSING, since search is not part of Public access.

Response fields

Response of GET /v2/establishments?address.state.in=SP&status.code.in=ACTIVE&limit=100, trimmed to one of the records, with illustrative total and nextCursor values:

{
  "total": 250,
  "limit": 100,
  "nextCursor": "9ed11ce29dc14f9c78304c1a403e9f85",
  "records": [
    {
      "updatedAt": "2026-01-27T03:00:00.000Z",
      "taxId": "37335118000180",
      "incorporationDate": "2020-06-05",
      "type": { "code": "HEAD", "label": "Matriz" },
      "tradeName": "Cnpja",
      "status": { "code": "ACTIVE", "label": "Ativa" },
      "address": {
        "city": "São Paulo",
        "state": "SP",
        "postalCode": "01452922",
        "municipality": "3550308"
      },
      "primaryActivity": {
        "code": "6311900",
        "label": "Tratamento de dados, provedores de serviços de aplicação e serviços de hospedagem na internet"
      },
      "company": {
        "id": "37335118",
        "legalName": "CNPJA TECNOLOGIA LTDA",
        "size": { "code": "SMALL", "label": "Empresa de Pequeno Porte" },
        "taxRegime": {
          "type": { "code": "PRESUMED_PROFIT", "label": "Lucro Presumido" }
        }
      }
    }
  ]
}

The response follows the paged format shared by all searches, described in Response format:

FieldContent
totalNumber of records matching the search, across all pages
limitPage size applied
nextCursorCursor of the next page, or null when there are no more
recordsRecords of the page; the last one may hold fewer than limit

Each item of records has the fields of Lookup CNPJ without optional resources:

FieldContent
updatedAtLast update of the establishment from the Receita Federal
taxIdCNPJ, with 14 characters and no punctuation
incorporationDateOpening date
typeHead office (HEAD) or branch (BRANCH)
tradeNameTrade name, or null
status, statusDateRegistration status and its date
statusReasonReason for the registration status, present when the establishment is not active
specialStatus, specialStatusDateSpecial status and its date, present when there is one
addressStreet, number, details, district, municipality, state, CEP (postalCode), municipality IBGE code (municipality) and country
phones, emailsPhones in E.164 format and emails, each with its type
primaryActivity, secondaryActivitiesEconomic activities, with the CNAE code and description
companyRoot (id), legal name, share capital, legal nature, size, federative entity when there is one, partners (partners) and tax regime (taxRegime) without regularIbsStartDate, regularCbsStartDate and its history

Records do not carry stateRegistry, suframa or address.coordinates, which are optional resources of Lookup CNPJ. A search with no matches returns 200 with empty records, total set to 0 and nextCursor set to null, never 404.

Filters

Every filter is optional. Each filter name is a field path followed by an operator, such as address.state.in; the dots are part of the name. The table shows each field with the operators it accepts:

FamilyFields and operatorsExample
Free textsearchsearch=cnpja faria lima
Namesnames (legal name or trade name), company.legalName and tradeName, with some and nonenames.some=padaria,confeitaria
DatesincorporationDate (opening), statusDate (registration status) and specialStatusDate (special status), with gte and lteincorporationDate.gte=2020-01-01
Companycompany.shareCapital (gte, lte), company.legalNature.code (in, nin) and company.size.code (in)company.size.code.in=MICRO,SMALL
Tax regimecompany.taxRegime.type.code (in); company.taxRegime.simplesNacionalStartDate, company.taxRegime.simeiStartDate, company.taxRegime.regularIbsStartDate and company.taxRegime.regularCbsStartDate (gte, lte)company.taxRegime.type.code.in=SIMPLES_NACIONAL_SIMEI
Type and statustype.code, status.code, statusReason.code and specialStatus.code, with instatus.code.in=ACTIVE
Addressaddress.street, address.number, address.details, address.district, address.municipality and address.country.code (in, nin); address.state (in); address.postalCode (in, gte, lte)address.municipality.in=3550308
Phonesphones (count, gte, lte), phones.type.code (some), phones.area (area code) and phones.number (some, none)phones.type.code.some=MOBILE
Emailsemails (count, gte, lte), emails.type.code (some), emails.address and emails.domain (some, none)emails.domain.none=gmail.com,hotmail.com
ActivitieseconomicActivities.code (primary or secondary) and secondaryActivities.code, with some and none; primaryActivity.code (in, nin)economicActivities.code.some=6311900
Listslists, with some and nonelists.some=b7736fa2-fb08-4b39-a8ff-26e8a53d36c3

Tax regime filters follow the rules in Tax regime in the API, including the estimated regime of companies without an annual return. The company.taxRegime.regularIbsStartDate and company.taxRegime.regularCbsStartDate filters select Simples Nacional hybrid companies by the start of the current IBS or CBS regular regime period, even though records do not return these two fields. The values accepted by each filter are in Codes and values and in Search CNPJ, in the Reference. The app’s equivalent filters, with their on-screen names, are in All filters.

Operators

OperatorMeaningExample
inEquals any of the valuesaddress.state.in=SP,RJ
ninEquals none of the valuescompany.legalNature.code.nin=2135
someContains any of the words or valuesnames.some=padaria,confeitaria
noneContains none of the words or valueseconomicActivities.code.none=4711302,5611201
gteGreater than or equal to the valueincorporationDate.gte=2020-01-01
lteLess than or equal to the valuecompany.shareCapital.lte=100000
  • Several values: with in and some, a record needs to match only one value; with nin and none, it is left out if it matches any of them. Send the values comma-separated or by repeating the parameter: address.state.in=SP,RJ is the same as address.state.in=SP&address.state.in=RJ. A comma always separates values and cannot be part of a term.
  • Combination: different filters combine with AND, so a record must satisfy all of them.
  • Ranges: gte and lte include the value itself, and both on the same field make a closed range. On fields that are lists, they count items: phones.gte=1 returns records with at least one phone.
  • Value format: dates as YYYY-MM-DD, codes without punctuation (CEP 01452922, CNAE 6311900, IBGE code 3550308), phones in E.164 format and enums exactly as listed.
  • URL encoding: encode the + of phone numbers as %2B, as in phones.number.some=%2B5511971564144. Without encoding, the + is read as a space and the value is rejected.

An unknown parameter or a value in the wrong format returns 400 REQUEST_VALIDATION_FAILED. An unrecognized name produces an item in errors with the code ADDITIONAL_PROPERTIES, which does not say which name was rejected, so check the spelling of the parameters.

Text matching

Text filters, that is, names, company.legalName and tradeName, and search ignore case and accents and compare whole words by their Portuguese stem, as explained in Words, accents and punctuation.

  • In some and none, each word counts on its own, even inside one value: names.some=pao de queijo matches any name containing pao, de or queijo.
  • search returns only records containing every word, in any order, and looks in the CNPJ, the names, the phones, the emails and the address at once, as detailed in Free text search.
  • address.street, address.number, address.details and address.district compare the whole value, not separate words, with the same case, accent, punctuation and stem rules. They accept only in and nin.
  • Other filters compare exact values, including some and none on phones, email domains and economic activities, which compare each whole item.

Sorting

sort chooses the field used to order the records, and order, the direction: ASC for ascending or DESC for descending. Without order, each field follows its default direction:

ValueOrders byDefault direction
relevance (default)RelevanceDescending, most relevant first
taxIdCNPJAscending
incorporationDateOpening dateDescending, most recent first
company.shareCapitalCompany share capitalDescending, largest first
company.legalNameCompany legal nameAscending

This request returns establishments in SP, starting from the most recently opened:

GET /v2/establishments?address.state.in=SP&sort=incorporationDate HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
  • Relevance: what relevance favors is in Result order.
  • Ties: with any sort, records with the same value in the chosen field follow ascending taxId, so the order is the same on every page.
  • Legal name: company.legalName is compared by character code, without ignoring case or accents, unlike the text filters: uppercase letters come before lowercase ones, and accented letters come after both.

Pagination

The first request defines the search, with the filters, sort, order and limit. To read the next page, send the response’s nextCursor as cursor, with no other parameter, and repeat until nextCursor is null:

GET /v2/establishments?cursor=9ed11ce29dc14f9c78304c1a403e9f85 HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
  • Fixed parameters: the cursor keeps the filters, sort, order and limit of the first request. To change any of them, start a new search.
  • Validity: each cursor is valid for 15 minutes from the response that returned it. After that, it returns 400 PAGE_CURSOR_INVALID: the API does not resume the read, and the client must send the first request again, with the same parameters, to get a new cursor.
  • Results not frozen: if data changes during the read, a record can appear on two pages or on none, and a page can come back short or empty before the end, as explained in Results are not fixed.
  • Page size: larger pages take fewer requests to go through a result, and compression greatly reduces their size.

Important: keep going until nextCursor is null, even after a short or empty page, and drop duplicates by taxId.

The format of paged responses is in Response format.

Lists

A list is a named set of CNPJs chosen by your organization, as explained in What a list is. Lists belong to the organization: a list created with one key can be used and changed with any other key of the same organization, and in the app as well.

Creation

Create list takes the type, the name and the CNPJs and responds with 201:

POST /v2/lists HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
Content-Type: application/json
{
  "type": "ESTABLISHMENT",
  "name": "Customers",
  "items": ["37335118000180"]
}
FieldContent
typeType of the items; always ESTABLISHMENT, establishments identified by CNPJ
nameList name. Names can repeat across lists, so identify each one by its id
items14-character CNPJs, with no punctuation, uppercase letters if any and valid check digits. Duplicates are discarded

The response, in the same format as Lookup list and Update list, carries the list’s id, used in filters and in the other operations, type, name, size, with the number of distinct CNPJs, and the creation and last update dates in createdAt and updatedAt.

An invalid item returns 400 REQUEST_VALIDATION_FAILED, and errors points to its position, such as items.2 for the third item. To send a large list, compress the request body; the 50 MB limit, described in Limits and errors, applies to the decompressed JSON.

Send the id in lists.some to search only the list’s CNPJs, or in lists.none to leave them out. For several lists, separate the ids with commas: with lists.some, a record must be in any of them; with lists.none, it is left out if it is in any of them.

GET /v2/establishments?lists.some=b7736fa2-fb08-4b39-a8ff-26e8a53d36c3&status.code.in=SUSPENDED,NONCOMPLIANT,CLOSED HTTP/1.1
Host: api.cnpja.com
Authorization: YOUR_API_KEY
  • Search uses each list’s content at the time of each request: CNPJs added with Update list count immediately, including on the next pages of a search already in progress.
  • A nonexistent list id raises no error: with lists.some, the search returns no records, and with lists.none, it leaves nothing out. Check the id with Search lists.
  • A CNPJ in the list that is not yet in the search does not appear in the results until it enters cached data and the search index, as explained in When a new CNPJ appears.

Maintenance

In Update list, operation and items always go together:

operationEffect
ADDAdds the CNPJs and ignores those already in the list
REMOVERemoves the CNPJs and ignores those not in it
REPLACEReplaces every CNPJ; with an empty items, empties the list while keeping its id

To only rename, send just name: the CNPJs stay unchanged. While an export of the list, made in the app, is queued or running, operation is rejected with 409 LIST_EXPORT_IN_PROGRESS, but renaming still works. The response carries the updated list, with the new count in size. Delete list removes the list and its CNPJs, with no way to recover them, and responds with 204.

List lookup

Search lists returns the organization’s lists in pages, with the same limit, cursor, order and response format as Search CNPJ. The search filter returns the lists whose name contains every word sent, in any order, and does not change the sorting. sort accepts createdAt (default), updatedAt, name and size: without order, name is ascending and the others start from the most recent or largest lists. Ties follow ascending id. Lookup list returns the name, type and number of CNPJs of a list by its id.

List limits

The number of lists per organization and of CNPJs per list have current limits, described in Usage limits, under Organization and Lists, exports and bulk. In the API, they apply like this:

  • On create, the values in items count toward the limit with their duplicates, although duplicates are discarded when stored: remove them before sending. Above the limit, the request is rejected with 400 REQUEST_VALIDATION_FAILED.
  • In an ADD, the list’s current size plus the distinct CNPJs sent count, even those already in it. Above the limit, the request is rejected with 422 LIST_SIZE_EXCEEDED: send only CNPJs not yet in the list, or remove some first.
  • At the organization’s list limit, Create list is rejected with 422 LIST_LIMIT_EXCEEDED: delete the lists you no longer use.

Codes and values

FilterAccepted values
status.code.inACTIVE (active), CLOSED (closed), NONCOMPLIANT (noncompliant), SUSPENDED (suspended) and VOID (void)
type.code.inHEAD (head office) and BRANCH (branch)
company.size.code.inMICRO (micro company), SMALL (small company) and OTHER (other)
company.taxRegime.type.code.inACTUAL_PROFIT, PRESUMED_PROFIT, ARBITRATED_PROFIT, SIMPLES_NACIONAL, SIMPLES_NACIONAL_HYBRID, SIMPLES_NACIONAL_SIMEI and NOT_APPLICABLE, described in Tax regime in the API
phones.type.code.someLANDLINE (landline) and MOBILE (mobile)
emails.type.code.someACADEMIC (academic), ACCOUNTING (accounting), CORPORATE (corporate), CONSUMER (consumer) and GOVERNMENT (government)
address.state.inAbbreviation of one of the 27 states, such as SP or DF
company.legalNature.code4-digit legal nature code, such as 2062 (limited liability business company)
statusReason.code.in2-digit code of the registration status reason, such as 01
specialStatus.code.in3-digit special status code, such as 418 (start of judicial reorganization)
address.municipality7-digit municipality IBGE code, such as 3550308

In responses, each code comes with a readable label. Base your logic on code: the label is for display only and changes with the language, as explained in Response format.

Sources and updates

Search reads cached data only: it accepts no maxAge and makes no live queries. Where each piece of data comes from is in Data sources, and how long a new CNPJ or an update takes to reach the filters, in When a new CNPJ appears.

  • Each record’s updatedAt shows the establishment’s last update from the Receita Federal, and company.taxRegime.updatedAt, the regime’s last update via Simples Nacional.
  • A Simples Nacional optant appears as SIMPLES_NACIONAL_HYBRID only after the Simples Nacional is queried live, as in Lookup CNPJ with expand=company.taxRegime, and the IBS or CBS regular regime option is found, as explained in IBS and CBS.
  • For the current data on a CNPJ found, look it up in Lookup CNPJ with a smaller maxAge. The rules are in Max age and partial success.

Billing

Search CNPJ consumes cached queries only, according to the number of records returned on each page, including pages read with cursor, and list operations consume no quota today. The consumption of each case, including the minimum per page, is in the metering rules, under Consumption in the API. Since consumption follows the records, limit also caps the consumption of each page.

Frequent errors

StatusCodeCauseAction
400REQUEST_VALIDATION_FAILEDUnknown or misspelled filter, value in the wrong format, invalid sort or order value, cursor with another parameter, invalid CNPJ in items, or operation without items, or the reverse, in Update listFix what errors points to and check the spelling of the filters
400PAGE_CURSOR_INVALIDCursor expired, after 15 minutes, or unknownStart again from the first request, with the same parameters
401API_KEY_MISSINGRequest without an API keySend the key in the Authorization header, as explained in First request
402CACHED_QUERY_QUOTA_EXCEEDED, LIVE_QUERY_QUOTA_EXCEEDED or OVERAGE_BUDGET_EXCEEDEDThe organization’s quota or overage budget is used up. What each code means is in Error codesFollow one of the ways out in Quota used up
404LIST_NOT_FOUNDLookup, Update or Delete list with an id that does not exist or belongs to another organizationCheck the id with Search lists
409LIST_EXPORT_IN_PROGRESSUpdate list with operation while an export of the list is queued or runningRetry once the export finishes. To only rename, send just name
422LIST_LIMIT_EXCEEDEDThe organization reached its list limitDelete the lists you no longer use
422LIST_SIZE_EXCEEDEDThe ADD would take the list above the limit of CNPJs per listSend only new CNPJs or remove some first

Other errors are in Limits and errors.

Use cases

  • Prospecting: combine status.code.in=ACTIVE, an activity in economicActivities.code.some and a municipality in address.municipality.in, leave out current customers with lists.none and use sort=company.shareCapital to start from the highest share capital.
  • Market sizing: read the total of searches with limit=1, the lowest consumption per page, changing one filter at a time, such as the state or company size.
  • Customer monitoring: search with lists.some and the customer list, together with status.code.in=SUSPENDED,NONCOMPLIANT,CLOSED, to find the customers that are no longer active.
  • Newly opened companies: search periodically with incorporationDate.gte and sort=incorporationDate, which starts from the most recent, and leave out with lists.none the CNPJs already worked, added to the list with ADD on every run.
  • Establishments of a company: send the CNPJ root in search and combine it with filters such as status.code.in=ACTIVE or address.state.in to get the branches that meet the criteria.
  • Segment export for internal use: go through every page with limit=1000 and compression, dropping duplicates by taxId. The results can contain personal data, such as the contacts of sole proprietors: their use follows the Terms of Use and the LGPD, as explained in Responsible use.

In the app

On the platform, the same search is in the CNPJ app > Search CNPJ, with filters under their on-screen names, free text search and views, as explained in Search CNPJs. Lists are the same in the app and in the API, as shown in Create and manage lists.

Notes

  • Search does not filter by state registration or SUFRAMA registration and does not return this data. Look up each CNPJ found as described in State registrations in the API and SUFRAMA in the API.
  • There is no filter by municipality name: use the IBGE code in address.municipality.in, which comes in address.municipality in responses. The municipality name is only considered in search.
  • For every establishment of a company without filters, Lookup company returns a summary of each one, as shown in CNPJ lookup.
  • Every parameter and accepted value is in Search CNPJ, and the general rules in Search filters, Sorting and Pagination, in the Reference.

Informational content that may change without notice. It is not tax, accounting or legal advice, and CNPJá's terms and policies prevail over this page.