# Brazil CNPJ Registry Scraper (`barefoot_grade/brazil-cnpj-scraper`) Actor

Look up Brazilian companies by CNPJ: razão social, nome fantasia, situação cadastral, CNAE activity, full address, capital social and partners (QSA). On-demand company verification and enrichment from public Receita Federal open data — fresh answers every run.

- **URL**: https://apify.com/barefoot_grade/brazil-cnpj-scraper.md
- **Developed by:** [Philip Kirkbride](https://apify.com/barefoot_grade) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.40 / 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.

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 Company Lookup

### Quick Start

Look up Brazilian companies by CNPJ through public open-data mirrors of
Receita Federal's monthly CNPJ datasets. Useful for company research,
onboarding enrichment, prospect research, and counterparty screening; not a
substitute for official, up-to-date verification or KYC due diligence.
Paste this input to start:

```json
{"cnpjs": ["19.131.243/0001-97", "33.000.167/0001-01", "00.000.000/0001-91"]}
```

### Input

| Field | Type | Default | What it does |
|---|---|---:|---|
| `cnpjs` | array | — | One or more CNPJ numbers to look up, formatted or bare. |
| `requestDelaySecs` | number | `0.3` | Polite pause between lookups. |

Provide one or more CNPJs. Formatting is optional, and every number is
check-digit validated before the lookup so typos are caught up front.

### Output

Each item includes `companyKey`, `cnpj`, `cnpjRaiz`, `razaoSocial`,
`nomeFantasia`, `situacaoCadastral`, `dataSituacaoCadastral`,
`dataInicioAtividade`, `matrizFilial`, `naturezaJuridica`,
`codigoNaturezaJuridica`, `porte`, `capitalSocial`, `cnaeFiscal`,
`cnaeFiscalDescricao`, `atividadesSecundarias`, `logradouro`, `numero`,
`complemento`, `bairro`, `cep`, `municipio`, `uf`, `telefone1`, `telefone2`,
`email`, `opcaoPeloSimples`, `opcaoPeloMei`, `qsa`, `regimeTributario`,
`status`, `source`, `sourceQuery`, `matchType`, and `scrapedAt`, plus
`error` on rows with status `ERROR` (every mirror was unavailable for that CNPJ).

Example record:

```json
{"companyKey":"cnpj:19131243000197","cnpj":"19.131.243/0001-97","cnpjRaiz":"19131243","razaoSocial":"OPEN KNOWLEDGE BRASIL","nomeFantasia":"REDE PELO CONHECIMENTO LIVRE","situacaoCadastral":"ATIVA","dataInicioAtividade":"2013-10-03","matrizFilial":"MATRIZ","naturezaJuridica":"Associação Privada","porte":"DEMAIS","capitalSocial":0,"cnaeFiscal":"9430800","cnaeFiscalDescricao":"Atividades de associações de defesa de direitos sociais","municipio":"SAO PAULO","uf":"SP","status":"FOUND"}
```

### FAQ

**What is a CNPJ?** The CNPJ is the 14-character national registry number (digits, or
letters and digits for numbers issued from July 2026) that
identifies every Brazilian company and its establishments.

**How fresh is the data?** Each lookup queries third-party open-data mirrors
at run time, backed by Receita Federal's monthly bulk snapshots. Mirror
refresh schedules vary and can lag the official release. This is not a live
query to the official registry: recent registrations or changes may be absent
or outdated. `scrapedAt` is the lookup time, not the source snapshot date or a
guarantee of freshness; `source` identifies the mirror that answered.

**What if a mirror does not recognize a CNPJ?** The Actor tries other mirrors.
If none returns a record and at least one reports it missing, the result is a
`NOT_FOUND` audit row. This does not prove that the company does not exist:
a recent registration may not yet appear in the mirrors' snapshots.

**Does it include partners and officers?** Yes — `qsa` carries the partners
and administrators with their role and entry date when the registry publishes
them.

**How many CNPJs can I look up?** Up to 100 per run, in one list.

**What happens to missing values?** Fields the registry does not publish for a
company come back as `null`; list fields come back as empty arrays.

### Support

For questions or issues, contact Apify support from the Actor page.

# Actor input Schema

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

One or more CNPJs to look up, e.g. '19.131.243/0001-97'. Accepts bare or standard masked CNPJs, including alphanumeric forms such as '12.ABC.345/01DE-35' (uppercase ASCII letters/digits in the first 12 positions; two numeric check digits). Each CNPJ is checksum-validated before the lookup.

## `requestDelaySecs` (type: `number`):

Polite pause between CNPJ lookups so public sources are not hammered.

## Actor input object example

```json
{
  "cnpjs": [
    "19131243000197",
    "33000167000101",
    "00000000000191"
  ],
  "requestDelaySecs": 0.3
}
```

# Actor output Schema

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

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

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

```

## MCP server setup

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