← Blog

Company data

CNPJ Data Download: Brazil Company Database by CNAE and State

Download Brazilian CNPJ data from the Receita Federal open registry: filter by CNAE, UF, município or partner CPF and export razão social, QSA and status.

Epic Scrapers

Every company in Brazil has a CNPJ (Cadastro Nacional da Pessoa Jurídica), and the Receita Federal publishes the whole register as open data. The problem is the format: the official dump is tens of gigabytes of zipped CSV files split across companies, establishments, partners and lookup tables. If you only want “all active IT companies in São Paulo” or a lista de empresas por CNAE, loading that dump into a database is a lot of work for one query.

The Brazil CNPJ Scraper skips that step. You give it a CNPJ or a set of filters (state, CNAE code, municipality, legal nature, partner CPF) and it returns one clean JSON record per establishment, with 40+ fields including razão social, situação cadastral, CNAEs, address, contact data, tax regime and the full partner list (QSA).

What data you get per CNPJ

The actor reads from minhareceita.org, a community-maintained API that mirrors the official Receita Federal files and reloads them monthly. Each record includes:

Group Fields
Identification cnpj, razao_social, nome_fantasia, matriz_filial
Registration status situacao_cadastral (ATIVA, SUSPENSA, INAPTA, BAIXADA, NULA), situacao_cadastral_motivo, data_situacao_cadastral, data_abertura
Activity cnae_principal_codigo, cnae_principal_descricao, cnaes_secundarios
Legal form and size natureza_juridica_codigo, natureza_juridica, porte (MICRO EMPRESA, EPP, DEMAIS), capital_social
Address logradouro, numero, complemento, bairro, municipio, uf, cep
Contact telefone1, telefone2, fax, email
Tax regime simples_nacional, data_opcao_simples, mei, data_opcao_mei, regime_tributario
Partners (QSA) qsa, qsa_count
Metadata ultima_atualizacao, source_url

How to download CNPJ data in 5 minutes

  1. Open the Brazil CNPJ Scraper on Apify and click Try for free.
  2. Choose a lookup mode: a single cnpj, or any combination of uf, cnae, municipio, naturezaJuridica and partnerCpf.
  3. Set maxItems. Start with 50 to check the output, then raise it.
  4. Click Start. Filtered searches paginate automatically.
  5. Export the dataset as CSV, Excel or JSON, or pull it via the API.

Look up one CNPJ (consulta CNPJ)

Punctuation is ignored, so you can paste the number as it appears on an invoice. A cnpj value overrides every other filter.

{
  "cnpj": "00.000.000/0001-91",
  "maxItems": 1
}

Lista de empresas por CNAE and state

This is the most common lead-gen query: every establishment in São Paulo whose primary or secondary activity is CNAE 6209-1/00 (IT support and other IT services).

{
  "uf": "SP",
  "cnae": "6209100",
  "pageSize": 1000,
  "maxItems": 10000
}

The cnae filter matches both the primary activity and the secondary CNAEs, so you also catch companies that list IT services as a side activity. Write the code as seven digits with no punctuation.

One detail worth knowing: uf defaults to DF (Distrito Federal) in the input form. For a nationwide search on CNAE alone, set "uf": "" explicitly.

Narrow by município and natureza jurídica

municipio takes an IBGE or SIAFI municipality code (digits only), and naturezaJuridica takes a legal nature code. This input pulls individual entrepreneurs (code 2135, Empresário Individual) registered in Brasília (IBGE 5300108):

{
  "municipio": "5300108",
  "naturezaJuridica": "2135",
  "maxItems": 5000
}

Find every company a person is a partner in

The Receita Federal publishes partner CPFs in masked form (***123456**). Pass that masked value in partnerCpf to list every CNPJ where it appears in the QSA. This is how KYC teams and journalists map ownership networks.

{
  "partnerCpf": "***123456**",
  "maxItems": 200
}

Sample output

A trimmed record for a small IT company in São Paulo (values illustrative):

