# Brazil CNPJ Data Scraper (`axiomworks/brazil-cnpj-company-scraper`) Actor

Collect public Brazilian company registration data by CNPJ, including legal name, registration status, CNAE activities, address, email and partners. The Actor queries BrasilAPI first and can use publica.cnpj.ws as a fallback when BrasilAPI is unavailable.

- **URL**: https://apify.com/axiomworks/brazil-cnpj-company-scraper.md
- **Developed by:** [Axiom Works](https://apify.com/axiomworks) (community)
- **Categories:** Business, Agents, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $7.00 / 1,000 results

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

**Returns:** one row per Brazilian company (CNPJ) with `cnpj`, `legalName`, `status`, `openingDate`, `mainActivityDescription`, `city`, `email`, `partners`.
**Input:** `{"cnpjs": ["33.000.167/0001-01", "00000000000191"], "maxItems": 50}`
**Best for:** KYC and supplier checks, enriching lead lists of Brazilian companies, monitoring whether a company is still active.

```json
{
    "cnpj": "33000167000101",
    "legalName": "PETROLEO BRASILEIRO S A PETROBRAS",
    "tradeName": "PETROBRAS - EDISE",
    "status": "ATIVA",
    "openingDate": "1966-09-28",
    "mainActivityDescription": "Extração de petróleo e gás natural",
    "city": "RIO DE JANEIRO",
    "email": "cc-rfisc@petrobras.com.br"
}
```

### What does Brazil CNPJ Company Scraper do?

Brazil CNPJ Company Scraper looks up Brazilian companies by their CNPJ number (Cadastro Nacional da Pessoa Jurídica) and returns the public registration data that Receita Federal, Brazil's federal tax authority, publishes as open data. Give it a list of CNPJs in any format and you get back one clean, structured record per company: legal name (razão social), trade name (nome fantasia), registration status, opening date, main and secondary CNAE activities, legal nature, company size, share capital, Simples Nacional and MEI options, full address, phone numbers, email and the partners and directors (QSA).

It works as a Brazil CNPJ API without an API key: the Actor reads two free public CNPJ APIs, BrasilAPI first and publica.cnpj.ws as a fallback when BrasilAPI's upstream is down. BrasilAPI does not publish the email registered at Receita Federal, so by default the Actor also asks publica.cnpj.ws for each company's email (turn `completeEmail` off for a faster run without emails). No login and no account on either service is needed. Every CNPJ is checked locally first (length and the two mod-11 check digits), so typos never cost a request or a charge.

Use this Brazil CNPJ scraper for supplier onboarding, CRM enrichment, partner lookup and recurring registration-status monitoring.

### What data can you get from a Brazil CNPJ lookup?

| Field | Description | Example |
|---|---|---|
| `id` | Record id: the 14-digit CNPJ | `33000167000101` |
| `cnpj` | 14-digit CNPJ as the source returns it | `33000167000101` |
| `cnpjFormatted` | CNPJ as NN.NNN.NNN/NNNN-NN | `33.000.167/0001-01` |
| `legalName` | Registered legal name (razão social) | `PETROLEO BRASILEIRO S A PETROBRAS` |
| `tradeName` | Trade name (nome fantasia), null when none | `PETROBRAS - EDISE` |
| `status` | Registration status: ATIVA, BAIXADA, INAPTA, SUSPENSA or NULA | `ATIVA` |
| `statusDate` | Date the current status took effect | `2005-11-03` |
| `statusReason` | Reason for the status, when given | `SEM MOTIVO` |
| `openingDate` | Date the company started activity | `1966-09-28` |
| `headOrBranch` | MATRIZ (head office) or FILIAL (branch) | `MATRIZ` |
| `mainActivityCode` | Main CNAE code, 7 digits | `0600001` |
| `mainActivityDescription` | Main CNAE activity | `Extração de petróleo e gás natural` |
| `secondaryActivities` | Secondary CNAE activities as code + description | `[{"code": "1921700", ...}]` |
| `legalNatureCode` | Legal nature code | `2038` |
| `legalNature` | Legal nature (natureza jurídica) | `Sociedade de Economia Mista` |
| `companySize` | Size class (porte): MICRO EMPRESA, EMPRESA DE PEQUENO PORTE, DEMAIS | `DEMAIS` |
| `shareCapital` | Share capital in BRL | `205431960000` |
| `simplesNacional` | In the Simples Nacional tax regime: true, false, or null when unknown | `false` |
| `mei` | Registered as MEI (microempreendedor individual): true, false, or null when unknown | `false` |
| `simplesOptInDate` | Source-reported Simples enrollment date | `2010-08-07` |
| `simplesExclusionDate` | Source-reported Simples exclusion date | `2013-06-17` |
| `meiOptInDate` | Source-reported MEI enrollment date | `2010-08-07` |
| `meiExclusionDate` | Source-reported MEI exclusion date | `2013-06-17` |
| `streetType` | Street type | `AVENIDA` |
| `street` | Street name | `REPUBLICA DO CHILE` |
| `number` | Street number as registered (may be S/N) | `65` |
| `complement` | Address complement | `ANDAR 10` |
| `neighborhood` | Neighborhood (bairro) | `CENTRO` |
| `city` | City | `RIO DE JANEIRO` |
| `state` | Two-letter state code (UF) | `RJ` |
| `zipCode` | CEP, 8 digits | `20031170` |
| `cityIbgeCode` | IBGE city code | `3304557` |
| `phone1` | First phone with area code | `2121660000` |
| `phone2` | Second phone with area code | `null` |
| `email` | Email registered at Receita Federal, null when none | `cc-rfisc@petrobras.com.br` |
| `partners` | Partners and directors (QSA): name, qualification, entry date, age range, masked document | `[{"name": "...", ...}]` |
| `partnersCount` | Number of partners listed | `8` |
| `dataSource` | Which API answered: `brasilapi` or `cnpj.ws` | `brasilapi` |
| `sourceUrl` | The API endpoint the record came from | `https://brasilapi.com.br/api/cnpj/v1/33000167000101` |
| `scrapedAt` | Time of the lookup (ISO 8601) | `2026-10-14T19:10:34.856Z` |

`simplesNacional` and `mei` come from the register's Simples Nacional record when the company has one. When it has none, they are `false` if the company cannot be in the regime by law (Simples Nacional is open only to micro and small companies, so size class `DEMAIS` rules it out, and a MEI is always an "Empresário (Individual)", legal nature 2135) and `null` otherwise. Free-text values (names, addresses, activity descriptions) are copied exactly as the answering source writes them. BrasilAPI writes cities in upper case without accents (`SAO PAULO`), cnpj.ws writes them with accents (`São Paulo`); `dataSource` tells you which one you got. Status, head office or branch, and company size are always upper case so you can filter on them directly.

### How to use Brazil CNPJ Company Scraper

1. Open Brazil CNPJ Company Scraper in Apify Console and go to the Input tab.
2. Paste your CNPJs into the **CNPJs** field, one per line. Any format works: `33.000.167/0001-01`, `33000167000101` or `33 000 167 0001 01`. Short numbers are left-padded with zeros, so `191` becomes `00000000000191`.
3. Set **Maximum results** if you want to cap the run. The limit counts records across the whole list.
4. Click **Start**. Records appear on the Output tab as they arrive. Export them as JSON, CSV, Excel, XML or HTML, or read them through the API.

Duplicates in the list are looked up once. Numbers with wrong check digits are skipped with a warning in the log and are never requested or charged. If every supplied number is invalid, the run finishes successfully with zero records and a status message asking you to check the CNPJs. A missing or empty target list still fails input validation. A CNPJ that is valid but not registered (or was never issued) returns no record; the run still finishes successfully and its status message lists the CNPJs that were not found.

Speed depends on the sources. BrasilAPI answers in well under a second. publica.cnpj.ws allows 3 lookups per minute, and it is used in two cases: for every company's email while `completeEmail` is on (the default), and for the whole record when BrasilAPI's upstream is down. So a default run of 30 CNPJs takes about 10 minutes, and the log tells you when the Actor is waiting for the limit. If you do not need emails, set `completeEmail` to false and a list of 30 CNPJs finishes in seconds whenever BrasilAPI is up.

You can schedule the Actor (for example weekly) with the same list and compare `status` between runs to catch companies that closed or became irregular.

### Input

The `cnpjs` list also accepts endpoint URLs, for example `https://brasilapi.com.br/api/cnpj/v1/12345678000195/` or `https://publica.cnpj.ws/cnpj/19131243000197`. The Actor extracts the CNPJ locally, validates its check digits, and uses the same primary and fallback sources. It does not fetch arbitrary pasted URLs. URL and numeric forms of the same CNPJ are deduplicated together. Historical Simples and MEI dates are nullable and do not establish current enrollment; use the existing boolean fields for that.

| Field | Type | Required | Description |
|---|---|---|---|
| `cnpjs` | array of strings | Yes | CNPJ numbers to look up, in any format. Invalid check digits are skipped without a request. |
| `maxItems` | integer | No | Maximum number of company records to return across all CNPJs, 1-10000, default 50. |
| `useFallbackSource` | boolean | No | Default true. Look a CNPJ up on publica.cnpj.ws when BrasilAPI cannot answer. Slower: 3 lookups per minute. |
| `completeEmail` | boolean | No | Default true. Fill `email` from publica.cnpj.ws for every company, since BrasilAPI does not publish it. 3 lookups per minute; set false for a fast run without emails. |
| `proxyConfiguration` | object | No | Proxy settings. Default: no proxy. Both sources are public APIs; use a proxy only if lookups get blocked. |

```json
{
    "cnpjs": [
        "33.000.167/0001-01",
        "00000000000191",
        "60.746.948/0001-12"
    ],
    "maxItems": 50,
    "useFallbackSource": true,
    "completeEmail": true,
    "proxyConfiguration": { "useApifyProxy": false }
}
```

### Output

Each company is one item in the run's dataset. These two records come from a real run (partner and activity lists shortened):

```json
[
    {
        "id": "33000167000101",
        "cnpj": "33000167000101",
        "cnpjFormatted": "33.000.167/0001-01",
        "legalName": "PETROLEO BRASILEIRO S A PETROBRAS",
        "tradeName": "PETROBRAS - EDISE",
        "status": "ATIVA",
        "statusDate": "2005-11-03",
        "statusReason": "SEM MOTIVO",
        "openingDate": "1966-09-28",
        "headOrBranch": "MATRIZ",
        "mainActivityCode": "0600001",
        "mainActivityDescription": "Extração de petróleo e gás natural",
        "secondaryActivities": [
            { "code": "1921700", "description": "Fabricação de produtos do refino de petróleo" }
        ],
        "legalNatureCode": "2038",
        "legalNature": "Sociedade de Economia Mista",
        "companySize": "DEMAIS",
        "shareCapital": 205431960000,
        "simplesNacional": false,
        "mei": false,
        "streetType": "AVENIDA",
        "street": "REPUBLICA DO CHILE",
        "number": "65",
        "complement": null,
        "neighborhood": "CENTRO",
        "city": "RIO DE JANEIRO",
        "state": "RJ",
        "zipCode": "20031170",
        "cityIbgeCode": "3304557",
        "phone1": "2121660000",
        "phone2": null,
        "email": "cc-rfisc@petrobras.com.br",
        "partners": [
            {
                "name": "ANGELICA GARCIA COBAS LAUREANO",
                "qualification": "Diretor",
                "entryDate": "2025-07-29",
                "ageRange": "Entre 71 a 80 anos",
                "document": "***912137**"
            }
        ],
        "partnersCount": 8,
        "dataSource": "brasilapi",
        "sourceUrl": "https://brasilapi.com.br/api/cnpj/v1/33000167000101",
        "scrapedAt": "2026-10-14T19:10:34.856Z"
    },
    {
        "id": "00000000000191",
        "cnpj": "00000000000191",
        "cnpjFormatted": "00.000.000/0001-91",
        "legalName": "BANCO DO BRASIL SA",
        "tradeName": "DIRECAO GERAL",
        "status": "ATIVA",
        "statusDate": "2005-11-03",
        "openingDate": "1966-08-01",
        "headOrBranch": "MATRIZ",
        "mainActivityCode": "6422100",
        "mainActivityDescription": "Bancos múltiplos, com carteira comercial",
        "legalNature": "Sociedade de Economia Mista",
        "companySize": "DEMAIS",
        "shareCapital": 120000000000,
        "simplesNacional": false,
        "mei": false,
        "streetType": "QUADRA",
        "street": "SAUN QUADRA 5 BLOCO B TORRE I, II, III",
        "number": "SN",
        "neighborhood": "ASA NORTE",
        "city": "BRASILIA",
        "state": "DF",
        "zipCode": "70040912",
        "cityIbgeCode": "5300108",
        "phone1": "6134939002",
        "email": "secex@bb.com.br",
        "partnersCount": 41,
        "dataSource": "brasilapi",
        "sourceUrl": "https://brasilapi.com.br/api/cnpj/v1/00000000000191"
    }
]
```

### How much does it cost to look up Brazilian CNPJs?

Brazil CNPJ Company Scraper is charged per result: one company record returned is one result. CNPJs that are invalid, not found or that fail are not charged. `maxItems` caps how many records a run can return, and so caps what a run can cost. You can also set a maximum cost per run in the run options; the Actor then stops cleanly when that limit is reached and keeps everything it already saved. See the Pricing tab for the current price.

### Use with AI agents (MCP)

Connect Brazil CNPJ Company Scraper to Claude, Cursor or any MCP client through the Apify MCP server:

```json
{
    "mcpServers": {
        "apify": {
            "url": "https://mcp.apify.com/?tools=axiomworks/brazil-cnpj-company-scraper"
        }
    }
}
```

Example prompts:

1. "Look up CNPJ 33.000.167/0001-01 and tell me the company's status, opening date and who its directors are."
2. "Here are 20 CNPJs from our supplier list. Which of them are not ATIVA, and since when?"
3. "Get the main CNAE activity, company size and city for these CNPJs and put them in a table."

The agent sees the input fields and their descriptions, so it can pass CNPJs in any format.

### Integrations and API

Run Brazil CNPJ Company Scraper from your own code with the Apify API. Set `APIFY_TOKEN` to your Apify API token (send it in the `Authorization` header, never in the URL).

**Python**

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("axiomworks/brazil-cnpj-company-scraper").call(
    run_input={"cnpjs": ["33.000.167/0001-01", "00000000000191"], "maxItems": 50}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["cnpjFormatted"], item["legalName"], item["status"])
```

**JavaScript**

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

const client = new ApifyClient({ token: '<YOUR_API_TOKEN>' });
const run = await client.actor('axiomworks/brazil-cnpj-company-scraper').call({
    cnpjs: ['33.000.167/0001-01', '00000000000191'],
    maxItems: 50,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

**cURL**

```bash
curl -X POST "https://api.apify.com/v2/acts/axiomworks~brazil-cnpj-company-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"cnpjs": ["33.000.167/0001-01", "00000000000191"], "maxItems": 50}'
```

The Integrations tab connects the Actor to Make, Zapier, n8n, Google Sheets, Slack and webhooks, so records flow straight into a spreadsheet or CRM after each run.

### FAQ

**Which CNPJ formats are accepted?**
Any format with the 14 digits: with dots, slash and dash (`33.000.167/0001-01`), digits only (`33000167000101`) or with spaces. Non-digit characters are removed and short numbers are padded with leading zeros.

**Why was one of my CNPJs skipped?**
Either its check digits are wrong (the log says "not a valid CNPJ", and no request was made), or the number is valid but not registered at Receita Federal (the log says "not found"). Neither is charged. The final status message lists the CNPJs that were not found or invalid.

**Can I look up branches (filiais)?**
Yes. Every establishment has its own CNPJ: the head office ends in `0001`, branches in `0002`, `0003` and so on. Look up the branch CNPJ and `headOrBranch` is `FILIAL`, with the branch's own address and phone.

**How fresh is the data?**
Both sources republish Receita Federal's open CNPJ data, which Receita Federal updates about once a month. A change filed this week may not appear yet.

**Why are some runs slower than others?**
publica.cnpj.ws allows 3 lookups per minute, and the default run asks it for every company's email. Set `completeEmail` to false for a fast run without emails, and `useFallbackSource` to false to skip CNPJs that BrasilAPI cannot answer instead of waiting.

**Are partners' CPF numbers included?**
Only in the masked form the sources publish (`***912137**`). The Actor never tries to unmask them.

**Why is `email` null?**
Receita Federal has no email on file for that company, or `completeEmail` was off and the record came from BrasilAPI, which does not publish emails.

**How are `simplesNacional` and `mei` decided?**
From the register's Simples Nacional record when the company has one. Without a record they are `false` when the law rules the regime out (size class `DEMAIS`, or a legal nature other than Empresário Individual for MEI) and `null` when the company could be in it but the register does not say.

**Can I get a whole list of companies by city or activity?**
No. This Actor looks up CNPJs you already have. It does not search the register by name, city or CNAE.

### Is it legal to scrape Brazil CNPJ data?

The Actor reads only public data: Receita Federal publishes the CNPJ register as open data, and BrasilAPI and publica.cnpj.ws serve it through free public APIs without a login. Partner names, age ranges and masked CPFs are part of that public register. Some sole-proprietor company names contain the owner's name, because that is how they are registered. Brazil's data protection law (LGPD) applies to how you use personal data, so use the records for legitimate purposes such as due diligence and keep only what you need. This is not legal advice.

Brazil CNPJ Company Scraper is an independent tool. It is not affiliated with, endorsed by or sponsored by Receita Federal, BrasilAPI or CNPJ.ws.

### Feedback

Found a bug or need a field that isn't here? Open an issue on the Issues tab and we'll look at it.

# Actor input Schema

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

CNPJs in formatted, bare or space-separated form, or BrasilAPI/publica.cnpj.ws CNPJ endpoint URLs. Duplicates are fetched once. maxItems is shared across targets. Invalid check digits are skipped; missing or blocked companies return no row and the run succeeds. If all numbers are invalid, the run succeeds with zero rows; correct the numbers and retry.

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

Maximum number of company records to return across all CNPJs, 1-10000, default 50. The run stops as soon as this many records are saved, and you are charged only for records returned.

## `useFallbackSource` (type: `boolean`):

Default true. When BrasilAPI (the main source) cannot answer for a CNPJ (server error or timeout), look it up on publica.cnpj.ws instead. The fallback allows only 3 lookups per minute, so large lists take longer. Set false to skip those CNPJs instead (they are listed in the log).

## `completeEmail` (type: `boolean`):

Default true. BrasilAPI, the fast main source, never returns the email registered at Receita Federal, so every company is also looked up on publica.cnpj.ws to fill `email`. That source allows 3 lookups per minute: 30 CNPJs take about 10 minutes, 50 about 17. Set false for a fast run (about 2 lookups per second) in which `email` is null for records that come from BrasilAPI.

## `proxyConfiguration` (type: `object`):

Proxy to use for requests, default none (direct connection). Blocked requests (HTTP 403) are retried on a new proxy session when a proxy is set. Turn on Apify Proxy only if lookups keep failing with blocks.

## Actor input object example

```json
{
  "cnpjs": [
    "33.000.167/0001-01",
    "00000000000191"
  ],
  "maxItems": 10,
  "useFallbackSource": true,
  "completeEmail": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

Dataset with one item per result, in the order found.

# 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",
        "00000000000191"
    ],
    "maxItems": 10,
    "useFallbackSource": true,
    "completeEmail": true,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("axiomworks/brazil-cnpj-company-scraper").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",
        "00000000000191",
    ],
    "maxItems": 10,
    "useFallbackSource": True,
    "completeEmail": True,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("axiomworks/brazil-cnpj-company-scraper").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",
    "00000000000191"
  ],
  "maxItems": 10,
  "useFallbackSource": true,
  "completeEmail": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call axiomworks/brazil-cnpj-company-scraper --silent --output-dataset

```

## MCP server setup

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

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/UcE6kduOs0vR8MnJL/builds/jjw6RZogkmSCrV0Fu/openapi.json
