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

Bulk lookup of Brazilian companies by CNPJ from Receita Federal open data: legal name, status, address, phones, email, CNAE activities, Simples Nacional/MEI, tax regime and partners (QSA).

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

## Pricing

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

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

Look up **thousands of Brazilian companies by CNPJ** and get clean JSON with the **legal name, trade name, registration status, opening date, address, phones, CNAE activities, company size, share capital, Simples Nacional and MEI options, partners (QSA)** and the **yearly tax regime**.

Paste a list of CNPJs (with or without punctuation, even with the leading zeros lost by Excel) and the Actor returns one record per company. Data comes from the **Receita Federal open CNPJ dataset**, refreshed monthly.

- ✅ **Bulk and fast:** about 140 CNPJs per minute (8,000 per hour), up to 50,000 per run.
- ✅ **No login, no captcha, no browser:** a simple JSON API, so runs are cheap and reliable.
- ✅ **Pay only for companies found:** invalid CNPJs are skipped and CNPJs that do not exist are returned free with `found: false`.
- ✅ **New alphanumeric CNPJ ready:** validates both the classic numeric format and the new alphanumeric format (from July 2026).
- ✅ **Ready for AI agents and MCP:** flat English field names and a fully described output schema.

### What data does it extract?

| Field | Example |
|---|---|
| Legal name and trade name (*razão social*, *nome fantasia*) | `COCA COLA INDUSTRIAS LTDA` |
| Status (*situação cadastral*), date and reason | `active`, `2005-11-03` |
| Opening date, head office or branch | `1971-12-24`, `isHeadquarters: true` |
| Legal nature, size (*porte*), share capital | `Sociedade Empresária Limitada`, `DEMAIS`, `150458420` |
| Main and secondary CNAE activities | `1099699` Fabricação de outros produtos alimentícios… |
| Address with CEP and IBGE city code | `PRAIA DE BOTAFOGO 374`, `RIO DE JANEIRO`, `RJ`, `22250040` |
| Phones | `+552125591000` |
| Simples Nacional and MEI | opted in, since, excluded at |
| **Partners and administrators (QSA)** | name, type, role, entry date, age range, legal representative |
| **Tax regime history** (optional) | `2024: LUCRO REAL` |

### Use cases

- **Lead enrichment and CRM cleanup:** add address, phones, CNAE and size to a list of B2B prospects.
- **Supplier and customer onboarding (KYC/KYB):** confirm the company is active and see who the partners and administrators are.
- **Credit and risk:** flag companies that are closed (*baixada*), unfit (*inapta*) or in a special situation such as judicial recovery.
- **Tax and accounting:** check whether a company is in Simples Nacional or MEI before issuing invoices.

### Input examples

**A few CNPJs with partners (default):**

```json
{
    "cnpjs": ["33.000.167/0001-01", "45997418000153", "191"]
}
```

**A large list without partners, with tax regime history:**

```json
{
    "cnpjs": ["60746948000112", "00000000000191", "..."],
    "includePartners": false,
    "includeTaxRegimeHistory": true
}
```

| Field | Description |
|---|---|
| `cnpjs` | CNPJ numbers in any format. Duplicates are removed, short numbers get their leading zeros back, and numbers with wrong check digits are skipped. |
| `includePartners` | Add partners and administrators (QSA). Default `true`. |
| `includeTaxRegimeHistory` | Add the yearly tax regime. Default `false`. |

### Output example

```json
{
    "cnpj": "45.997.418/0001-53",
    "cnpjDigits": "45997418000153",
    "found": true,
    "legalName": "COCA COLA INDUSTRIAS LTDA",
    "tradeName": null,
    "status": "active",
    "statusDate": "2005-11-03",
    "statusReason": "SEM MOTIVO",
    "specialSituation": null,
    "isHeadquarters": true,
    "openedAt": "1971-12-24",
    "legalNatureCode": "2062",
    "legalNature": "Sociedade Empresária Limitada",
    "size": "DEMAIS",
    "shareCapitalBrl": 150458420,
    "mainActivity": {
        "code": "1099699",
        "description": "Fabricação de outros produtos alimentícios não especificados anteriormente"
    },
    "secondaryActivities": [
        {
            "code": "1096100",
            "description": "Fabricação de alimentos e pratos prontos"
        }
    ],
    "address": {
        "street": "PRAIA DE BOTAFOGO",
        "number": "374",
        "complement": "ANDAR 12 PARTE",
        "district": "BOTAFOGO",
        "city": "RIO DE JANEIRO",
        "cityIbgeCode": "3304557",
        "state": "RJ",
        "zipCode": "22250040",
        "country": "BRASIL"
    },
    "phones": [
        "+552125591000",
        "+552125591261"
    ],
    "simplesNacional": {
        "optedIn": null,
        "since": null,
        "excludedAt": null
    },
    "mei": {
        "optedIn": null,
        "since": null,
        "excludedAt": null
    },
    "partnerCount": 14,
    "checkedAt": "2026-11-23T01:23:50.742Z",
    "partners": [
        {
            "name": "COCA COLA INTERAMERICAN CORPORATION",
            "type": "company",
            "document": "06981239",
            "role": "Sócio Pessoa Jurídica Domiciliado no Exterior",
            "joinedAt": "1998-09-10",
            "ageRange": "Não se aplica",
            "country": "ESTADOS UNIDOS",
            "legalRepresentative": "ALEXANDRE FERNANDES DELGADO",
            "legalRepresentativeRole": "Procurador"
        }
    ],
    "taxRegimeHistory": [
        {
            "year": 2023,
            "regime": "LUCRO REAL"
        },
        {
            "year": 2024,
            "regime": "LUCRO REAL"
        }
    ]
}
```

