# CNPJ Lookup in Bulk – Brazil Company Data (Receita Federal) (`gazidev/brazil-cnpj-lookup`) Actor

Bulk CNPJ lookup (consulta CNPJ em massa) from the Receita Federal open data: legal and trade name, status, opening date, CNAE, address, legal nature, share capital, Simples/MEI and partners (QSA). Check digits validated locally; invalid CNPJs are free.

- **URL**: https://apify.com/gazidev/brazil-cnpj-lookup.md
- **Developed by:** [Cemal Atakli](https://apify.com/gazidev) (community)
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 1,000 company founds

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 in Bulk – Brazil Company Data (Receita Federal)

**Consulta CNPJ em massa.** Paste a list of Brazilian CNPJ numbers and get **one clean row per company** from the **Receita Federal open CNPJ data**:

- **Identity:** legal name (razão social), trade name (nome fantasia), head office or branch (matriz/filial).
- **Status:** registration status (situação cadastral: ATIVA, BAIXADA, INAPTA, SUSPENSA, NULA), with an English label, status date and reason, and special status.
- **Company profile:** opening date (início de atividade), legal nature (natureza jurídica), size (porte) and share capital (capital social).
- **Activities:** primary **CNAE** with description, plus every secondary CNAE.
- **Address and contact:** full address (street, number, complement, district, city, IBGE code, UF, CEP) and the phones as published.
- **Tax regime:** **Simples Nacional** and **MEI** flags with dates, and the tax regime history (Lucro Real / Presumido…).
- **Partners (quadro societário / QSA):** name, role, entry date, age range and the masked CPF/CNPJ, exactly as the Receita publishes them.

**$0.40 per 1,000 companies.** Check digits are validated locally before any request, so **invalid CNPJs cost nothing**, and **CNPJs that are not found are free too**.

> 🇧🇷 **Em português:** consulte milhares de CNPJs de uma vez. Para cada empresa você recebe razão social, nome fantasia, situação cadastral, data de abertura, CNAE principal e secundários, endereço completo, natureza jurídica, porte, capital social, opção pelo Simples/MEI e o quadro societário (QSA). Os dados vêm dos **dados abertos da Receita Federal**. CNPJs inválidos (dígito verificador errado) e não encontrados **não são cobrados**. O preço é US$ 0,40 por 1.000 empresas.

### Use cases

- **KYC / KYB and onboarding:** confirm that a supplier or customer CNPJ is **ATIVA** before you sign or pay them.
- **Lead enrichment / prospecção B2B:** add CNAE, size, city and capital to a CRM list, then segment by sector and region.
- **Accounting and fiscal checks:** check Simples Nacional / MEI status in bulk, and flag BAIXADA or INAPTA suppliers.
- **Due diligence and compliance:** list partners and administrators (QSA) and find related companies.
- **Data cleaning:** normalise and validate messy CNPJ columns from spreadsheets (formatted, unformatted, or missing leading zeros).

### Input

| Field | Description |
|---|---|
| `cnpjs` | List of CNPJs in any format (`33.000.167/0001-01`, `33000167000101`). It accepts the new **alphanumeric CNPJ** (2026+). |
| `bulkText` | Paste a whole column or CSV. Every CNPJ-looking value is picked up. |
| `datasetId` / `datasetField` | Read CNPJs from another Actor's dataset (chaining). |
| `maxItems` | Cap on valid CNPJs looked up (0 = all). Duplicates are removed first. |
| `includePartners` | Partners (QSA) on or off. Default on. |
| `includeRaw` | Add the untouched source JSON (Portuguese field names). |
| `sources`, `requestsPerSecond`, `maxConcurrency`, `timeoutSecs` | Advanced: fallback order and polite rate limits. |

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

### Output

One row per input. Shortened example (Petrobras):

```json
{
  "input": "33.000.167/0001-01",
  "cnpj": "33000167000101",
  "cnpjFormatted": "33.000.167/0001-01",
  "valid": true,
  "found": true,
  "lookupStatus": "found",
  "legalName": "PETROLEO BRASILEIRO S A PETROBRAS",
  "tradeName": "PETROBRAS - EDISE",
  "headOffice": true,
  "status": "ATIVA",
  "statusEn": "ACTIVE",
  "statusDate": "2005-11-03",
  "openingDate": "1966-09-28",
  "legalNature": { "code": 2038, "description": "Sociedade de Economia Mista" },
  "size": { "code": 5, "description": "DEMAIS", "en": "OTHER" },
  "shareCapital": 205431960000,
  "mainCnae": { "code": "0600001", "description": "Extração de petróleo e gás natural" },
  "secondaryCnaes": [{ "code": "1921700", "description": "Fabricação de produtos do refino de petróleo" }],
  "address": { "streetType": "AVENIDA", "street": "REPUBLICA DO CHILE", "number": "65", "district": "CENTRO",
               "city": "RIO DE JANEIRO", "cityIbgeCode": 3304557, "state": "RJ", "zip": "20031-170" },
  "addressFull": "AVENIDA REPUBLICA DO CHILE, 65, CENTRO, RIO DE JANEIRO - RJ, 20031-170",
  "phones": ["(21) 2166-0000"],
  "simples": { "opted": null, "since": null, "excludedOn": null },
  "mei": { "opted": null, "since": null, "excludedOn": null },
  "taxRegime": [{ "year": 2024, "regime": "LUCRO REAL" }],
  "partnerCount": 8,
  "partners": [{ "name": "…", "type": "person", "document": "***912137**", "role": "Diretor",
                 "since": "2025-07-29", "ageRange": "Entre 71 a 80 anos" }],
  "source": "minhareceita",
  "fetchedAt": "2026-10-01T08:55:04+00:00"
}
```

Invalid and not-found inputs are returned as rows too, so your list keeps its length and you can see what to fix:

```json
{ "input": "33.000.167/0001-02", "valid": false, "found": false, "lookupStatus": "invalid",
  "error": "Invalid CNPJ: check digits do not match" }
```

`lookupStatus` is one of `found`, `not_found`, `invalid` or `error`. The Output tab has four views: **Companies**, **Partners (QSA)**, **Address & CNAEs** and **Lookup status**. You can export everything as JSON, CSV or Excel.

### Pricing

Pay per event. You pay only for results and there is no subscription.

| Event | Price |
|---|---|
| Company found | **$0.0004** ($0.40 per 1,000) |
| Invalid CNPJ (check digit fails) | free |
| CNPJ not found / lookup failed | free |

Set a *Maximum cost per run* and the Actor stops cleanly when it is reached. It never starts a lookup it cannot charge for.

#### Compared with other Apify Store actors (per 1,000 CNPJs, Oct 2026)

| Actor | Price / 1,000 |
|---|---|
| **This Actor** | **$0.40** (invalid and not-found free) |
| jungle_synthesizer/brazil-cnpj-receita-federal-crawler | $2.00 |
| johnatan029/cnpj-empresas-brasil-scraper | $1.50 |
| memo23/cnpj-scraper | $1.00 |
| epicscrapers/brazil-cnpj-scraper | $0.90 |

### Data sources and attribution

The data is **public open government data**: the Receita Federal CNPJ register (*Cadastro Nacional da Pessoa Jurídica*). It is published under Brazil's open-data policy (Decree 8.777/2016) and the Access to Information Law (Lei 12.527/2011).

The Actor reads it through a free, keyless, open-source mirror:

1. **[Minha Receita](https://minhareceita.org)** (primary, open source, MIT). Thanks to the project and its contributors. Please consider [supporting it](https://docs.minhareceita.org).

Requests are throttled to 2 per second by default. On 429 the Actor backs off and honours `Retry-After`. Retries use jittered backoff. The data is as fresh as the latest monthly Receita Federal release loaded by the mirrors.

### Personal data and LGPD

Some fields are personal data published by the government: partner names, age range, masked CPF, and the owner's name inside sole-proprietor/MEI company names. **You are responsible for using these fields in compliance with the LGPD (Lei 13.709/2018).** That means having a legal basis such as legitimate interest for B2B, KYC or compliance purposes, minimising data and honouring data-subject rights. If you do not need partners, set `includePartners` to `false`. The Actor stores nothing beyond your own run's dataset.

### Use with AI agents (Apify MCP)

This Actor works as a tool for AI agents such as Claude, ChatGPT, Cursor and LangChain through the **Apify MCP server** (`https://mcp.apify.com`). An agent calls it with `{"cnpjs": [...]}` and gets typed JSON with English keys and explicit `lookupStatus`, so it can answer questions like these:

- "Is the supplier 12.345.678/0001-95 still active, and is it in the Simples Nacional?"
- "Who are the administrators of Magazine Luiza and when did they join?"
- "Which of these 500 CNPJs are BAIXADA or INAPTA?"

API (sync, for small lists): `POST https://api.apify.com/v2/acts/gazidev~brazil-cnpj-lookup/run-sync-get-dataset-items?token=…` with the input JSON.

### FAQ

**How is the CNPJ validated?** The Actor uses the official mod-11 check-digit algorithm, including the new alphanumeric format (letters in the first 12 positions, from July 2026). Wrong length, repeated digits like `11.111.111/1111-11`, or a wrong check digit give `lookupStatus: "invalid"`. No request is made and nothing is charged.

**My spreadsheet removed the leading zeros.** Purely numeric values with 8–13 digits are padded back to 14 digits before validation (e.g. Caixa `360305000104` → `00.360.305/0001-04`).

**Why is a valid CNPJ "not found"?** Very new companies can be missing until the next monthly open-data release. New alphanumeric CNPJs appear once the mirrors load them. Not-found rows are free.

**Why is the email empty?** The Receita Federal open data no longer publishes most company emails, so the field is usually `null`. Phones are returned as published.

**Can I search by CNAE or city instead of CNPJ?** Not yet. This Actor looks up known CNPJs.

**How fast is it?** About 2 CNPJs per second (7,000/hour) at the default polite rate, on 256 MB. The 3-CNPJ example finishes in a few seconds.

### Related Actors by gazidev

- [Phone Number Validator & Formatter](https://apify.com/gazidev/phone-validator): validate and format the phones you get here.
- [Website Contact Finder](https://apify.com/gazidev/website-contact-finder): find emails and social profiles for company websites.
- [Domain Checker – WHOIS/RDAP, DNS, SSL](https://apify.com/gazidev/domain-intel): check company domains (.com.br via RDAP).

# Actor input Schema

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

CNPJ numbers in any format: `33.000.167/0001-01` or `33000167000101`. Numbers that lost their leading zeros in Excel are padded back when they still have 8+ digits. The new alphanumeric CNPJ format (2026+) is accepted. Check digits are validated before any request; invalid CNPJs are reported and never charged.

## `bulkText` (type: `string`):

Paste a long list: one CNPJ per line, or a whole CSV/spreadsheet export. Every CNPJ-looking value is picked up (formatted or not).

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

Optional: ID of an Apify dataset (e.g. the output of another Actor run) to read CNPJs from. Useful for chaining Actors.

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

Name of the field holding the CNPJ in that dataset.

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

Look up at most this many valid CNPJs (0 = no limit). Duplicates are removed first.

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

Add the partner / administrator list (quadro societário) exactly as published by the Receita Federal: name, role, entry date, age range and the masked CPF. Turn off if you do not need personal data.

## `includeRaw` (type: `boolean`):

Add the untouched JSON from the source (Portuguese field names) in a `raw` field.

## `sources` (type: `array`):

Keyless open-data mirror to query. Currently `minhareceita` (MIT, open source).

## `requestsPerSecond` (type: `integer`):

Polite rate limit for each source. These are free community services, so keep it low.

## `maxConcurrency` (type: `integer`):

CNPJs processed in parallel (the per-source rate limit still applies).

## `timeoutSecs` (type: `integer`):

Timeout for each HTTP request before falling back to the next source.

## Actor input object example

```json
{
  "cnpjs": [
    "33.000.167/0001-01",
    "00.000.000/0001-91",
    "47.960.950/0001-21"
  ],
  "datasetField": "cnpj",
  "maxItems": 0,
  "includePartners": true,
  "includeRaw": false,
  "sources": [
    "minhareceita"
  ],
  "requestsPerSecond": 2,
  "maxConcurrency": 4,
  "timeoutSecs": 15
}
```

# Actor output Schema

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

No description

## `partners` (type: `string`):

No description

## `results` (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.000.167/0001-01",
        "00.000.000/0001-91",
        "47.960.950/0001-21"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("gazidev/brazil-cnpj-lookup").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",
        "47.960.950/0001-21",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("gazidev/brazil-cnpj-lookup").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",
    "47.960.950/0001-21"
  ]
}' |
apify call gazidev/brazil-cnpj-lookup --silent --output-dataset

```

## MCP server setup

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

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/91H9t4uNgraZwi90u/builds/bNPwJr8NQNRnIxGZg/openapi.json
