# Brazil CNPJ Bulk Enrichment — Company Data from Receita Federal (`pegai/brazil-cnpj-enrichment`) Actor

Enrich a list of Brazilian CNPJs into full company records: legal name, trade name, status, CNAE activities, address, partners (QSA), tax regime and more. Official open data, no login.

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

## Pricing

from $6.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Brazil CNPJ Bulk Enrichment 🇧🇷

Turn a list of **CNPJs** (Brazilian company tax IDs) into **full company records** in seconds. Feed any list of CNPJs and get back clean, structured JSON: legal name, trade name, registration status, primary and secondary economic activities (CNAE), full address, phone, company size, share capital, tax regime and the complete list of partners/directors (QSA). Built for **B2B lead enrichment, KYC/AML, due diligence and CRM cleanup**.

Data comes from Brazil's **official open Receita Federal registry** — no login, no personal data, no cost per lookup beyond the results you keep.

### What you get for each company

```json
{
    "cnpj": "47960950000121",
    "cnpjFormatted": "47.960.950/0001-21",
    "legalName": "MAGAZINE LUIZA S/A",
    "tradeName": "MAGAZINE LUIZA",
    "status": "ATIVA",
    "statusReason": "SEM MOTIVO",
    "statusDate": "2005-11-03",
    "foundedDate": "1957-11-16",
    "isHeadquarters": true,
    "legalNature": "Sociedade Anônima Aberta",
    "size": "DEMAIS",
    "shareCapital": 3000000000,
    "mainActivity": { "code": "4713002", "description": "Lojas de variedades..." },
    "secondaryActivities": [{ "code": "4649408", "description": "..." }],
    "address": {
        "street": "RUA VOLUNTARIOS DA FRANCA", "number": "1465",
        "district": "CENTRO", "city": "FRANCA", "state": "SP", "zip": "14400490"
    },
    "phone": "1637118600",
    "email": null,
    "simplesOptant": false,
    "meiOptant": false,
    "partners": [
        { "name": "FREDERICO TRAJANO...", "role": "Diretor", "since": "2016-01-05", "ageRange": "41-50", "maskedTaxId": "***123456**" }
    ],
    "partnersCount": 5,
    "source": "brasilapi",
    "scrapedAt": "2026-07-06T18:45:16.384Z"
}
````

### Use cases

- **B2B lead enrichment** — turn a list of CNPJs from a form or list-buy into full firmographic profiles (activity, size, location, decision-makers).
- **KYC / AML / onboarding** — verify a company is active, read its registration status and ownership structure before doing business.
- **Due diligence & credit** — check legal nature, share capital, founding date and the full partner/director list (QSA).
- **CRM hygiene** — refresh stale account records; flag companies that went inactive (`BAIXADA`).

### How to use

1. Paste your **CNPJs** — one per line, with or without punctuation (`19.131.243/0001-97` or `19131243000197`). Numbers that lost their leading zeros in a spreadsheet are auto-padded.
2. Set `maxItems` (hard cap — you never pay for more than this).
3. Run once, schedule it, or call it from the API / n8n / Make.

Invalid CNPJs (failed checksum) are skipped **before any lookup** and never charged. CNPJs that simply aren't registered are reported in the log and also not charged.

Results land in an Apify dataset you can **export as JSON, CSV, Excel or XML**, or pull straight into Google Sheets, your database or any HTTP client via the dataset API.

### Pricing

Pay per result — you are only charged for companies actually returned, capped by `maxItems`. Invalid and not-found CNPJs are never charged.

### FAQ

**Where does the data come from?** Brazil's **open Receita Federal company registry**, served through public open-data APIs (BrasilAPI, with an automatic fallback mirror for resilience). It is the same public source that powers most CNPJ tools.

**Is this legal?** Yes. The CNPJ registry is **public open data**. Individual tax IDs of partners (CPF) come already **masked** from the source (`***123456**`) — no private personal data is exposed.

**How fresh is it?** It reflects the latest public Receita Federal snapshot, updated by the government periodically.

**Can I search by activity (CNAE), state or status instead of exact CNPJ?** Not yet — v1 enriches a known list of CNPJs. Search/filter by CNAE + state is on the roadmap.

**Large lists?** Increase `concurrency` for speed, or lower it if you ever hit an upstream rate limit. The Actor retries and falls back automatically.

### Roadmap

- Search/filter by CNAE + state + status (discover companies, not just enrich a known list)
- Optional company-level phone/email discovery
- MCP server version (call it as a tool from AI agents)

***

#### Resumo em português

Transforme uma lista de **CNPJs** em **cadastros completos de empresas** em segundos: razão social, nome fantasia, situação cadastral, CNAE (atividade principal e secundárias), endereço, telefone, porte, capital social, regime tributário e o **quadro de sócios (QSA)** completo. Ideal para **enriquecimento de leads B2B, KYC, due diligence e higienização de CRM**.

Os dados vêm do **cadastro público aberto da Receita Federal** (via BrasilAPI, com fallback automático). É **dado público** — o CPF dos sócios já vem **mascarado** na origem (`***123456**`). CNPJs inválidos são descartados antes da consulta e nunca cobrados. Cole os CNPJs (um por linha, com ou sem pontuação), defina `maxItems` e rode. Os nomes dos campos ficam em inglês para facilitar a integração.

***

*This Actor is not affiliated with or endorsed by the Brazilian government or Receita Federal. It only redistributes publicly available open data.*

# Actor input Schema

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

One CNPJ per line. Punctuation is optional — 19.131.243/0001-97 and 19131243000197 both work. Invalid CNPJs are skipped and never charged.

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

Hard cap of company records returned (this is what you pay for — the run never exceeds it).

## `concurrency` (type: `integer`):

How many CNPJs to fetch at once. Lower this if you hit upstream rate limits on very large lists.

## `skipInvalid` (type: `boolean`):

Validate the CNPJ checksum locally and skip malformed numbers before any lookup (recommended — avoids wasted requests).

## Actor input object example

```json
{
  "cnpjs": [
    "19131243000197",
    "00000000000191"
  ],
  "maxItems": 1000,
  "concurrency": 3,
  "skipInvalid": true
}
```

# 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": [
        "19131243000197",
        "00000000000191"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pegai/brazil-cnpj-enrichment").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": [
        "19131243000197",
        "00000000000191",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("pegai/brazil-cnpj-enrichment").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": [
    "19131243000197",
    "00000000000191"
  ]
}' |
apify call pegai/brazil-cnpj-enrichment --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=pegai/brazil-cnpj-enrichment",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Brazil CNPJ Bulk Enrichment — Company Data from Receita Federal",
        "description": "Enrich a list of Brazilian CNPJs into full company records: legal name, trade name, status, CNAE activities, address, partners (QSA), tax regime and more. Official open data, no login.",
        "version": "0.1",
        "x-build-id": "icmcnPgSKHbscEIu9"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/pegai~brazil-cnpj-enrichment/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-pegai-brazil-cnpj-enrichment",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/pegai~brazil-cnpj-enrichment/runs": {
            "post": {
                "operationId": "runs-sync-pegai-brazil-cnpj-enrichment",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/pegai~brazil-cnpj-enrichment/run-sync": {
            "post": {
                "operationId": "run-sync-pegai-brazil-cnpj-enrichment",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "cnpjs"
                ],
                "properties": {
                    "cnpjs": {
                        "title": "CNPJs to enrich",
                        "type": "array",
                        "description": "One CNPJ per line. Punctuation is optional — 19.131.243/0001-97 and 19131243000197 both work. Invalid CNPJs are skipped and never charged.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "Max results",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Hard cap of company records returned (this is what you pay for — the run never exceeds it).",
                        "default": 1000
                    },
                    "concurrency": {
                        "title": "Parallel lookups",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "How many CNPJs to fetch at once. Lower this if you hit upstream rate limits on very large lists.",
                        "default": 3
                    },
                    "skipInvalid": {
                        "title": "Skip invalid CNPJs",
                        "type": "boolean",
                        "description": "Validate the CNPJ checksum locally and skip malformed numbers before any lookup (recommended — avoids wasted requests).",
                        "default": true
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
