# Brazil CNPJ Lookup - Company Registry, CNAE & Simples Data (`formative_cobia/brazil-cnpj-open-data-lookup`) Actor

Look up Brazilian companies by CNPJ in bulk: legal and trade name, registration status, CNAE activities, address with IBGE code, size, legal nature, share capital, Simples Nacional and MEI, from Receita Federal open data. Check digits validated first; invalid and not found CNPJs are free.

- **URL**: https://apify.com/formative_cobia/brazil-cnpj-open-data-lookup.md
- **Developed by:** [BR Open Data Tools](https://apify.com/formative_cobia) (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 – Company Registry, CNAE & Simples Data

Look up **Brazilian companies by CNPJ** in bulk and get one clean row per company from the official open data of the Brazilian Federal Revenue (Receita Federal):

- **Legal name** and **trade name**, headquarters or branch.
- **Registration status** (active, closed, suspended, unfit, void) with date and reason.
- **Main and secondary activities (CNAE)** with descriptions.
- **Address** with IBGE city code, **company size**, **legal nature**, **share capital**, **opening date**.
- **Simples Nacional** and **MEI** status with start and end dates.
- Number of partners and their **qualifications**, never their names.

Paste up to 5,000 CNPJs per run, with or without punctuation. Invalid numbers and duplicates are removed **before** any request and are never charged.

### Who uses it

- B2B sales and SDR teams enriching lead lists with activity, size, city and status.
- Credit, risk, KYC and onboarding teams checking that a company is active and what it does.
- Procurement teams validating suppliers.
- Accountants, analysts and data teams who need clean company data in English field names.

### Why use it

- **Check digits validated first**: a mistyped CNPJ costs nothing and is listed in the run summary.
- **Automatic failover between three free public services** that serve the Federal Revenue data (BrasilAPI, Minha Receita and OpenCNPJ). If one is slow, rate-limited, down or simply missing a company, the next one answers; the row tells you which one did.
- **Clean output**: dates as YYYY-MM-DD, numbers as numbers, CNAE codes with 7 digits, status and size as stable English codes plus the original label.
- **Privacy by design**: partner names, CPF fragments and age ranges are never returned. Company phone and e-mail only when you turn them on.
- **Only active companies** filter: inactive ones are skipped and not charged.

### Input

| Field | Description | Default |
|---|---|---|
| **CNPJs** | 14-digit company numbers, with or without punctuation. Up to 5,000. | – |
| **Only active companies** | Deliver only companies with status ATIVA. | off |
| **Include secondary activities (CNAE)** | List of secondary activities with descriptions. | on |
| **Include partners summary** | Number of partners and their qualifications (no names). | on |
| **Include company contact** | Registered phones and e-mail. | off |
| **Max companies / Max HTTP requests / Max run time** | Hard limits that control cost. | 1000 / 1200 / 900 s |
| **Interval between requests** | Minimum wait between two requests to the same service. | 600 ms |

#### Example input

```json
{
  "cnpjs": ["33.000.167/0001-01", "00000000000191", "60.746.948/0001-12"],
  "onlyActive": true,
  "includeContactInfo": false
}
```

### Output

One row per company. Example (values shortened):

```json
{
  "cnpj": "33000167000101",
  "cnpjFormatted": "33.000.167/0001-01",
  "cnpjRoot": "33000167",
  "isHeadquarters": true,
  "legalName": "PETROLEO BRASILEIRO S A PETROBRAS",
  "tradeName": "PETROBRAS - EDISE",
  "registrationStatus": "active",
  "registrationStatusLabel": "ATIVA",
  "registrationStatusDate": "2005-11-03",
  "registrationStatusReason": null,
  "openedAt": "1966-09-28",
  "legalNatureCode": "2038",
  "legalNature": "Sociedade de Economia Mista",
  "companySize": "other",
  "companySizeLabel": "DEMAIS",
  "shareCapital": 205431960000.0,
  "mainActivity": {"code": "0600001", "description": "Extração de petróleo e gás natural"},
  "secondaryActivities": [{"code": "1921700", "description": "Fabricação de produtos do refino de petróleo"}],
  "simplesNacional": {"optant": null, "since": null, "until": null},
  "mei": {"optant": null, "since": null, "until": null},
  "street": "AVENIDA REPUBLICA DO CHILE",
  "number": "65",
  "district": "CENTRO",
  "city": "RIO DE JANEIRO",
  "cityIbgeCode": "3304557",
  "state": "RJ",
  "postalCode": "20031170",
  "partnersCount": 8,
  "partnerQualifications": ["Diretor", "Presidente"],
  "source": "BrasilAPI",
  "fetchedAt": "2026-11-16T03:00:00+00:00",
  "attribution": "Source: Brazilian Federal Revenue (Receita Federal) open CNPJ data, via the public BrasilAPI, Minha Receita and OpenCNPJ services"
}
```

With **Include company contact**, rows also have `phones` and `email`. Fields without data are `null`. Activity descriptions, legal nature and labels are kept in Portuguese, as published.

A run summary is saved as **SUMMARY** in the run's key-value store: invalid, not found and failed CNPJs (listed), duplicates skipped, companies skipped by the active filter, rows per service, requests used, duration and the stop reason.

### Cost control

- Invalid, duplicate, not found and failed CNPJs are **never charged**; neither are companies skipped by **Only active companies**.
- **Max companies** caps the number of billable rows; **Max HTTP requests** and **Max run time** cap the work done. The run stops cleanly and keeps what it already delivered.
- The maximum charge you set for a run is respected: the Actor stops before exceeding it.
- If every public service fails for 10 CNPJs in a row, the run stops with a clear message instead of spending your time.

### Pricing

Pay per event: a small fee when a run starts and a fee per company delivered. See the pricing tab for current values.

### Tips

- Throughput is about 0.6 seconds per company, so 1,000 CNPJs take roughly 10 to 15 minutes. Split very large lists into several runs or raise **Max run time**.
- Use `cnpjRoot` to group a headquarters and its branches.
- Schedule a weekly run on your customer or supplier list with **Only active companies** off and compare `registrationStatus` to catch closures.

### Limitations

- The Federal Revenue publishes the open CNPJ data about once a month, and each public service refreshes its copy on its own schedule, so very recent changes may be missing and two services can briefly differ. The `source` field tells you which one answered.
- `cityIbgeCode` is not available when the answer came from OpenCNPJ.
- The public services are free and community-run; they may limit heavy use. The Actor spaces requests and switches services automatically, but their availability is outside its control.
- For sole proprietors (MEI, empresário individual) the legal name usually contains the owner's name. That is part of the public registry; if you process it, you are responsible for having a lawful basis under the Brazilian data protection law (LGPD). Contact data is off by default for the same reason.

### Data source and license

- Source: Cadastro Nacional da Pessoa Jurídica (CNPJ), open data of the Brazilian Federal Revenue (Receita Federal), published under the federal open data policy, which allows free reuse, including commercial use, with credit to the source.
- The data is read through three free, open-source public services that republish it: BrasilAPI, Minha Receita and OpenCNPJ. No login or API key is required.
- Keep the attribution "Source: Receita Federal (open CNPJ data)" when you share data from this Actor.
- This Actor is an independent tool and is not affiliated with or endorsed by the Receita Federal or by any of these services.

# Changelog

This Actor's version history is a separate document: https://apify.com/formative_cobia/brazil-cnpj-open-data-lookup/changelog.md

# Actor input Schema

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

Brazilian company numbers (CNPJ), 14 digits, with or without punctuation. Up to 5,000 per run. Invalid numbers and duplicates are removed before any request and are never charged.

## `onlyActive` (type: `boolean`):

Deliver only companies whose registration status is active (ATIVA). Other companies are skipped and not charged.

## `includeSecondaryActivities` (type: `boolean`):

Add the list of secondary CNAE activities with descriptions.

## `includePartnersSummary` (type: `boolean`):

Add the number of partners and their qualifications (e.g. Director, Managing Partner). Partner names and CPF are never returned.

## `includeContactInfo` (type: `boolean`):

Add the phone numbers and e-mail registered by the company. For sole proprietors this can be personal data: use it only with a lawful basis under the LGPD.

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

Stop after delivering this many company records.

## `maxRequests` (type: `integer`):

Hard cap on requests to the public sources (retries and failover included).

## `maxRunSeconds` (type: `integer`):

The run stops cleanly and delivers what it has after this time.

## `requestIntervalMs` (type: `integer`):

Minimum wait between two requests to the same source, to respect the free public services.

## Actor input object example

```json
{
  "cnpjs": [
    "33.000.167/0001-01",
    "00.000.000/0001-91",
    "60.746.948/0001-12"
  ],
  "onlyActive": false,
  "includeSecondaryActivities": true,
  "includePartnersSummary": true,
  "includeContactInfo": false,
  "maxItems": 3,
  "maxRequests": 10,
  "maxRunSeconds": 120,
  "requestIntervalMs": 600
}
```

# Actor output Schema

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

No description

## `summary` (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",
        "60.746.948/0001-12"
    ],
    "maxItems": 3,
    "maxRequests": 10,
    "maxRunSeconds": 120
};

// Run the Actor and wait for it to finish
const run = await client.actor("formative_cobia/brazil-cnpj-open-data-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",
        "60.746.948/0001-12",
    ],
    "maxItems": 3,
    "maxRequests": 10,
    "maxRunSeconds": 120,
}

# Run the Actor and wait for it to finish
run = client.actor("formative_cobia/brazil-cnpj-open-data-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",
    "60.746.948/0001-12"
  ],
  "maxItems": 3,
  "maxRequests": 10,
  "maxRunSeconds": 120
}' |
apify call formative_cobia/brazil-cnpj-open-data-lookup --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,formative_cobia/brazil-cnpj-open-data-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/qbGB51uKwQknbGIR3/builds/4Vas62OgEIhDJLgh5/openapi.json
