# CNPJ Lookup — Dados Publicos de Empresas BR (`gangary/cnpj-lookup`) Actor

Recebe uma lista de CNPJs e devolve os dados publicos da Receita (razao social, nome fantasia, CNAE, situacao cadastral, endereco, socios, capital) via BrasilAPI.

- **URL**: https://apify.com/gangary/cnpj-lookup.md
- **Developed by:** [Gangary](https://apify.com/gangary) (community)
- **Categories:** Lead generation, Automation
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 per company fetcheds

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

## CNPJ Lookup — Brazilian Company Registry Data

Send a list of CNPJs (Brazilian company tax IDs) — get back the **official registry data** for each company: legal name, trade name, economic activity (CNAE), registration status, address, partners and share capital. Public data, no login, no API key.

![Cover](https://empresas-por-cnae.vercel.app/covers/cnpj-lookup.png)

**Multi-source with automatic fallback:** the Actor queries BrasilAPI → cnpj.ws → ReceitaWS in order and returns the first source that answers. When one public source is down or rate-limited (it happens weekly), your run keeps working — you don't even notice.

### Input example

```json
{
  "cnpjs": ["11.222.333/0001-81", "00000000000191"]
}
```

Formatted or digits-only, both work. Invalid CNPJs (wrong check digit) are flagged and skipped — they **never crash the run and are never charged**.

### Output example

```json
{
  "cnpj": "11222333000181",
  "cnpj_formatado": "11.222.333/0001-81",
  "razao_social": "EMPRESA EXEMPLO LTDA",
  "nome_fantasia": "Exemplo",
  "situacao": "ATIVA",
  "cnae": { "codigo": 6201501, "descricao": "Desenvolvimento de programas de computador sob encomenda" },
  "porte": "MICRO EMPRESA",
  "capital_social": 10000,
  "data_abertura": "2020-01-01",
  "endereco": { "logradouro": "RUA X", "numero": "100", "bairro": "CENTRO", "municipio": "SAO PAULO", "uf": "SP", "cep": "01000000" },
  "telefone": "1130000000",
  "email": "contato@exemplo.com",
  "socios": [{ "nome": "FULANO DE TAL", "qualificacao": "Sócio-Administrador" }],
  "fonte": "brasilapi"
}
```

### Output fields

| Field | Description |
|---|---|
| `razao_social` | Exact legal name from the federal registry (unmodified). |
| `situacao` | Registration status (ATIVA = active, BAIXADA = closed, etc.). |
| `cnae` | Primary economic activity (code + description). |
| `socios` | Public partner/shareholder list (name + role). |
| `capital_social` | Declared share capital (BRL). |
| `fonte` | Which source answered (`brasilapi`, `cnpj.ws` or `receitaws`). |

### Use cases

- **KYB / vendor screening** — confirm a Brazilian company exists, is active, and who its partners are before signing
- **Lead qualification** — enrich a B2B lead list with official activity, size and location before outreach
- **CRM enrichment** — turn a bare CNPJ column into full firmographic data
- **Compliance checks** — flag companies with BAIXADA/SUSPENSA status in your supplier base

### Pricing (Pay per event)

| Event | When | Price |
|---|---|---|
| `actor-start` | once per run | $0.005 |
| `company-fetched` | once per company successfully returned | $0.01 |

Invalid or not-found CNPJs are **not charged**. A 500-company batch costs $0.005 + 500 × $0.01 = **$5.01**.

### Is this compliant?

Yes — CNPJ registry data is **public information** published by Brazil's Federal Revenue Service (Receita Federal), accessed through public APIs. No login, no private data, no scraping behind authentication.

### Limitations

- Availability depends on the public sources; under heavy rate limiting a few CNPJs may return a temporary error (re-running resolves it — thanks to the fallback this is rare).
- Lookup is **by CNPJ** (you provide the list). Search by filters (state/CNAE) is not in this version.

### From the same maker

- **[Brazilian Companies Finder (CNPJ Discovery)](https://apify.com/gangary/cnpj-discovery)** — don't have the CNPJs yet? Search 27.8M active companies by CNAE activity + state and build the list this Actor consumes.
- **[Lead Enricher & ICP Scorer](https://apify.com/gangary/lead-enricher-icp)** — send raw leads, get them verified, deduplicated and scored 0–100 against your ideal customer profile.
- **[B2B Leads Brazil — Find, Enrich & Score in One Run](https://apify.com/gangary/b2b-leads-brazil)** — the whole funnel in a single run: it discovers the companies by activity + state, pulls each one's contact data and scores every lead 0–100, sorted best-first.

**Full pipeline:** Discovery finds the companies → this Actor pulls the official record → the Enricher scores what's worth contacting. **Want all three in one step?** [B2B Leads Brazil](https://apify.com/gangary/b2b-leads-brazil) runs the whole funnel and returns the finished list.

# Actor input Schema

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

Lista de CNPJs (com ou sem pontuacao). CNPJs invalidos sao marcados no output, nao quebram o run.

## Actor input object example

```json
{
  "cnpjs": [
    "11.222.333/0001-81"
  ]
}
```

# 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": [
        "11.222.333/0001-81"
    ]
};

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

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

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/VM7YLtWTaf9CggC3c/builds/OSyHMDsNamGFtf8Ho/openapi.json
