# CNPJ Brazil Company Registry Lookup (`vivid_astronaut/cnpj-receita`) Actor

Look up Brazilian CNPJ registry records by tax id or company name and UF: status, CNAE, address, partners. Pay per result.

- **URL**: https://apify.com/vivid\_astronaut/cnpj-receita.md
- **Developed by:** [BRAINIALL Team](https://apify.com/vivid_astronaut) (community)
- **Categories:** Lead generation, Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 66.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.50 / 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?

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

## CNPJ Brazil Company Registry Lookup

Look up Brazilian **CNPJ** registry records by tax id or legal name + UF. Each returned company includes status, CNAE, size, address, public partners and share capital. Built for growth teams, agencies and analysts who need cadastral data in **Brazil** without maintaining their own collector. Collection prefers the Brainiall engine and falls back to direct HTTP that honours `robots.txt`, rate limits and retries. Public registry data only. CNPJ values are cached for the duration of the run so duplicates are not billed twice.

### What it does

Provide a list of CNPJ ids (`cnpjs`) **or** a legal name (`razaoSocial`), optionally with `uf`. The Actor looks up each id (punctuation optional) and writes one dataset item per company. Name search walks up to `pages` result pages and stops at `limit` records. Empty or blank registry bodies are reported as errors (exit code 1). A valid empty search returns zero items and does not charge `result`. Local default is plan / dry-run. Live collection needs `--confirm` and runtime keys. Keys are never stored in files.

### Why this Actor

- **Cadastral fields, normalized.** CNPJ, legal name, trade name, status, CNAE, size, capital, address, public partners and opening date in one item.
- **Id or name.** Paste a list of tax ids, or search by razão social + UF when you do not have the number yet.
- **Run-level cache.** The same CNPJ looked up twice in one run is not billed twice.

### Input

| Field | Type | Default |
|-------|------|---------|
| `cnpjs` | array of string | — (provide `cnpjs` **or** `razaoSocial`) |
| `razaoSocial` | string | — |
| `uf` | string | — |
| `limit` | integer | `50` |
| `pages` | integer | `1` |

```json
{
  "cnpjs": ["00.000.000/0001-91"],
  "razaoSocial": "",
  "uf": "DF",
  "limit": 50,
  "pages": 1
}
```

### Output

One dataset item per company. Example taken from the Actor test fixtures:

```json
{
  "cnpj": "00000000000191",
  "razao_social": "BANCO DO BRASIL SA",
  "nome_fantasia": "DIRECAO GERAL",
  "situacao": "ATIVA",
  "cnae": "6422100",
  "cnae_descricao": "Bancos múltiplos, com carteira comercial",
  "porte": "DEMAIS",
  "capital_social": 120000000000.0,
  "endereco": {
    "logradouro": "SAUN QUADRA 5 BLOCO B TORRE I ANDAR 1 A 16",
    "numero": "S/N",
    "complemento": "LOTE C",
    "bairro": "ASA NORTE",
    "municipio": "BRASILIA",
    "uf": "DF",
    "cep": "70040912"
  },
  "socios": [
    {"nome": "TARCISIO GIOCOTTI PATCHETT", "qualificacao": "Diretor"}
  ],
  "data_abertura": "1966-08-01",
  "natureza_juridica": "Sociedade de Economia Mista"
}
```

### Pricing

Pay-per-event from the Actor listing (USD):

| Event | USD |
|-------|-----|
| **result** (primary) | **$0.0012** per company record |
| **run-start** | **$0** |

Worked cost example:

- 50 companies → **$0.06**
- 1,000 companies → **$1.20**

Failed items are not billed. No monthly minimum.

### Use cases

1. **KYC / onboarding** — resolve a Brazilian CNPJ to status, CNAE, address and public partners before opening an account.
2. **Lead enrichment** — attach cadastral fields to a list of tax ids already in your CRM.
3. **Name search** — find companies by razão social + UF when the CNPJ is not yet known.

### FAQ

**Must I send CNPJs with punctuation?** No. `00.000.000/0001-91` and `00000000000191` both work. Digits are normalized to 14 characters.

**Are private partner tax ids returned?** Public partner names and roles from the registry payload are returned. Do not use this Actor to harass people or bypass access controls.

**What is the rate limit?** About 1 request per second between lookups. Honor `robots.txt` and the source limits.

### Limits

- 500 records per run.
- About 1 request/second between lookups.
- Empty or blank pages are reported as errors (exit code 1). A valid empty search returns zero items.
- Public registry data only. Local default is plan/dry-run. Live collection needs `--confirm` and `BRAINIALL_API_KEY` / `APIFY_TOKEN` at runtime.

***

Built and maintained by [Brainiall](https://www.brainiall.com).

# Actor input Schema

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

Company tax ids to look up. Punctuation is optional. Each id is cached for the duration of the run.

## `razaoSocial` (type: `string`):

Optional legal name used to search when a CNPJ list is not provided. Combine with UF to narrow results.

## `uf` (type: `string`):

Brazilian state abbreviation (e.g. SP, RJ, DF) applied to name search.

## `limit` (type: `integer`):

Maximum number of company records to return.

## `pages` (type: `integer`):

Maximum number of search pages to read when looking up a company name.

## Actor input object example

```json
{
  "cnpjs": [
    "00.000.000/0001-91"
  ],
  "limit": 50,
  "pages": 1
}
```

# Actor output Schema

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

All normalized items delivered by this run.

## `datasetItems` (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": [
        "00.000.000/0001-91"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("vivid_astronaut/cnpj-receita").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": ["00.000.000/0001-91"] }

# Run the Actor and wait for it to finish
run = client.actor("vivid_astronaut/cnpj-receita").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": [
    "00.000.000/0001-91"
  ]
}' |
apify call vivid_astronaut/cnpj-receita --silent --output-dataset

```

## MCP server setup

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

```

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/mMYh8GrrudQaF6TfO/builds/xVofxZhNziQVOhRaI/openapi.json
