# Brazil CNPJ Company Data Scraper (`straightforward_hydra/cnpj-company-data-scraper`) Actor

Look up any Brazilian company by CNPJ: legal name, trade name, registration status, share capital, CNAE activity, full address, phone, tax regime and the full partner list. Four registry mirrors with automatic failover. No API key.

- **URL**: https://apify.com/straightforward\_hydra/cnpj-company-data-scraper.md
- **Developed by:** [Dev D](https://apify.com/straightforward_hydra) (community)
- **Categories:** Lead generation, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Company Data Scraper

Look up any Brazilian company by **CNPJ** and get its full public registry
record. **No API key, no login, no proxy.**

### What you get

| Field | Example |
| --- | --- |
| `cnpj`, `cnpj_formatted` | 19131243000197, 19.131.243/0001-97 |
| `razao_social`, `nome_fantasia` | OPEN KNOWLEDGE BRASIL, REDE PELO CONHECIMENTO LIVRE |
| `status`, `status_date`, `status_reason` | ATIVA |
| `opened_on` | 2013-10-03 |
| `share_capital` | 0.0 (a real number, not a string) |
| `size`, `legal_nature`, `branch_type` | DEMAIS, Associação Privada, Matriz |
| `cnae_code`, `cnae_description` | 9430800, Atividades de associações… |
| `cnae_secondary` | every secondary activity |
| `street`, `number`, `district`, `city`, `state`, `postal_code` | full address |
| `phone`, `phone_2`, `email` | contact details |
| `simples_optant`, `mei_optant` | tax regime flags |
| `partners`, `partner_count` | name, role, since, age range per partner |
| `is_headquarters` | true when the branch code is 0001 |
| `source` | which mirror answered |

### Why this one is reliable

The registry is mirrored by several free services, and **every one of them rate
limits separately** — ReceitaWS most aggressively. Point a list of 500 companies
at any single mirror and it stops answering partway through.

This Actor queries **four mirrors with automatic failover**: BrasilAPI → Minha
Receita → cnpj.ws → ReceitaWS. When one returns HTTP 429 it is rested for a
minute and the next takes over, and every payload is normalised to the same
field names — so you get one consistent output no matter which one answered.
`source` tells you which did.

### Check digits are validated first

A CNPJ carries two verification digits. Typos are checked locally before a
request is spent, because a mistyped number is otherwise indistinguishable from
a company that simply isn't registered — you'd get "not found" and never know
why.

### Example input

```json
{
  "cnpjs": ["19.131.243/0001-97", "00000000000191"],
  "providers": ["brasilapi", "minhareceita", "cnpjws", "receitaws"]
}
```

Both formats are accepted, and duplicates are removed before lookup so the same
company written two ways is never charged twice.

### Notes

- This **enriches a list of CNPJs**. It cannot search for companies by city or
  sector: none of the public mirrors expose a search endpoint.
- Data comes from the Receita Federal's open company register. Only public
  information is returned.
- Runs stop cleanly before the platform timeout and keep everything collected so
  far, rather than failing.

### Pricing

Pay per result: one `company` event per company returned.

### Support

Found a field that stopped populating, or a mirror that keeps failing? Open an
issue on the Actor's page and include the input you used.

# Actor input Schema

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

The companies to look up. Both formats work: 19131243000197 or 19.131.243/0001-97. Duplicates are removed automatically.

## `providers` (type: `array`):

Which free mirrors of the Receita Federal register to use, tried in the order listed. Each one rate limits separately, so keeping several enabled is what makes long lists finish.

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

Numbers that fail the check-digit test are skipped with a warning. Turn this off to stop the run instead, so a bad list is caught early.

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

Optional. These are open APIs and work without a proxy; enable it if you look up very long lists.

## Actor input object example

```json
{
  "cnpjs": [
    "19.131.243/0001-97",
    "00000000000191"
  ],
  "providers": [
    "brasilapi",
    "minhareceita",
    "cnpjws",
    "receitaws"
  ],
  "skipInvalid": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `companies` (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": [
        "19.131.243/0001-97",
        "00000000000191"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("straightforward_hydra/cnpj-company-data-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": [
        "19.131.243/0001-97",
        "00000000000191",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("straightforward_hydra/cnpj-company-data-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": [
    "19.131.243/0001-97",
    "00000000000191"
  ]
}' |
apify call straightforward_hydra/cnpj-company-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,straightforward_hydra/cnpj-company-data-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/JdCiXhOjcwEGGJq2d/builds/o0SJ9NCxm9zxV7he4/openapi.json