{
  "cnpj": "28417390000162",
  "razao_social": "NOVA ROTA SISTEMAS LTDA",
  "nome_fantasia": "NOVA ROTA",
  "matriz_filial": "MATRIZ",
  "situacao_cadastral": "ATIVA",
  "data_situacao_cadastral": "2017-09-14",
  "data_abertura": "2017-09-14",
  "cnae_principal_codigo": "6209100",
  "cnae_principal_descricao": "Suporte técnico, manutenção e outros serviços em tecnologia da informação",
  "cnaes_secundarios": [
    "6201501 — Desenvolvimento de programas de computador sob encomenda"
  ],
  "natureza_juridica_codigo": "2062",
  "natureza_juridica": "Sociedade Empresária Limitada",
  "porte": "MICRO EMPRESA",
  "capital_social": 50000,
  "logradouro": "AVENIDA PAULISTA",
  "numero": "1578",
  "bairro": "BELA VISTA",
  "municipio": "SAO PAULO",
  "uf": "SP",
  "cep": "01310200",
  "telefone1": "1132854410",
  "email": "contato@novarota.com.br",
  "simples_nacional": true,
  "mei": false,
  "qsa": [
    "MARIA OLIVEIRA SANTOS — Sócio-Administrador — id: ***482193** — ingreso: 2017-09-14"
  ],
  "qsa_count": 1
}

Every field comes straight from the official register, so the data is only as good as what companies declared. Phone numbers and emails in particular are often outdated for older companies.

Use the CNPJ data via API

Run the actor and read the results with the Apify API. Set APIFY_TOKEN in your environment first.

cURL (synchronous run that returns dataset items):

curl -X POST \
  "https://api.apify.com/v2/acts/epicscrapers~brazil-cnpj-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"uf": "RJ", "cnae": "8630504", "maxItems": 500}'

Python (pip install apify-client):

import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])

run = client.actor("epicscrapers/brazil-cnpj-scraper").call(
    run_input={"uf": "MG", "cnae": "4781400", "maxItems": 2000}
)

for company in client.dataset(run["defaultDatasetId"]).iterate_items():
    if company["situacao_cadastral"] == "ATIVA":
        print(company["cnpj"], company["razao_social"], company["municipio"])

Because the Receita Federal data is refreshed monthly upstream, a monthly scheduled run is enough to keep a CRM or internal company table current.

Use cases

B2B lead generation. Build a prospect list for a vertical without buying one: filter by CNAE and UF, keep situacao_cadastral = ATIVA, then segment by porte and capital_social. Agencies selling to clinics, restaurants or retailers can pull a whole state in one run.

KYC and onboarding checks. Verify that a customer’s CNPJ exists, is active, matches the razão social they gave you, and has the partners you expect. The situacao_cadastral_motivo field explains why a company is INAPTA or BAIXADA.

Ownership mapping. Use partnerCpf with a masked CPF from one company’s QSA to find the other companies the same person is linked to. Credit insurers and investigative journalists use this to spot shell structures.

Tax consulting prospecting. Filter on companies in Simples Nacional or MEI (simples_nacional, mei) to find businesses likely to need accounting help as they grow out of those regimes.

Market sizing. Count active establishments per CNAE per município to estimate addressable market, density of competitors, or new openings by data_abertura.

For company registers in other countries, see our guides to French company data from Pappers and German filings from the Bundesanzeiger.

FAQ

Is there an official Receita Federal CNPJ API?

The Receita Federal publishes the full register as bulk open-data files, and individual lookups are possible on its website with a CAPTCHA. There is no free official REST API for filtered bulk queries, which is why community mirrors like minhareceita.org exist. This actor wraps that mirror so you can query it by filter and export results.

How current is the data?

The upstream mirror reloads monthly from the official Receita Federal dumps, so most records are between 0 and 45 days old. Each record carries an ultima_atualizacao timestamp.

How many companies can I extract?

Free Apify plan accounts can extract up to 10,000 records per calendar month (UTC) across all runs. Paid accounts can extract up to 100,000 records per run. Control volume with maxItems; see the Pricing tab on the actor page for costs.

CNPJ registration data is published by the Brazilian government as open data. Partner data includes personal information, which is why CPFs are masked at the source. If you process partner names or contact details, do it under a valid LGPD legal basis and don’t use them for unsolicited mass messaging. This is not legal advice.

Do I need proxies?

No. The actor makes plain HTTP requests to a cached public API, with no browser and no CAPTCHA.

Get your first CNPJ export

Pick a CNAE and a state, set maxItems to 100 and run it. You’ll have a spreadsheet of real Brazilian companies in about a minute. Open the Brazil CNPJ Scraper on Apify or read more on the actor page.