Company Search

In the Commercial API, in the Premium Plan, you can perform searches using filters to find companies that meet your requirements.

Attention: Access to this endpoint is exclusive to Premium Plan subscribers.

Method: GET

Endpoint: https://comercial.cnpj.ws/pesquisa?ADD_FILTERS

Filters

You can use the filters below in your queries:

Field
Description

atividade_principal_id

CNAE Code

atividade_secundaria_id

CNAE Code

atividade_id

CNAE Code (search in the primary and secondary activity)

natureza_juridica_id

Legal Nature Code

razao_social

Company Name

nome_fantasia

Trade Name

pais_id

BACEN Country Code

estado_id

IBGE State Code

cidade_id

IBGE City Code

cep

ZIP Code

situacao_cadastral

Registration status with the Federal Revenue

data_situacao_cadastral_de

Registration Status Date (From this date) in YYYY-MM-DD format

data_situacao_cadastral_ate

Registration Status Date (Until this date) in YYYY-MM-DD format

porte_id

Company size ID

socio_nome

Partner's Name

data_inicio_atividade_de

Start Date of Activity (From this date) in YYYY-MM-DD format

data_inicio_atividade_ate

Start Date of Activity (Until this date) in YYYY-MM-DD format

It is crucial to highlight that the queries made in this endpoint are based on our database and not on the Federal Revenue database. Therefore, discrepancies may occur between the information, as our database may have a lag of up to 45 days compared to the updated data from the Federal Revenue. It is worth noting that, although we perform daily registrations due to CNPJ queries made in the API, the lag can still occur.

List of Registration Statuses:

  • Active

  • Closed

  • Inactive

  • Null

  • Suspended

List of Registered Sizes:

ID
Description

01

Not informed

02

Micro Enterprise

03

Small Business

05

Others

Request Examples

We have a package that can help you integrate with JavaScript:

yarn add consultar-cnpj
const consultarCNPJ = require("consultar-cnpj");

async function getCNPJ() {
  const token = "INFORME O SEU TOKEN DE ACESSO";
  const page = 2;

  const data = await consultarCNPJ.pesquisa(
    { atividade_principal_id: "6203100", estado_id: 28 },
    token,
    page
  );
  console.log(data);
}

More information about the package

Pagination

If the search returns more than 20 CNPJs, the API will divide the response into pages. You can check this in the API's JSON response, in the "pagination" property, which shows the current page, the total number of pages, and the total number of CNPJs:

{
  "paginacao": {
    "limite": 20,
    "pagina": 1,
    "paginas": 5,
    "total": 87
  }
}

To search for a specific page, simply provide the page number in the request:

curl -X GET https://comercial.cnpj.ws/pesquisa?atividade_principal_id=6203100&pagina=2 -H "x_api_token: YOUR_TOKEN"

It is also possible to change the number of CNPJs returned, the default is 20 but it can be up to 100:

curl -X GET https://comercial.cnpj.ws/pesquisa?atividade_principal_id=6203100&pagina=2&limite=100 -H "x_api_token: YOUR_TOKEN"

Return Example

Below is an example of the JSON returned when searching by CNAE 6203100:

{
  "paginacao": {
    "limite": 20,
    "pagina": 1,
    "paginas": 1494,
    "total": 29865
  },
  "ordenacao": [],
  "filtros_disponiveis": [
    "cnpj",
    "cnpj_raiz",
    "natureza_juridica_id",
    "porte_id",
    "razao_social",
    "nome_fantasia",
    "pais_id",
    "estado_id",
    "cidade_id",
    "cep",
    "atividade_principal_id"
  ],
  "filtros_aplicados": {
    "atividade_principal_id": "6203100"
  },
  "data": [
    "19323263000160",
    "03124023000104",
    "64919913000199",
    "36427967000100",
    "06370042000109",
    "01056469000105",
    "03292219000108",
    "94338217000664",
    "01645901000101",
    "02868026000181",
    "04957691000177",
    "01755516000109",
    "04970015000133",
    "65144347000153",
    "04810384000169",
    "74641804000106",
    "82296112000104",
    "03035876000161",
    "33643305009801",
    "05121798000143"
  ]
}

Last updated

Was this helpful?