# CNPJ Lookup & Company Search – Receita Federal (`wlubrigati/cnpj-brasil-empresas`) Actor

Consulta CNPJ em lote + busca de empresas. Bulk CNPJ lookup and Brazilian company search (CNAE, UF, city, status, size) on official Receita Federal open data, refreshed monthly. QSA partners, address, phone, e-mail, Simples/MEI. 100 CNPJs in ~1.4–4 s. $1.50/1k lookups.

- **URL**: https://apify.com/wlubrigati/cnpj-brasil-empresas.md
- **Developed by:** [William Lubrigati](https://apify.com/wlubrigati) (community)
- **Categories:** Lead generation, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 1,000 cnpj looked ups

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

## CNPJ Lookup & Company Search – Receita Federal (Consulta CNPJ em Lote)

**Bulk CNPJ lookup and Brazilian company search on the official Receita Federal CNPJ open data.** Paste a list of CNPJs and get razão social, situação cadastral, CNAE, address, phone, e-mail, Simples Nacional / MEI and, if you want, the partners (QSA). Or search Brazilian companies by CNAE, state (UF), city, status, size, opening date and share capital.

🇧🇷 **Consulta CNPJ em lote e busca de empresas** com os dados abertos oficiais da Receita Federal, atualizados todo mês. [Resumo em português ↓](#-em-português)

- ⚡ **Fast**: 15 CNPJs with partners in **~1–2.7 s** of total run time, 100 CNPJs in **~1.4–3.9 s** ([details](#speed-and-freshness)).
- 📋 **Bulk CNPJ lookup**: 14-digit CNPJs (formatted or not) or 8-digit roots (CNPJ básico), with or without branches (filiais).
- 👥 **Partners / QSA (quadro societário)** on request, at no extra cost.
- 🔎 **Company search / lead lists**: CNAE (primary or secondary, with prefixes), UF, município (name or IBGE code), situação cadastral, porte (ME, EPP), opening date, capital social, Simples / MEI, head office only, has e-mail / phone.
- 🆕 **Newly opened companies (empresas abertas recentemente)**: last N days, by CNAE and region.
- 🧱 **No third-party CNPJ APIs**: the Actor queries its own copy of the Receita files, so there are no per-CNPJ rate limits or captchas.
- 💰 **$1.50 per 1,000 lookups, $1.20 per 1,000 search results.** CNPJs that aren't found are free.

### Quick start (costs about $0.003)

Click **Start** with the prefilled input, or send this:

```json
{
  "mode": "lookup",
  "cnpjs": ["00.000.000/0001-91", "33.000.167/0001-01"]
}
```

Two companies are returned (Banco do Brasil and Petrobras head offices): 2 × $0.0015 = **$0.003**, plus Apify's standard start fee ($0.00005 per GB of memory, $0.0002 at the default 4 GB). Add `"includePartners": true` to get the QSA at the same price.

### What you can use it for

- **KYB, supplier and customer onboarding**: check situação cadastral, CNAE, address and partners for a whole list at once.
- **B2B lead generation in Brazil**: companies by segment (CNAE) and region, with phone and e-mail when registered.
- **CRM and data enrichment**: fill in razão social, nome fantasia, porte, Simples/MEI, address and phones.
- **Market research**: count and profile companies by activity, city and opening date.
- **AI agents and automations**: call it through the Apify API, integrations or MCP clients and get clean JSON.

### Input

| Field | What it does |
|---|---|
| `mode` | `lookup` (CNPJ list), `search` (filters) or `newCompanies` (opened in the last N days) |
| `cnpjs` | Lookup mode: CNPJs (14 digits, with or without punctuation) or 8-digit roots |
| `includeBranches` | For 8-digit roots: return all establishments (filiais), not only the head office |
| `includePartners` | Add the partners list (QSA). Same price |
| `cnaes`, `includeSecondaryCnae` | CNAE codes or prefixes (`6201501`, `6201`, `62`), optionally matching secondary CNAEs too |
| `ufs`, `municipios` | States (`SP`, `SC`...) and cities by name or 7-digit IBGE code |
| `situacoes`, `portes` | Status (default `ATIVA`) and size (`ME`, `EPP`, `DEMAIS`) |
| `openedFrom`, `openedTo`, `newCompaniesDays` | Opening date range, or "last N days" in newCompanies mode |
| `capitalMin`, `capitalMax`, `simples`, `mei` | Share capital range in R$, Simples Nacional / MEI filters |
| `excludeIndividuals`, `onlyHeadOffice`, `requireEmail`, `requirePhone` | Extra filters |
| `maxResults` | Cap on search results, and therefore on cost (default 1,000) |

**Search: active software companies in Joinville and Florianópolis (SC) with an e-mail, max 50 results (max $0.06):**

```json
{
  "mode": "search",
  "cnaes": ["6201", "6202", "6203", "6204"],
  "includeSecondaryCnae": true,
  "ufs": ["SC"],
  "municipios": ["Joinville", "4205407"],
  "requireEmail": true,
  "maxResults": 50
}
```

**New companies: restaurants opened in the last 30 days in São Paulo state, no MEI, max 100 (max $0.12):**

```json
{
  "mode": "newCompanies",
  "cnaes": ["5611"],
  "ufs": ["SP"],
  "newCompaniesDays": 30,
  "excludeIndividuals": true,
  "maxResults": 100
}
```

### Output

One dataset item per establishment (matriz or filial). Download as JSON, CSV, Excel, XML or HTML, or read it through the API. Real example (lookup of `00.000.000/0001-91`):

```json
{
  "cnpj": "00.000.000/0001-91",
  "cnpjNumeros": "00000000000191",
  "cnpjBasico": "00000000",
  "matrizFilial": "MATRIZ",
  "razaoSocial": "BANCO DO BRASIL SA",
  "nomeFantasia": "DIRECAO GERAL",
  "situacao": "ATIVA",
  "dataSituacao": "2005-11-03",
  "motivoSituacao": null,
  "dataAbertura": "1966-08-01",
  "cnaePrincipal": { "codigo": "6422100", "descricao": "Bancos múltiplos, com carteira comercial" },
  "cnaesSecundarios": [
    { "codigo": "6499999", "descricao": "Outras atividades de serviços financeiros não especificadas anteriormente" }
  ],
  "naturezaJuridica": { "codigo": 2038, "descricao": "Sociedade de Economia Mista" },
  "porte": "DEMAIS",
  "capitalSocial": 120000000000,
  "opcaoSimples": false,
  "opcaoMei": false,
  "logradouro": "QUADRA SAUN QUADRA 5 BLOCO B TORRE I, II, III",
  "numero": "SN",
  "bairro": "ASA NORTE",
  "cep": "70040912",
  "municipio": "Brasília",
  "municipioIbge": 5300108,
  "uf": "DF",
  "telefones": ["(61) 3493-9002"],
  "email": "secex@bb.com.br",
  "situacaoEspecial": null,
  "fonte": "Receita Federal do Brasil – Dados Abertos CNPJ (CC-BY)",
  "snapshot": "2026-10-13"
}
```

(Shortened. Every item also has `complemento`, `dataOpcaoSimples`, `dataExclusaoSimples`, `dataOpcaoMei`, `cidadeExterior` and `pais`.)

With `includePartners: true`, each item gets a `socios` array (QSA). Example entry (name made up):

```json
{ "nome": "FULANA DE TAL", "tipo": "PESSOA_FISICA", "cpfCnpj": "***274418**", "qualificacao": "Sócio",
  "dataEntrada": "2000-10-23", "pais": null, "representanteLegal": null, "faixaEtaria": "41-50" }
```

CPFs come masked by Receita. `tipo` is `PESSOA_FISICA`, `PESSOA_JURIDICA` or `ESTRANGEIRO`.

CNPJs not found in the current snapshot are listed in the run's key-value store under `NOT_FOUND` and are not charged. A `SUMMARY` record has the counts.

### Speed and freshness

Measured on Apify in October 2026 with the default 4 GB memory, total run time including Apify's container start:

| Job | Run time |
|---|---|
| 1 CNPJ | ~1.0 s (up to ~3.2 s) |
| 15 CNPJs with partners | ~1.0 s (up to ~2.7 s) |
| 100 CNPJs with partners | ~1.4 s (up to ~3.9 s) |
| 500 CNPJs, no partners | ~26–30 s |
| Search, 20 results | ~2.5 s |
| Search, 200 results | ~12 s |

The lower number is when Apify already has the Actor cached on the server; the higher one includes Apify downloading the Actor (about 1.5–2.5 s). Lookups of up to 100 CNPJs (without `includeBranches`) use a dedicated fast path. Large searches scan the full Receita dataset and take longer; more memory gives more CPU.

**Freshness:** Receita Federal publishes the CNPJ open data once a month, and each new release is loaded within a few days.&#x20;
Current snapshot: **2026-10-13**.

Every item carries its `snapshot` date. This is not a real-time query to the Receita website: changes after the snapshot date appear with the next monthly release.

### Pricing (pay per event)

| Event | Price |
|---|---|
| CNPJ looked up (each company record returned in `lookup` mode; partners included) | **$1.50 per 1,000** ($0.0015 each) |
| Company returned in `search` or `newCompanies` mode | **$1.20 per 1,000** ($0.0012 each) |
| Actor start (Apify standard) | $0.00005 per GB of memory ($0.0002 at the default 4 GB) |

- CNPJs that are not found cost nothing. With `includeBranches`, each branch returned counts as one lookup.
- No proxy or compute charges on top: you pay per result.
- Cap your spend with `maxResults` (search) or **Maximum cost per run** in Apify. The Actor stops cleanly at the limit.

### API usage

```python
from apify_client import ApifyClient
client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("wlubrigati/cnpj-brasil-empresas").call(run_input={
    "mode": "lookup", "cnpjs": ["00000000000191", "33000167000101"], "includePartners": True})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["cnpj"], item["razaoSocial"], item["situacao"])
```

Or use the synchronous endpoint `run-sync-get-dataset-items` to get the items in a single HTTP request.

### FAQ

**Is this the official Receita Federal API?** No. Receita doesn't offer a free bulk query API. This Actor serves Receita's official open data, processed for fast lookups and searches. It is not affiliated with Receita Federal.

**Can I get a company's status today?** You get the status as of the latest monthly snapshot (see `snapshot`). For legal proof of current status, use the official Comprovante de Inscrição on the Receita website.

**Why are partner CPFs masked?** Receita publishes them masked. We don't unmask or enrich personal data.

### Legal, LGPD and attribution

- Source: **Receita Federal do Brasil – Dados Abertos do CNPJ**, Creative Commons Attribution license ([dados.gov.br](https://dados.gov.br/dados/conjuntos-dados/cadastro-nacional-da-pessoa-juridica---cnpj)).
- MEI and individual-entrepreneur records can contain personal data. Use `excludeIndividuals` if you don't need them. You are responsible for a lawful basis under the LGPD (Lei 13.709/2018), especially for marketing.

***

### 🇧🇷 Em português

**Consulta CNPJ em lote e busca de empresas** com os **dados abertos oficiais da Receita Federal** (Dados Abertos do CNPJ), atualizados todo mês. O Actor consulta uma cópia própria dos arquivos da Receita: não depende de APIs de CNPJ de terceiros, sem limite de requisições por CNPJ e sem captcha.

- **Consulta de CNPJ em lote:** CNPJs de 14 dígitos (com ou sem pontuação) ou raízes de 8 dígitos (CNPJ básico), com ou sem filiais.
- **Dados retornados:** razão social, nome fantasia, situação cadastral, data de abertura, CNAE principal e secundários, natureza jurídica, porte, capital social, endereço, telefone, e-mail, Simples Nacional e MEI.
- **Quadro societário (QSA)** opcional, sem custo extra (CPF mascarado pela própria Receita).
- **Busca de empresas / listas de leads B2B:** CNAE (inclusive secundário e por prefixo), UF, município (nome ou código IBGE), situação cadastral, porte (ME, EPP), data de abertura, capital social, Simples e MEI, só matriz, com e-mail ou telefone.
- **Empresas abertas recentemente:** últimos N dias, por CNAE e região, para prospecção.
- **Rápido:** 15 CNPJs com QSA em ~1 a 2,7 s; 100 CNPJs em ~1,4 a 3,9 s.

* **Atualização:** snapshot mensal da Receita (atual: **13/10/2026**); cada registro traz o campo `snapshot`. Não é consulta em tempo real ao site da Receita.
* **Preço:** US$ 1,50 por mil CNPJs consultados e US$ 1,20 por mil empresas retornadas na busca, mais a taxa padrão de início da Apify (US$ 0,0002 com 4 GB). CNPJ não encontrado não é cobrado. Use `maxResults` ou o custo máximo por execução para limitar o gasto.
* **Teste barato:** o input pré-preenchido consulta 2 CNPJs e custa cerca de US$ 0,003.
* **LGPD:** opção para excluir MEI e empresário individual. Fonte: Receita Federal (CC-BY). Não é afiliado à Receita Federal.

# Actor input Schema

## `mode` (type: `string`):

lookup = enrich a list of CNPJs; search = find companies by filters; newCompanies = companies opened recently (by opening date) matching the filters.

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

14-digit CNPJs, formatted or not (e.g. 00.000.000/0001-91). An 8-digit root (CNPJ básico) returns the head office (matriz), or all branches if 'Include branches' is on.

## `includeBranches` (type: `boolean`):

Lookup mode: for 8-digit roots, return all establishments (filiais) instead of only the head office.

## `includePartners` (type: `boolean`):

Add the partners/administrators list (quadro societário). Off by default because it roughly doubles run time on large batches. CPFs come masked by Receita Federal.

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

CNAE codes or prefixes (digits only), e.g. 6201501 (exact subclass) or 6201 (all subclasses of class 6201) or 62 (division).

## `includeSecondaryCnae` (type: `boolean`):

Also match companies that have the CNAE as a secondary activity.

## `ufs` (type: `array`):

Two-letter codes, e.g. SP, SC. Empty = all states.

## `municipios` (type: `array`):

Names (e.g. Joinville, São Paulo) or 7-digit IBGE codes (e.g. 4209102). Combine with UF to disambiguate names.

## `situacoes` (type: `array`):

Default: ATIVA only.

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

ME = microempresa, EPP = empresa de pequeno porte, DEMAIS = others, NAO_INFORMADO.

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

Opening date (data de início de atividade) on or after.

## `openedTo` (type: `string`):

Opening date on or before.

## `newCompaniesDays` (type: `integer`):

Counted back from the dataset snapshot date (Receita publishes monthly).

## `capitalMin` (type: `integer`):

Capital social at or above.

## `capitalMax` (type: `integer`):

Capital social at or below.

## `simples` (type: `string`):

Filter by current Simples Nacional option.

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

Filter by current MEI option.

## `excludeIndividuals` (type: `boolean`):

Drop MEIs and 'Empresário Individual' records, whose data usually identifies a natural person.

## `onlyHeadOffice` (type: `boolean`):

Skip branches (filiais).

## `requireEmail` (type: `boolean`):

Keep only records with a registered e-mail.

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

Keep only records with a registered phone.

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

Upper bound of companies returned (and charged) in search/newCompanies modes.

## Actor input object example

```json
{
  "mode": "lookup",
  "cnpjs": [
    "00.000.000/0001-91",
    "33.000.167/0001-01"
  ],
  "includeBranches": false,
  "includePartners": false,
  "includeSecondaryCnae": false,
  "situacoes": [
    "ATIVA"
  ],
  "newCompaniesDays": 30,
  "simples": "any",
  "mei": "any",
  "excludeIndividuals": false,
  "onlyHeadOffice": false,
  "requireEmail": false,
  "requirePhone": false,
  "maxResults": 1000
}
```

# Actor output Schema

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

One item per establishment (matriz/filial) with Receita Federal registry data, plus partners (socios) when includePartners is on.

## `notFound` (type: `string`):

JSON list of input CNPJs not present in the current Receita snapshot (not charged).

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

Mode, number of results, run seconds and the Receita snapshot date.

# 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": [
        "00.000.000/0001-91",
        "33.000.167/0001-01"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("wlubrigati/cnpj-brasil-empresas").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": [
        "00.000.000/0001-91",
        "33.000.167/0001-01",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("wlubrigati/cnpj-brasil-empresas").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": [
    "00.000.000/0001-91",
    "33.000.167/0001-01"
  ]
}' |
apify call wlubrigati/cnpj-brasil-empresas --silent --output-dataset

```

## MCP server setup

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

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/bwtCAoUeOQv36myTa/builds/Nf0gghH0j3KQcVk7B/openapi.json
