# CNPJ Brasil Scraper (Company Data & Leads) (`reventadata/cnpj-brasil-scraper`) Actor

Scrape Brazilian company CNPJ registry data, corporate legal status, CNAE economic activities, share capital, opening dates, and locations without personal PII.

- **URL**: https://apify.com/reventadata/cnpj-brasil-scraper.md
- **Developed by:** [reventadata](https://apify.com/reventadata) (community)
- **Categories:** Lead generation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 company records

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

> **Unofficial.** This Actor is not affiliated with, authorised by, endorsed by, or in any
> way officially connected to Casa dos Dados or Receita Federal do Brasil. "CNPJ" is the registered
> national corporate registry identifier of Brazil. This tool queries public corporate registry data
> made available under Brazilian open government transparency policies.

CNPJ Brasil Scraper extracts verified Brazilian corporate registrations, official Receita Federal status, primary CNAE economic activity classifications, share capital (Capital Social), establishment dates, and official headquarters locations.

### What data can you extract?

- **Corporate Identification:** 14-digit numeric CNPJ and canonical formatted CNPJ (`97.554.306/0001-21`), corporate registered entity name (Razão Social), and commercial brand name (Nome Fantasia).
- **Cadastral & Legal Status:** Official registration status with Receita Federal (`ATIVA`, `BAIXADA`, `INAPTA`, `SUSPENSA`).
- **Economic Classification (CNAE):** Primary 7-digit economic activity code (`cnaeCode`) and official activity title (`cnaeDescription`).
- **Corporate Governance & Structure:** Registered share capital in BRL (`shareCapital`), legal nature classification (e.g. `Sociedade Empresária Limitada`), company size tier (`MEI`, `MICRO EMPRESA`, `EMPRESA DE PEQUENO PORTE`), and headquarters indicator (`isMatriz`).
- **Tax Regimes:** Indicators for Simples Nacional (`isSimplesNacional`) and MEI (`isMei`).
- **Official Commercial Address:** Federation Unit / State (`state`), Municipality (`city`), District (`neighborhood`), Street line (`street`), and Brazilian Postal Code (`zipCode` / CEP).

### Why scrape Brazilian CNPJ Data?

- **B2B Lead Generation & Sales Prospecting:** Filter prospective corporate buyers by exact CNAE vertical, minimum share capital, and Brazilian state (e.g. active technology firms in São Paulo with capital > R$ 50,000).
- **Corporate Due Diligence & KYC:** Verify vendor and supplier legal status, registered headquarters, corporate age, and tax status before onboarding.
- **Zero Personal PII by Design:** Fully compliant with Brazilian LGPD (Lei Geral de Proteção de Dados). Strips individual CPF numbers, personal phone numbers, and private emails, returning only public corporate entity records.
- **Predictable Pay-Per-Event (PPE) Pricing:** Pay only for results returned at **$2.00 per 1,000 company records** ($0.002 per item), with platform usage fully absorbed by us.

### How to use

1. Enter target company keywords or trade names in `searchQueries` (e.g. `["tecnologia", "consultoria", "logistica"]`).
2. Select target state in `state` (e.g. `SP`, `RJ`, `MG`, or `ALL` for nationwide lookup).
3. Filter by cadastral status in `status` (`ATIVA`, `BAIXADA`, or `ALL`).
4. Optionally filter by `minCapital`, `maxCapital`, `cnaeCode`, or enable `onlyMatriz`.
5. Configure `maxItems` (default: 50, prefill: 10).
6. Run the Actor and export clean company data to JSON, CSV, Excel, or Google Sheets.

#### Input Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `searchQueries` | array | `["tecnologia"]` | Keywords, company names (Razão Social), or trade names (Nome Fantasia). |
| `state` | string | `"SP"` | Brazilian state code (SP, RJ, MG, ...) or `ALL` for nationwide. |
| `status` | string | `"ATIVA"` | Cadastral status: `ATIVA` (active), `BAIXADA` (closed), or `ALL`. |
| `minCapital` | integer | *null* | Optional minimum share capital in BRL (R$). |
| `maxCapital` | integer | *null* | Optional maximum share capital in BRL (R$). |
| `cnaeCode` | string | *null* | Optional 7-digit primary economic activity code (e.g. `6201501`). |
| `onlyMatriz` | boolean | `false` | Filter corporate headquarters only (excludes branches). |
| `maxItems` | integer | `50` | Maximum company records to output to dataset (prefill: 10). |
| `proxyConfiguration` | object | *Direct* | Apify Proxy configuration (direct egress used by default). |

#### Sample Output Record

```json
{
  "cnpj": "97554306000121",
  "cnpjFormatted": "97.554.306/0001-21",
  "legalName": "QUALITY TECNOLOGIA E SISTEMAS LTDA",
  "tradeName": null,
  "status": "ATIVA",
  "openingDate": "2011-06-13",
  "cnaeCode": "6201501",
  "cnaeDescription": "Desenvolvimento de programas de computador sob encomenda",
  "shareCapital": 10000.0,
  "legalNature": "Sociedade Empresária Limitada",
  "companySize": "EMPRESA DE PEQUENO PORTE",
  "isSimplesNacional": true,
  "isMei": false,
  "isMatriz": true,
  "city": "Sao Paulo",
  "state": "SP",
  "neighborhood": "Santo Amaro",
  "street": "Adolfo Pinheiro, 1000",
  "zipCode": "04734002",
  "matchedQuery": "tecnologia",
  "scrapedAt": "2026-10-17T13:37:36.719463+00:00"
}
```

### How much does it cost to scrape CNPJ company data?

Pay-per-event: **$0.002 per company record** saved to the dataset (**$2.00 per 1,000 company records**), plus **$0.00005** charged once when the run starts. No subscription. Only rows saved to the dataset are charged.

# Actor input Schema

## `searchQueries` (type: `array`):

Keywords, trade names (nome fantasia), or corporate names (razão social) to search in the Brazilian CNPJ registry.

## `state` (type: `string`):

Filter by Brazilian state code (e.g. SP, RJ, MG, PR, SC, RS) or 'ALL' for nationwide lookup.

## `status` (type: `string`):

Registration status with Receita Federal: 'ATIVA' (active companies), 'BAIXADA' (closed/liquidated), or 'ALL'.

## `minCapital` (type: `integer`):

Optional minimum registered capital social in Brazilian Reais (R$).

## `maxCapital` (type: `integer`):

Optional maximum registered capital social in Brazilian Reais (R$).

## `cnaeCode` (type: `string`):

Optional 7-digit primary economic activity code (e.g. '6201501' for software development).

## `onlyMatriz` (type: `boolean`):

If enabled, filters only corporate headquarters (Matriz) and excludes secondary branches (Filiais).

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

Maximum number of company records to push to the dataset.

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

Apify Proxy configuration (direct egress is used by default; proxy can be enabled if required).

## Actor input object example

```json
{
  "searchQueries": [
    "tecnologia"
  ],
  "state": "SP",
  "status": "ATIVA",
  "onlyMatriz": false,
  "maxItems": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Items scraped from the target website.

# 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 = {
    "searchQueries": [
        "tecnologia"
    ],
    "state": "SP",
    "status": "ATIVA",
    "onlyMatriz": false,
    "maxItems": 10,
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("reventadata/cnpj-brasil-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 = {
    "searchQueries": ["tecnologia"],
    "state": "SP",
    "status": "ATIVA",
    "onlyMatriz": False,
    "maxItems": 10,
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("reventadata/cnpj-brasil-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 '{
  "searchQueries": [
    "tecnologia"
  ],
  "state": "SP",
  "status": "ATIVA",
  "onlyMatriz": false,
  "maxItems": 10,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call reventadata/cnpj-brasil-scraper --silent --output-dataset

```

## MCP server setup

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