# Brazil CNPJ Leads Scraper: Empresas by CNAE, Receita Federal (`actorfactory/brazil-cnpj-leads`) Actor

CNPJ scraper that builds lead lists (lista de empresas) of Brazilian companies by CNAE code, state (UF) and city from open Receita Federal CNPJ data: legal name, trade name, size, address, phones, email and corporate partners. Look up lists of CNPJs too. MEI and personal data excluded.

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

## Pricing

from $2.80 / 1,000 company lead (search result)s

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 Leads Scraper: Empresas by CNAE, Receita Federal

This **CNPJ scraper** builds lead lists (**lista de empresas**) of **Brazilian companies (empresas) by industry (CNAE), state and city**, straight from the open **Receita Federal CNPJ data** (served by the open minhareceita.org API), with no API key and no login. Pick a CNAE code such as `6201501` (software development), a city such as São Paulo, and get active companies with legal name, trade name, size, legal form, share capital, opening date, secondary activities, full address, phones and corporate partners. You can also add a list of CNPJs to look up.

Built for Brazilian B2B sales teams, market mapping ("every restaurant opened in Curitiba since 2024") and data enrichment.

### What CNPJ data you get

| Field | Description |
|---|---|
| `cnpj` | 14-digit CNPJ |
| `razao_social`, `nome_fantasia` | Legal and trade name (null for sole-proprietor/MEI businesses) |
| `situacao_cadastral` | ATIVA, BAIXADA, INAPTA, SUSPENSA, NULA |
| `data_abertura` | Start of activity (YYYY-MM-DD) |
| `matriz_filial`, `porte`, `natureza_juridica`, `capital_social` | Head office or branch, size, legal form, share capital (BRL) |
| `opcao_simples`, `opcao_mei` | Tax-regime flags |
| `cnae_principal_codigo/descricao`, `cnaes_secundarios` | Main and secondary activities |
| `logradouro`, `numero`, `complemento`, `bairro`, `cep`, `municipio`, `municipio_ibge`, `uf` | Address |
| `phones`, `email` | Company contacts as published by the register (the open data currently carries phones; email is usually empty) |
| `partners_count`, `partner_companies` | Number of partners, and corporate (legal-entity) partners only |
| `natural_person_business` | True for MEI, Empresário Individual and EIRELI |
| `url`, `scraped_at` | Source record and collection time |

### How to find Brazilian companies by CNAE

| Input | Description |
|---|---|
| `cnaeCodes` | 7-digit CNAE codes, e.g. `6201501` or `6201-5/01`. Matches main or secondary activity |
| `primaryCnaeOnly` | Match the main activity only |
| `cities` | City names (Portuguese) or IBGE codes; add the state to disambiguate: `Santa Cruz, RN` |
| `states` | Two-letter state codes. Searching a whole state works but is slower and can be throttled by the source; prefer cities |
| `portes`, `openedSince` | Company size and opening-date filters |
| `includeInactive`, `includeMei` | Both off by default |
| `cnpjs` | Optional extra CNPJ lookups |
| `maxItems` | Result cap |

### Output example

```json
{
  "cnpj": "19138940000170",
  "razao_social": "SPREAD SISTEMAS E AUTOMACAO LTDA",
  "nome_fantasia": null,
  "natural_person_business": false,
  "situacao_cadastral": "ATIVA",
  "data_abertura": "1984-04-05",
  "matriz_filial": "MATRIZ",
  "porte": "DEMAIS",
  "natureza_juridica": "Sociedade Empresária Limitada",
  "capital_social": 15565222,
  "cnae_principal_codigo": 6201501,
  "cnae_principal_descricao": "Desenvolvimento de programas de computador sob encomenda",
  "logradouro": "RUA DR FERNANDES COELHO",
  "numero": "64",
  "bairro": "PINHEIROS",
  "cep": "05423911",
  "municipio": "SAO PAULO",
  "uf": "SP",
  "phones": ["1138746000"],
  "email": null,
  "partners_count": 3,
  "partner_companies": [{ "name": "SPREAD PARTICIPACOES S.A.", "cnpj": null, "role": "Sócio" }],
  "url": "https://minhareceita.org/19138940000170",
  "scraped_at": "2026-11-14T18:48:20.956Z"
}
```

### How much does it cost to export CNPJ leads?

Pay per event: a small start fee, plus a price per company lead (search result) and a lower price per CNPJ lookup. Volume tiers apply automatically.

### Use cases

- Sales prospecting by industry and city (CNAE + município).
- New-business feeds: schedule a run with `openedSince`.
- Market sizing and competitor mapping.
- Enriching a list of CNPJs.

### Limits & notes

