# Brazil CNPJ Lookup: Consulta CNPJ em Lote (Receita Federal) (`itayozer9/brazil-cnpj-lookup`) Actor

Bulk CNPJ lookup from Receita Federal open data: legal and trade name, status, opening date, CNAE codes, legal nature, size, capital, address, Simples Nacional and MEI flags, tax regime. No personal data. Pay per company found.

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

## Pricing

from $0.80 / 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

## Brazil CNPJ Lookup: Consulta CNPJ em Lote (Receita Federal)

Paste a list of Brazilian CNPJ numbers and get one clean company record per CNPJ: legal name (razao social), trade name (nome fantasia), registration status (situacao cadastral), opening date, main and secondary CNAE codes, legal nature, company size, share capital, address, Simples Nacional and MEI flags, and the yearly tax regime where published.

Made for checking suppliers and customers, cleaning a CRM, KYB and onboarding checks, enriching a spreadsheet of CNPJs, and AI agents that need to know whether a Brazilian company exists and is active.

The records come from the **Receita Federal open CNPJ data**, served by two free open-data APIs: [Minha Receita](https://minhareceita.org) first, and [OpenCNPJ](https://opencnpj.org) when Minha Receita cannot answer. No captchas, no scraping of the Receita website, no proxies, so runs are fast and steady: 3 CNPJs take about 2 seconds, 1,000 CNPJs about 4 minutes.

### What you get

For every CNPJ found:

- **Identity**: CNPJ (plain and formatted), head office or branch (matriz or filial), legal name, trade name
- **Status**: ATIVA, BAIXADA, INAPTA, SUSPENSA or NULA, with the status date and reason
- **Opening date** (data de inicio de atividade)
- **Activities**: main CNAE and every secondary CNAE, each with code and description
- **Legal nature** (natureza juridica) code and name, and **size** (porte: micro empresa, empresa de pequeno porte, demais)
- **Share capital** in BRL
- **Address**: street, number, complement, district (bairro), CEP, city, UF
- **Simples Nacional** and **MEI**: yes or no, with the dates of joining and leaving
- **Tax regime by year** (Lucro Real, Lucro Presumido, Imune, Isento...) where the Receita publishes it
- **Partner count**: how many partners (QSA) are on record
- **Data release**: which monthly Receita Federal release the record comes from, and which API answered

CNPJs that are invalid, not in the register, or could not be read are listed too (with `found` false or null and the reason), and **they are free**.

### Privacy: what is left out on purpose

This actor returns company data, not personal data:

- **No partner names** and no partial CPFs (only the number of partners)
- **No email addresses and no phone numbers** (in the register these are often the owner's or the accountant's personal contacts)
- **Sole traders** (empresario individual, MEI and other individual-person legal natures, `soleTrader: true`): the legal name is the owner's own name and the address is usually their home, so name, trade name, street address and share capital are withheld. Status, CNAE, size, city, UF and the Simples and MEI flags are still returned.

If you need partners or contact details, this is not the right tool.

### Input

| Field | Required | Example | Notes |
|---|---|---|---|
| `cnpjs` | yes | `["19.131.243/0001-97", "33683111000280"]` | One CNPJ per line, any format, up to 10,000 per run |

- Punctuation is optional: `19.131.243/0001-97` and `19131243000197` are the same.
- The new **alphanumeric CNPJ** (for example `12.ABC.345/01DE-35`) is accepted.
- Leading zeros that a spreadsheet dropped are put back (`191` stays invalid, `000000191` becomes `00.000.000/0001-91`), and the check digits are always verified.
- Duplicates are looked up and charged once.

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

### Output example

One dataset item per CNPJ. Found companies come first, in your input order, then the CNPJs without a record:

```json
{
    "input": "19.131.243/0001-97",
    "cnpj": "19131243000197",
    "cnpjFormatted": "19.131.243/0001-97",
    "found": true,
    "error": null,
    "isHeadOffice": true,
    "legalName": "OPEN KNOWLEDGE BRASIL",
    "tradeName": "REDE PELO CONHECIMENTO LIVRE",
    "status": "ATIVA",
    "statusDate": "2013-10-03",
    "statusReason": "SEM MOTIVO",
    "openingDate": "2013-10-03",
    "mainActivity": { "code": "9430800", "description": "Atividades de associações de defesa de direitos sociais" },
    "secondaryActivities": [
        { "code": "9493600", "description": "Atividades de organizações associativas ligadas à cultura e à arte" },
        { "code": "9499500", "description": "Atividades associativas não especificadas anteriormente" }
    ],
    "legalNatureCode": "3999",
    "legalNature": "Associação Privada",
    "soleTrader": false,
    "size": "DEMAIS",
    "shareCapitalBrl": 0,
    "street": "AVENIDA PAULISTA 37",
    "number": "37",
    "complement": "ANDAR 4",
    "district": "BELA VISTA",
    "zipCode": "01311902",
    "city": "SAO PAULO",
    "state": "SP",
    "simplesNacional": null,
    "simplesSince": null,
    "simplesExcludedOn": null,
    "mei": null,
    "meiSince": null,
    "meiExcludedOn": null,
    "taxRegimes": [
        { "year": 2023, "regime": "ISENTO DO IRPJ" },
        { "year": 2024, "regime": "IMUNE DE IRPJ" }
    ],
    "partnerCount": 1,
    "source": "Minha Receita",
    "dataRelease": "2026-10",
    "checkedAt": "2026-10-31T16:56:04.207Z"
}
```

A CNPJ with no record looks like this (free):

```json
{ "input": "12.ABC.345/01DE-35", "cnpj": "12ABC34501DE35", "found": false, "error": "Not found in the Receita Federal CNPJ register.", "source": "Minha Receita" }
```

Every item has the same columns in the same order, so CSV and Excel exports line up. Values the register does not have are `null`, never guessed.

### Pricing

You pay only for companies found:

| Event | Price | When |
|---|---|---|
| Company found | $0.0008 | Each CNPJ found in the register |
| Invalid, not found or unreadable CNPJ | free | Listed in the dataset with the reason |

Example: 1,000 CNPJs found cost **$0.80**, plus Apify's standard actor start fee.

The actor reads your run's maximum charge before looking anything up and only looks up as many CNPJs as that covers, so a run never goes over the limit you set.

### Limits

- Up to 10,000 CNPJs per run. For more, split the list into several runs.
- Speed: about 4 minutes per 1,000 CNPJs.
- Freshness: the Receita Federal publishes the open CNPJ data once a month, and the APIs load each release a few days later. `dataRelease` tells you which release a record comes from. For a status that changed this week, check the Receita website.
- This is a lookup by CNPJ. It does not search companies by name, CNAE or city.
- The data is as the Receita publishes it. Errors in the register (old addresses, odd dates) come through unchanged.

### FAQ

**Where does the data come from?**
From the Receita Federal's open CNPJ data, which Brazilian law (Lei de Acesso à Informação) makes public. The actor reads it through Minha Receita, a free open-source API, and falls back to OpenCNPJ, a free API that allows commercial use. Both are volunteer projects; if you rely on them, consider supporting them.

**What if a source is down?**
If Minha Receita fails, the run switches to OpenCNPJ for the rest of the CNPJs. A CNPJ that neither source can read gets `found: null` and is not charged; run it again later. If no CNPJ at all can be read, the run fails and nothing is charged.

**Why is the legal name empty for some companies?**
Those are sole traders (`soleTrader: true`). Their legal name is the owner's personal name, so it is left out. See Privacy above.

**Why is `simplesNacional` null?**
The register has no Simples Nacional option for that company (common for associations, public bodies and large companies). `false` means the company opted out or was never in.

**Can I schedule it or call it from an AI agent?**
Yes. It runs with limited permissions, so it needs no access to your other Apify data, and it works from schedules, the API, integrations and MCP clients.

**Something broke or a field is missing. What do I do?**
Open an issue on the Issues tab with your run link.

# Actor input Schema

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

Brazilian company tax ids (CNPJ), one per line. Any format works: 19.131.243/0001-97 or 19131243000197, and the new alphanumeric CNPJs too. Leading zeros dropped by a spreadsheet are put back. Duplicates are looked up once. Up to 10,000 per run.

## Actor input object example

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

# Actor output Schema

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

One item per CNPJ: found companies first, then CNPJs not found, not readable or invalid.

# 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": [
        "19.131.243/0001-97",
        "33.683.111/0002-80",
        "00.000.000/0001-91"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("itayozer9/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": [
        "19.131.243/0001-97",
        "33.683.111/0002-80",
        "00.000.000/0001-91",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("itayozer9/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": [
    "19.131.243/0001-97",
    "33.683.111/0002-80",
    "00.000.000/0001-91"
  ]
}' |
apify call itayozer9/brazil-cnpj-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,itayozer9/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/RgtCwAUtEwyMpQTi3/builds/nKM3uwodobv7DxRBJ/openapi.json
