# Brazil CNPJ Scraper (Receita Federal Company Data & Leads) (`steadyscrape/brazil-cnpj-scraper`) Actor

Brazil CNPJ lookup (consulta CNPJ) and company search (empresas do Brasil) from the Receita Federal register: legal name, status, CNAE, address, phone, email, Simples/MEI, partners (QSA). Look up CNPJs in bulk or find leads by state, city, CNAE or size. Export to JSON, CSV or Excel, or via API.

- **URL**: https://apify.com/steadyscrape/brazil-cnpj-scraper.md
- **Developed by:** [Steady Scrape](https://apify.com/steadyscrape) (community)
- **Categories:** Lead generation, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 companies

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Brazil CNPJ Scraper: CNPJ lookup, company data and leads

**Brazil CNPJ Scraper** looks up Brazilian companies by **CNPJ** and searches the **Receita Federal's CNPJ register** (the Cadastro Nacional da Pessoa Jurídica, ~60 million establishments) for leads. Give it a list of CNPJs, or a dataset with them, and get one row per company with its legal name (razão social), trade name (nome fantasia), registration status (situação cadastral), opening date, legal nature, size (porte), share capital, CNAE activities, full address, phones, **email**, Simples Nacional and MEI options, and partners (QSA). Or search companies by **state (UF), municipality, CNAE activity, legal nature or partner**, filtered by status, size, opening date, MEI / Simples and phone, and get only the companies opened since your last run. Export the Brazil company data to JSON, CSV or Excel, or use it via API.

The data is the Receita Federal's own open data (dados abertos do CNPJ), published monthly and read through two open-source, free public APIs: [OpenCNPJ](https://opencnpj.org) and [Minha Receita](https://minhareceita.org). No login, no CAPTCHA, no proxy.

### What can this Brazil CNPJ scraper do?

- **Bulk CNPJ lookup (consulta CNPJ em lote)**: validate and enrich a list of CNPJs — a CRM export, a spreadsheet, another Actor's dataset — with the company's status, address, phone, email and partners.
- **Lead generation in Brazil**: list active restaurants in Florianópolis, dental clinics in São Paulo, law firms in Curitiba (CNAE + municipality), with only head offices, only micro companies, only those with a phone.
- **New company monitoring**: schedule a search with "Only new companies" and receive every month the companies that newly match it.
- **KYC and due diligence**: check the situação cadastral, opening date, legal nature, share capital and the partners (quadro societário) of a supplier or customer.
- **Market research**: count and profile companies by activity, size and city.

Both CNPJ formats are accepted: numeric (`33.683.111/0002-80`, `33683111000280`) and the new **alphanumeric CNPJ** the Receita issues since July 2026 (`12.ABC.345/01DE-35`). Check digits are verified before anything is asked: a CNPJ whose digits do not add up (a typo) gets a **free** `invalid_cnpj` row, and the rest of the list is still looked up.

### How to look up CNPJs

Write the CNPJs in **CNPJs to look up**, or pick a dataset in **Or take the CNPJs from a dataset** and say which field holds them (`cnpj` by default; `company.cnpj` for a nested one; a number like `191` is read as `00.000.000/0001-91`, the zeros a spreadsheet dropped).

```json
{ "cnpjs": ["33.683.111/0002-80", "00.000.000/0001-91", "33.000.167/0001-01"] }
```

Each CNPJ is asked of OpenCNPJ, which publishes the email, phones and address the Receita lists; when OpenCNPJ does not know a CNPJ (one opened in the last weeks) or does not answer, Minha Receita is asked instead. A CNPJ that is in no register gives a **free** `not_found` row.

### How to search for companies (leads)

Leave the CNPJ list empty and give at least one of **States**, **Municipalities**, **CNAE activities**, **Legal natures** or **Partner's CPF or CNPJ**:

```json
{
    "municipalities": ["Florianópolis"],
    "cnaes": ["restaurante"],
    "registrationStatuses": ["ATIVA"],
    "establishmentType": "MATRIZ",
    "requirePhone": true,
    "maxResults": 500
}
```

- **Municipalities** by name, case and accents aside (`Sao Paulo`), with the state for a name several states share (`Bom Jesus - PI`), or by IBGE code (`3550308`).
- **CNAE activities** by code (`5611-2/01`), by the first digits of a class (`5611`: restaurants and bars), or by words of the description in Portuguese (`restaurante`, `padaria`, `odontológica`, `advocacia`). Choose whether the CNAE must be the main activity or may be a secondary one.
- **Filters**: registration status (active only by default), head office or branch, company size (ME, EPP, other), opened on or after a date or in the last N days, Simples Nacional, MEI, only with a phone, words in the name.

The search reads Minha Receita's paginated search, 1,024 establishments a page, two seconds apart, and applies the filters as it goes. A filter that keeps few companies (a recent opening date, a rare word) may read many pages: **Max establishments scanned** (100,000 by default) bounds it.

**Emails in searches**: Minha Receita withholds every email, and the street and phone of individual entrepreneurs (MEI, empresário individual), as a privacy and anti-spam choice. Search rows therefore carry no email; the CNPJ lookup does carry it where the Receita lists one.

### Output example

```json
{
    "rowType": "company",
    "cnpj": "00000000000191",
    "cnpjFormatted": "00.000.000/0001-91",
    "cnpjBase": "00000000",
    "legalName": "BANCO DO BRASIL SA",
    "tradeName": "DIRECAO GERAL",
    "establishmentType": "MATRIZ",
    "registrationStatus": "ATIVA",
    "registrationStatusDate": "2005-11-03",
    "openedOn": "1966-08-01",
    "legalNatureCode": "2038",
    "legalNature": "Sociedade de Economia Mista",
    "companySize": "DEMAIS",
    "shareCapital": 120000000000,
    "primaryCnae": "6422100",
    "primaryCnaeFormatted": "6422-1/00",
    "primaryCnaeDescription": "Bancos múltiplos, com carteira comercial",
    "address": "QUADRA SAUN QUADRA 5 BLOCO B TORRE I, II, III, S/N, ANDAR T I SL S101 A S1602 … - ASA NORTE, BRASILIA - DF, 70040-912",
    "postalCode": "70040912",
    "municipality": "BRASILIA",
    "municipalityIbgeCode": "5300108",
    "state": "DF",
    "phones": ["(61) 3493-9002"],
    "phone": "(61) 3493-9002",
    "fax": "(61) 3493-1040",
    "email": "secex@bb.com.br",
    "simplesNacional": false,
    "mei": false,
    "partners": [{ "name": "FELIPE GUIMARAES GEISSLER PRINCE", "document": "***345856**", "type": "PESSOA FÍSICA", "qualification": "Diretor", "joinedOn": "2020-07-10", "ageRange": "41 a 50 anos" }],
    "partnerCount": 41,
    "source": "opencnpj",
    "sourceUrl": "https://api.opencnpj.org/00000000000191",
    "lookupInput": "00.000.000/0001-91"
}
```

### Fields

| field | what it holds |
| --- | --- |
| `rowType`, `status`, `scrapedAt` | `company` with status `ok` (a paid row), or a free `status` row (below); when the row was read |
| `cnpj`, `cnpjFormatted`, `cnpjBase` | The CNPJ bare and formatted, and its first 8 characters, shared by a company's head office and branches |
| `legalName`, `tradeName` | Razão social and nome fantasia |
| `establishmentType` | `MATRIZ` (head office) or `FILIAL` (branch) |
| `registrationStatus`, `registrationStatusDate`, `registrationStatusReason` | Situação cadastral (`ATIVA`, `BAIXADA`, `INAPTA`, `SUSPENSA`, `NULA`), since when and why |
| `specialSituation`, `specialSituationDate` | Situação especial (e.g. recuperação judicial) |
| `openedOn` | Data de início de atividade |
| `legalNatureCode`, `legalNature` | Natureza jurídica, e.g. `2062` Sociedade Empresária Limitada |
| `companySize` | Porte: `MICRO EMPRESA`, `EMPRESA DE PEQUENO PORTE` or `DEMAIS` |
| `shareCapital` | Capital social in reais |
| `primaryCnae`, `primaryCnaeFormatted`, `primaryCnaeDescription`, `secondaryCnaes` | CNAE fiscal and secondary CNAEs with descriptions |
| `address`, `streetType`, `street`, `number`, `complement`, `neighborhood`, `postalCode`, `municipality`, `municipalityIbgeCode`, `state` | The address in one line and its parts; CEP; IBGE municipality code |
| `country`, `foreignCity` | Only for an establishment abroad (UF `EX`) |
| `phones`, `phone`, `fax`, `email` | Contacts as the Receita lists them (email from lookups only) |
| `simplesNacional`, `simplesNacionalSince`, `simplesNacionalExcludedOn`, `mei`, `meiSince`, `meiExcludedOn` | Simples Nacional and MEI options and dates |
| `taxRegimes` | Tax regime by year (lucro real, presumido, arbitrado, imune/isenta) where Minha Receita publishes it; `null` from OpenCNPJ |
| `partners`, `partnerCount` | Quadro societário: name, document (a CPF shows only its middle digits, as the Receita publishes it), type, qualification, entry date, age band, legal representative |
| `source`, `sourceUrl`, `dataUpdatedAt` | Which API answered, its record, and the data's date |
| `lookupInput` | Lookups: the CNPJ as you wrote it, to join the rows back to your list |
| `changeType` | Only new companies: `added` |

A row with `rowType: "status"` is **free** and says in `reason` why what it names in `query` (a CNPJ, a municipality, a CNAE, a dataset or `search`) gave nothing: `not_found`, `invalid_cnpj`, `blocked` (a source did not answer), `no_results`, `no_changes`, `baseline_saved`, `scan_limit`, `too_broad`, `spending_limit`, `unreadable`.

### How much does it cost?

US$0.001 per company delivered (US$1 per 1,000), by lookup or by search. Status rows (not found, invalid, blocked, no results) are free, and pages the search reads without finding a match cost nothing. The run stops at your maximum cost per run.

### Limits

- The register is updated monthly: Minha Receita loads each Receita release a few days after it is published, so a company opened in the last weeks may not be there yet.
- Minha Receita's search limits searches that combine two or more filters (about one a second per server, shared with every other client). The Actor waits as told (up to three times a minute), and if the search keeps refusing it ends with the companies already delivered and a free `blocked` row.
- Searches carry no email; lookups do, where the Receita lists one.
- One row per establishment: a company with branches has one row per CNPJ.

### Is it legal to scrape CNPJ data?

The CNPJ register is public by law (Lei de Acesso à Informação) and published by the Receita Federal as open data; OpenCNPJ and Minha Receita republish it as free public APIs. CPFs of partners are masked as the Receita publishes them. Personal data of individual entrepreneurs is still personal data under the LGPD: use it for a legitimate purpose and honour opt-outs. This Actor is not affiliated with the Receita Federal, the Brazilian government, OpenCNPJ or Minha Receita.

# Actor input Schema

## `cnpjs` (type: `array`):

One row per CNPJ, with the company's legal and trade names, status, opening date, legal nature, size, share capital, CNAE activities, address, phones, <b>email</b>, Simples Nacional / MEI and partners (QSA). Formatted or bare, numeric or the new alphanumeric CNPJ: <code>33.683.111/0002-80</code>, <code>00000000000191</code>, <code>12.ABC.345/01DE-35</code>. Check digits are verified: a CNPJ whose digits do not add up, or that is in no register, is a free row. When CNPJs are given, the search below is not run.

## `datasetId` (type: `string`):

Pick the dataset of another run or an import (a CRM export, a spreadsheet) and every CNPJ in its field below is looked up. Only the dataset you pick here can be read.

## `datasetField` (type: `string`):

The field of each dataset item that holds the CNPJ, as a dotted path for a nested one (<code>company.cnpj</code>). A number is read as a CNPJ whose leading zeros a spreadsheet dropped.

## `states` (type: `array`):

Search the register by state. Give at least one of states, municipalities, CNAE activities, legal natures or partners; the search runs only when no CNPJ is given above.

## `municipalities` (type: `array`):

Municipality names, case and accents aside, e.g. <code>São Paulo</code>, <code>Florianópolis</code>, or with the state for a name several states share, <code>Bom Jesus - PI</code>; or the 7-digit IBGE code (<code>3550308</code>). A name matches the municipalities so named in the states chosen above (all states when none is). A name that matches nothing is a free row.

## `cnaes` (type: `array`):

CNAE codes or words of their description in Portuguese: <code>5611-2/01</code> (restaurants), the first digits of a group or class (<code>5611</code>, <code>4781</code>), or words like <code>restaurante</code>, <code>padaria</code>, <code>odontológica</code>, <code>advocacia</code>. An entry that names more than 120 subclasses is refused as too broad.

## `cnaeScope` (type: `string`):

The company's main activity only (CNAE fiscal), or its main or any secondary activity.

## `legalNatures` (type: `array`):

Keep companies of these legal natures (natureza jurídica), as the Receita codes them: 2062 Ltda, 2135 empresário individual (MEIs are mostly here), 2305 EIRELI, 2240 sociedade simples…

## `partnerDocuments` (type: `array`):

Companies where this person or company is a partner (QSA). A CPF is searched the way the register masks it: <code>123.456.789-09</code> or <code>\***456789**</code>. A CPF or CNPJ whose check digits do not add up is a free row and is not searched. Add a state: Minha Receita warns a partner search alone tends to time out.

## `registrationStatuses` (type: `array`):

Keep companies with this status (situação cadastral). Active only by default; empty keeps every status.

## `establishmentType` (type: `string`):

Every CNPJ is one establishment: the head office (matriz) or a branch (filial).

## `companySizes` (type: `array`):

Keep companies of these sizes (porte) as the Receita records them.

## `openedFrom` (type: `string`):

Keep companies that started activity on this day or later, e.g. <code>2025-01-01</code>. The search reads every page to find them: combine it with a municipality or a CNAE.

## `openedInLastDays` (type: `integer`):

Keep companies opened in the last N days, counted from the run; 0 for no limit. New companies appear when Minha Receita loads the Receita's monthly release.

## `simplesNacional` (type: `string`):

Keep companies that opted in to Simples Nacional, or those that did not.

## `mei` (type: `string`):

Keep micro-entrepreneurs (MEI), or exclude them.

## `requirePhone` (type: `boolean`):

Keep only companies with a phone number. The search's source, Minha Receita, withholds emails, and the address and phone of individual entrepreneurs, for privacy: look a company up by CNPJ to get its email.

## `nameKeywords` (type: `array`):

Keep companies whose legal or trade name has any of these words, from the start of a word, case and accents aside: <code>sushi</code>, <code>pizzaria</code>, <code>clinica</code>.

## `onlyNew` (type: `boolean`):

Monitor mode for a search: deliver only the companies that did not match it at the previous run with the same filters. The first run reads the whole search and saves a free baseline; while Minha Receita holds the same monthly release a run reads nothing and charges nothing.

## `maxResults` (type: `integer`):

The most companies a search delivers; 0 for all. Lookups deliver every CNPJ given.

## `maxScanned` (type: `integer`):

The most establishments a search reads before stopping (it reads 1,024 a page, two seconds apart), so filters that keep few companies cannot read the whole register; 0 for no limit.

## Actor input object example

```json
{
  "cnpjs": [
    "33.683.111/0002-80",
    "00.000.000/0001-91",
    "33.000.167/0001-01"
  ],
  "datasetField": "cnpj",
  "states": [],
  "municipalities": [],
  "cnaes": [],
  "cnaeScope": "primary",
  "legalNatures": [],
  "partnerDocuments": [],
  "registrationStatuses": [
    "ATIVA"
  ],
  "establishmentType": "any",
  "companySizes": [],
  "openedFrom": "",
  "openedInLastDays": 0,
  "simplesNacional": "any",
  "mei": "any",
  "requirePhone": false,
  "nameKeywords": [],
  "onlyNew": false,
  "maxResults": 1000,
  "maxScanned": 100000
}
```

# Actor output Schema

## `companies` (type: `string`):

No description

## `summary` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "cnpjs": [
        "33.683.111/0002-80",
        "00.000.000/0001-91",
        "33.000.167/0001-01"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadyscrape/brazil-cnpj-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "cnpjs": [
        "33.683.111/0002-80",
        "00.000.000/0001-91",
        "33.000.167/0001-01",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("steadyscrape/brazil-cnpj-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "cnpjs": [
    "33.683.111/0002-80",
    "00.000.000/0001-91",
    "33.000.167/0001-01"
  ]
}' |
apify call steadyscrape/brazil-cnpj-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,steadyscrape/brazil-cnpj-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cPJuJMBMihInYzcbL/builds/55VdbCSrc8g4TZ1Dy/openapi.json