- **Privacy:** MEI, Empresário Individual and EIRELI records belong to individuals and are excluded by default. If you include them, their name, phones and email are withheld. Names of individual partners are never output; only corporate partners.
- The source search cannot filter by status, size or date, so the actor filters while paging. Rare combinations in big cities may scan many records; scans stop at 60,000 rows.
- The open source throttles expensive searches ("busca muito custosa"). The actor waits and retries up to about 4 minutes, then returns what it has with a note in `OUTPUT`.
- Data is the public Receita Federal register and is only as current as the latest monthly dump.
- **Source and availability:** the data is served by [Minha Receita](https://minhareceita.org), a free, open-source, donation-funded API with no service-level guarantee. Its search by CNAE and city is still marked as in testing, so searches can be slow or temporarily unavailable at busy times. CNPJ lookups are the most stable part.

### Integrations and API

Run it from your own code with the [Apify API](https://docs.apify.com/api/v2) or the official Python and JavaScript clients:

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("actorfactory/brazil-cnpj-leads").call(run_input={'cnaeCodes': ['6201501'], 'states': ['SP'], 'cities': ['São Paulo'], 'maxItems': 10})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

- **Schedule it** (hourly, daily, weekly) in Apify Console and send results to Google Sheets, Slack, email or a webhook, or connect it to Make, Zapier or n8n.
- **Use it from AI agents** (Claude, ChatGPT, Cursor) through the [Apify MCP server](https://mcp.apify.com).
- **Export** results as JSON, CSV, Excel or HTML from the Output tab, or read them from the dataset API.

### Related Actors

- [UK Companies House Scraper](https://apify.com/actorfactory/companies-house): UK company register: new companies, search, filings
- [French Companies Scraper](https://apify.com/actorfactory/french-companies): French SIRENE register by activity code and location
- [Company Hiring Signals](https://apify.com/actorfactory/company-hiring-signals): open roles by team and location for a list of companies

### FAQ

**Can I build a lista de empresas by city?** Yes. Pick a CNAE code, a state and a city and export the active companies as CSV, Excel or JSON.

**Can I search all of Brazil for one CNAE?** No. Add a state or, better, a city.

**Is this legal?** The data is public under Brazil's access-to-information law. Respect LGPD when contacting people.

**Does it include phone numbers and email?** Yes, when the company registered them with Receita Federal: phones and a company email. The email is empty for natural-person businesses, and partner names of individuals are never output.

# Actor input Schema

## `cnaeCodes` (type: `array`):

7-digit CNAE activity codes, one per line (punctuation is fine): 6201501 or 6201-5/01 (software development), 5611201 (restaurants), 4711301 (supermarkets). A company matches if the code is its main or a secondary activity.

## `primaryCnaeOnly` (type: `boolean`):

Only match the CNAE as the company's main activity, not as a secondary one.

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

Two-letter state codes. Ignored for the search when cities are given (cities already imply the state), except to disambiguate city names.

## `cities` (type: `array`):

City names in Portuguese, e.g. São Paulo, Curitiba, or the 7-digit IBGE code. Add a state to a name to disambiguate: "Santa Cruz, RN". City searches are far faster and more reliable than whole-state searches.

## `portes` (type: `array`):

Empty = any size.

## `openedSince` (type: `string`):

Only companies that started activity on or after this date (YYYY-MM-DD). Handy for new-business leads.

## `includeInactive` (type: `boolean`):

Off = only registrations with status ATIVA. On also returns BAIXADA, INAPTA, SUSPENSA and NULA.

## `includeMei` (type: `boolean`):

Off by default: MEI, Empresário Individual and EIRELI records belong to individuals. When on, they are returned without name, phone or email.

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

14-digit CNPJs, one per line, looked up in addition to the search. Same privacy rules apply.

## `maxItems` (type: `integer`):

Stop after this many companies. You are charged per company saved.

## Actor input object example

```json
{
  "cnaeCodes": [
    "6201501"
  ],
  "primaryCnaeOnly": false,
  "states": [
    "SP"
  ],
  "cities": [
    "São Paulo"
  ],
  "includeInactive": false,
  "includeMei": false,
  "maxItems": 10
}
```

# Actor output Schema

## `results` (type: `string`):

The scraped items in the default dataset.

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

Counts, stop reason and non-fatal errors for this run (OUTPUT record).

# 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 = {
    "cnaeCodes": [
        "6201501"
    ],
    "states": [
        "SP"
    ],
    "cities": [
        "São Paulo"
    ],
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("actorfactory/brazil-cnpj-leads").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 = {
    "cnaeCodes": ["6201501"],
    "states": ["SP"],
    "cities": ["São Paulo"],
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("actorfactory/brazil-cnpj-leads").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 '{
  "cnaeCodes": [
    "6201501"
  ],
  "states": [
    "SP"
  ],
  "cities": [
    "São Paulo"
  ],
  "maxItems": 10
}' |
apify call actorfactory/brazil-cnpj-leads --silent --output-dataset

```

## MCP server setup

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

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/VmPJI8mzUanqYlsh1/builds/zDpHTq5ED6Us2wfFa/openapi.json
