# CNPJ Lookup - Consulta CNPJ em Lote & Brazil Company Leads (`kalilfagundes.w/cnpj-enrichment`) Actor

\[Limited Launch Offer $4/1K] Bulk CNPJ lookup and Brazil B2B leads by CNAE, city and state from Receita Federal open data: status, CNAE, partners (QSA), address, phones, Simples/MEI. No API key.

- **URL**: https://apify.com/kalilfagundes.w/cnpj-enrichment.md
- **Developed by:** [Scrape With Me](https://apify.com/kalilfagundes.w) (community)
- **Categories:** Lead generation, Business
- **Stats:** 2 total users, 1 monthly users, 33.3% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.40 / 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.
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

## CNPJ Lookup - Consulta CNPJ em Lote & Brazil Company Leads

**EN:** Look up any number of **Brazilian CNPJs** in one run, or **find companies by activity (CNAE), city and state** to build B2B lead lists. Every row is the official **Receita Federal** company record: company and trade name, status (ATIVA, BAIXADA...), opening date, main and secondary CNAEs, legal nature, size (porte), share capital, **Simples Nacional / MEI**, full address, **phones**, and the **partners and administrators (QSA)**. No API key, no login, no browser.

**PT:** **Consulta CNPJ em lote** e **lista de empresas por CNAE, cidade e UF** para prospecção B2B. Dados oficiais da Receita Federal (dados abertos do CNPJ): razão social, nome fantasia, situação cadastral, data de abertura, CNAE principal e secundários, natureza jurídica, porte, capital social, Simples / MEI, endereço completo, telefones e quadro societário (QSA).

**ES:** Consulta de **CNPJ** (empresas de Brasil) en lote y búsqueda de empresas por **CNAE, ciudad y estado**, con datos oficiales de la Receita Federal.

### Bulk CNPJ lookup (consulta CNPJ em lote) and Brazil company leads by CNAE, city and state

- **Bulk CNPJ lookup / enrichment** – paste a list of CNPJs (any format: `33.000.167/0001-01` or `33000167000101`). Invalid CNPJs are caught by the check digits before any request.
- **Lead search** – all companies with a CNAE in a city or state, e.g. software houses (6201-5/01) in Florianópolis or restaurants (5611-2/01) in São Paulo. Combine states, cities (name or IBGE code), CNAEs (main or also secondary) and legal nature (e.g. 2062 Ltda, 2135 MEI / empresário individual).
- **Lead filters** – active companies only (default), head offices only, only companies with a phone.
- **Flat output** – one row per company, phones in E.164 (`+55...`), CNAE codes raw and formatted, address split into fields and in one line: ready for CSV / Excel / CRM import.

### Input examples

Bulk lookup:

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

Lead search (software companies in Florianópolis with a phone):

```json
{
  "cities": ["Florianópolis/SC"],
  "cnaes": ["6201-5/01"],
  "activeOnly": true,
  "withPhoneOnly": true,
  "maxItems": 500
}
```

### CNPJ data fields (Receita Federal) - output example

```json
{
  "cnpj": "00000000000191",
  "cnpjFormatted": "00.000.000/0001-91",
  "companyName": "BANCO DO BRASIL SA",
  "tradeName": "DIRECAO GERAL",
  "status": "ATIVA",
  "isHeadOffice": true,
  "openingDate": "1966-08-01",
  "mainCnaeFormatted": "6422-1/00",
  "mainCnaeDescription": "Bancos múltiplos, com carteira comercial",
  "secondaryCnaes": [{ "code": "6499999", "codeFormatted": "6499-9/99", "description": "Outras atividades de serviços financeiros não especificadas anteriormente" }],
  "legalNature": "Sociedade de Economia Mista",
  "companySize": "DEMAIS",
  "shareCapital": 120000000000.0,
  "simplesNacional": false,
  "mei": false,
  "phones": ["+556134939002"],
  "neighborhood": "ASA NORTE",
  "zipCode": "70040912",
  "city": "BRASILIA",
  "state": "DF",
  "partnersCount": 41,
  "partners": [{ "name": "ALAN CARLOS GUEDES DE OLIVEIRA", "type": "person", "role": "Diretor", "since": "2023-05-17", "ageRange": "Entre 41 a 50 anos" }],
  "source": "brasilapi",
  "scrapedAt": "2026-10-09T00:44:59Z"
}
```

The run summary (looked up, not found, invalid, scanned, filtered out, saved) is saved as the `OUTPUT` record of the key-value store; problems such as invalid CNPJs or unknown cities go to the `ERRORS` record. `cityResolution` reports the city reference used, its date, whether a live lookup was attempted and how many names could not be resolved.

City names use IBGE's official territorial reference dated December 31, 2025, including Boa Esperança do Norte. Known names work even when the live municipality API is unavailable. A name absent from the reference is checked against the live IBGE list. If that check is unavailable, the error says the city could not be resolved; it does not claim the city does not exist. Use a 7-digit IBGE code for a newly created or renamed municipality, or retry the name later. Company records still come from the CNPJ data sources described below.

### Run it on a schedule and connect it to your tools

**Schedule:** in Apify Console open *Schedules → Create*, pick this actor and your input, and set it to run
on the 1st of every month (the Receita publishes its open data monthly) to re-check the status, partners and phones of your customer, supplier or lead list. Each run returns the full, current result set as a new dataset.

**Integrations** (Actor → *Integrations* tab, no code):

- **Google Sheets** — send every run's rows to a sheet: one row per company, ready for filters and pivot tables.
- **Make, Zapier, n8n** — start the actor from a scenario/zap/workflow (for example when a CNPJ is added to your CRM) and write the enriched company data back in the next step.
- **Webhook** — get a POST to your endpoint when a run succeeds, then download the dataset.
- **Slack / email** — notify your team when a scheduled run finishes.

**AI agents (MCP)** — Claude, ChatGPT, Cursor, VS Code or any MCP client can run it as a tool: add the Apify MCP
server `https://mcp.apify.com?actors=kalilfagundes.w/cnpj-enrichment` (sign in with your Apify account) and ask for the data in
plain language, e.g. "look up these CNPJs and tell me which companies are ATIVA". The agent fills the input from the input schema and reads the dataset back.

**API** — call it from your code (`pip install apify-client` / `npm i apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("kalilfagundes.w/cnpj-enrichment").call(run_input={
    "cnpjs": [
        "33.000.167/0001-01",
        "00.000.000/0001-91"
    ],
    "includePartners": True,
    "maxItems": 100
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["cnpjFormatted"], item["companyName"], item["status"])
```

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

const client = new ApifyClient({ token: '<YOUR_APIFY_TOKEN>' });
const run = await client.actor('kalilfagundes.w/cnpj-enrichment').call({
  "cnpjs": [
    "33.000.167/0001-01",
    "00.000.000/0001-91"
  ],
  "includePartners": true,
  "maxItems": 100
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Pricing

Launch offer: **$4 per 1,000 companies** + $0.002 per run (cheaper on higher Apify plans). Pay per result: you pay for the companies saved to the dataset, nothing for invalid CNPJs or for companies dropped by your filters. Use **Max companies** to cap the cost of a search.

### FAQ / limits

- **Where does the data come from?** From the Receita Federal open CNPJ data (dados abertos), updated monthly by the Receita. A company opened or changed in the last weeks may not show the change yet.
- **E-mails?** The open data published by the Receita does not include e-mails, so `email` is almost always empty. Phones are included when the company registered them.
- **Partners' CPF** comes masked from the Receita (`***123456**`); this actor does not unmask it.
- **City names** – write `City/UF` when the name exists in several states (e.g. `Boa Vista/RR`), or use the 7-digit IBGE code. When you also give states, they are used to pick the right city.
- **Big searches** – a whole state can hold hundreds of thousands of companies; add a city or CNAE to get to the right ones faster.
- Questions or a missing field? Open an issue on the actor page – feedback shapes the next version.

### Related actors

- [Zap Imóveis, VivaReal & QuintoAndar Scraper - Imóveis Brasil](https://apify.com/kalilfagundes.w/imoveis-brasil-scraper)
- [Indeed & LinkedIn Jobs Scraper - Glassdoor, Naukri, Bayt](https://apify.com/kalilfagundes.w/job-boards-scraper)
- [Meta Ads Library Scraper - Facebook & Instagram Ads](https://apify.com/kalilfagundes.w/facebook-instagram-meta-ads-library-scraper)

# Actor input Schema

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

Brazilian company tax IDs, with or without punctuation (33.000.167/0001-01 or 33000167000101). Each one returns the full Receita Federal record. Leave empty to only search.

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

Find companies in these states, e.g. SP, RJ, SC.

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

City names ("Florianópolis", "Campinas/SP") or IBGE codes (4205407). Add "/UF" when the name exists in several states.

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

Activity codes, e.g. 6201-5/01 (software development) or 5611201 (restaurants).

## `includeSecondaryCnaes` (type: `boolean`):

Also find companies that list the CNAE as a secondary activity (not only the main one).

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

Optional natureza jurídica codes, e.g. 2062 (Ltda), 2135 (empresário individual / MEI), 2054 (S.A. fechada).

## `activeOnly` (type: `boolean`):

Search results: keep only companies with status ATIVA.

## `headOfficeOnly` (type: `boolean`):

Skip branches (filiais).

## `withPhoneOnly` (type: `boolean`):

Skip companies without a phone number.

## `applyFiltersToLookups` (type: `boolean`):

By default every CNPJ you list is returned. Turn on to drop the ones that fail the filters above.

## `includeNotFound` (type: `boolean`):

Add a row with status NOT FOUND for valid CNPJs the Receita does not know.

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

Include the partners / administrators list (quadro societário).

## `includeTaxRegime` (type: `boolean`):

Include the yearly tax regime (Lucro Real / Presumido / Arbitrado) when published.

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

Stop after saving this many companies. 0 = no limit.

## Actor input object example

```json
{
  "cnpjs": [
    "33.000.167/0001-01",
    "00.000.000/0001-91"
  ],
  "cities": [
    "Florianópolis/SC"
  ],
  "cnaes": [
    "6201-5/01"
  ],
  "includeSecondaryCnaes": false,
  "activeOnly": true,
  "headOfficeOnly": false,
  "withPhoneOnly": false,
  "applyFiltersToLookups": false,
  "includeNotFound": false,
  "includePartners": true,
  "includeTaxRegime": false,
  "maxItems": 20
}
```

# Actor output Schema

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

No description

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

OUTPUT record: looked up, not found, invalid, scanned, filtered out, saved, errors.

# 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.000.167/0001-01",
        "00.000.000/0001-91"
    ],
    "cities": [
        "Florianópolis/SC"
    ],
    "cnaes": [
        "6201-5/01"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("kalilfagundes.w/cnpj-enrichment").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.000.167/0001-01",
        "00.000.000/0001-91",
    ],
    "cities": ["Florianópolis/SC"],
    "cnaes": ["6201-5/01"],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("kalilfagundes.w/cnpj-enrichment").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.000.167/0001-01",
    "00.000.000/0001-91"
  ],
  "cities": [
    "Florianópolis/SC"
  ],
  "cnaes": [
    "6201-5/01"
  ],
  "maxItems": 20
}' |
apify call kalilfagundes.w/cnpj-enrichment --silent --output-dataset

```

## MCP server setup

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

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/Qzf85414OHoC4omyn/builds/FVuvosn0I3FvPL3LT/openapi.json