Status values: `active` (ATIVA), `suspended` (SUSPENSA), `unfit` (INAPTA), `closed` (BAIXADA) and `null` (NULA). Partner CPFs come masked by Receita Federal (`***912137**`).

### Pricing

Pay per event: you pay only for companies found.

| Event | When it is charged |
|---|---|
| `company` | Once for every company saved, with partners and tax regime included. |

Not-found CNPJs are saved with `found: false` at no charge, and invalid CNPJs are skipped. Set a **maximum cost per run** in the run options and the Actor stops cleanly when it reaches it.

### Tips and limits

- Receita Federal publishes the open CNPJ dataset monthly, so a change made at Receita this week may take a few weeks to appear.
- Receita Federal's open dataset used here does not include email addresses.
- Each branch (*filial*) has its own CNPJ. Look up the head office (`/0001-`) for the main record.

### Use it from the API

Run the Actor and get the results in one call. This endpoint waits up to 5 minutes, so use the Python client below for longer runs:

```bash
curl -X POST "https://api.apify.com/v2/acts/cvillasanti~brazil-cnpj-lookup/run-sync-get-dataset-items?token=YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"cnpjs": ["33.000.167/0001-01", "45997418000153", "191"]}'
```

Or with the Python client (`pip install apify-client`):

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("cvillasanti/brazil-cnpj-lookup").call(run_input={
    "cnpjs": [
        "33.000.167/0001-01",
        "45997418000153",
        "191"
    ]
})
for item in client.dataset(run["default_dataset_id"]).iterate_items():
    print(item)
```

It also works from Make, Zapier, n8n, Google Sheets and any AI agent through the [Apify MCP server](https://mcp.apify.com).

### FAQ

**Is this legal?** Yes. The CNPJ registry is public data published by Receita Federal for reuse. The Actor reads it through the open-source Minha Receita API, which serves that dataset.

**How is this different from scraping the Receita website?** No captcha, no browser and no blocked IPs, so it is faster and cheaper.

**Can I use it from an AI agent?** Yes. Call it through the Apify MCP server or the API. The input and output schemas are fully described.

### Em português

**Consulta CNPJ em massa** com dados da Receita Federal: razão social, nome fantasia, situação cadastral, endereço, telefones, CNAE principal e secundários, porte, capital social, opção pelo Simples Nacional e MEI, quadro de sócios e administradores (QSA) e regime tributário. Cole uma lista de CNPJs, com ou sem pontuação, e receba o resultado em JSON, CSV ou Excel. Ideal para enriquecimento de leads, cadastro de fornecedores (KYC/KYB) e análise de crédito.

# Actor input Schema

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

CNPJ numbers to look up, with or without punctuation (33.000.167/0001-01 or 33000167000101). Duplicates and invalid numbers are skipped. Up to 50,000 per run.

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

Add the list of partners and administrators (quadro de sócios e administradores) to each company.

## `includeTaxRegimeHistory` (type: `boolean`):

Add the yearly tax regime (Lucro Real, Lucro Presumido, Simples, Imune...) reported by the company.

## Actor input object example

```json
{
  "cnpjs": [
    "33.000.167/0001-01",
    "45.997.418/0001-53"
  ],
  "includePartners": true,
  "includeTaxRegimeHistory": false
}
```

# Actor output Schema

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

Status, address, contacts, activities, tax options and partners per CNPJ.

# 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",
        "45.997.418/0001-53"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("cvillasanti/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",
        "45.997.418/0001-53",
    ] }

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

```

## MCP server setup

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