# Brazil CNPJ Lookup - Company Data from Receita Federal (`webdata_labs/brazil-cnpj-lookup`) Actor

\[💵 $2.00 / 1K] Clean English firmographics for any Brazil CNPJ: legal/trade name, status, size tier, CNAE sector, age, tax regime, partners, phone & address - decoded from the raw Receita Federal codes and mojibake, not a Portuguese dump.

- **URL**: https://apify.com/webdata\_labs/brazil-cnpj-lookup.md
- **Developed by:** [WebData Labs](https://apify.com/webdata_labs) (community)
- **Categories:** Lead generation, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.50 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Brazil CNPJ Lookup - Company Data from Receita Federal

**One clean English row for any Brazil CNPJ.** Paste a list of CNPJ numbers and get analysis-ready company records: legal and trade name, registration status, company size tier, CNAE sector, company age, tax regime, partners, phone, and a composed address - decoded from the raw Receita Federal codes, with the accent mojibake fixed.

Brazil's official company data (Receita Federal, served through public open-data endpoints) is a Portuguese-only mess: registration status, company size, branch type and partner roles are bare **numeric codes**; the main activity is a **7-digit CNAE number** with the leading zero dropped; the address is split across six fragments; the tax regime is buried in flags; and accented text comes back **double-encoded** (`AssociaÃ§Ãµes` instead of `Associações`). Most "CNPJ scrapers" hand you that raw dump. This Actor does the hard part: it repairs the encoding, decodes every code to an **English** label, resolves the CNAE to a human **sector**, derives lead-quality signals (`isActive`, `companyAgeYears`, `sizeTier`, `taxRegime`, `isHeadquarters`, `hasForeignPartner`), composes the address and formats the phone, and returns **one consistent row** every time. Two public sources are used with automatic failover for reliability.

### ✅ What you get / ❌ what this isn't

| This Actor gives you | This Actor is not |
|---|---|
| One normalized row per CNPJ, English-labeled, identical shape every time | Not a raw Portuguese Receita Federal dump |
| Numeric codes decoded: status, size, branch, partner roles | Not affiliated with or endorsed by Receita Federal or the Brazilian government |
| CNAE resolved to an English **sector**, leading zero repaired | Not a CNPJ-discovery tool - you supply the CNPJs to enrich |
| Lead signals: `isActive`, `companyAgeYears`, `sizeTier`, `taxRegime`, `isHeadquarters` | Not a credit-score, KYC, or background-check service |
| Mojibake accents repaired to proper UTF-8 | Not real-time - reflects the Receita Federal open-data cadence |
| Dual public source with automatic failover | Not a guarantee that every CNPJ exposes a phone or email |

### 🔎 Why use this Actor

- Enrich a list of CNPJs (from invoices, NF-e, a partial scrape, or a CRM) into clean firmographics.
- Validate vendors and customers by registration status (`isActive`) before onboarding.
- Qualify B2B leads by sector, size tier, company age, and tax regime in one pass.
- Get **English** firmographics for an international pipeline instead of Portuguese-only codes.
- Feed normalized company data into a CRM, dashboard, model, or LLM workflow.
- Skip the plumbing - code decoding, CNAE sector mapping, encoding repair, and address composition are done.

### 👥 Who it's for

- Brazil B2B sales and marketing teams building and cleaning prospect lists.
- Operations / procurement teams validating supplier CNPJs at onboarding.
- Fintech, lending, and compliance teams needing structured firmographics.
- Data teams and agencies enriching Brazilian company datasets at scale.
- Anyone who wants one tidy English schema instead of a Receita Federal parsing project.

### 🗂️ What data you get

One row per CNPJ:

| Field | Type | Description |
|---|---|---|
| `cnpj`, `cnpjFormatted` | string | 14-digit CNPJ and its `00.000.000/0000-00` form |
| `legalName`, `tradeName` | string | Razão social and nome fantasia (mojibake repaired) |
| `status`, `statusPt`, `isActive` | string / boolean | Registration status in English + Portuguese, plus an active flag |
| `sizeTier`, `sizePt` | string | Company size: `MICRO` / `SMALL` / `OTHER` (+ Portuguese) |
| `shareCapital` | number | Declared share capital as a number |
| `branchType`, `isHeadquarters` | string / boolean | `HEADQUARTERS` / `BRANCH` (matriz / filial) |
| `openingDate`, `companyAgeYears` | string / number | Activity start date and derived age in years |
| `primaryActivityCode`, `primaryActivity` | string | 7-digit CNAE (zero-padded) and its description |
| `sector` | string | English CNAE sector label (Manufacturing, Information & communication, ...) |
| `secondaryActivities` | array | Secondary CNAE codes + descriptions |
| `legalNature`, `legalNatureCode` | string | Natureza jurídica label and code |
| `taxRegime` | string | `MEI` / `SIMPLES_NACIONAL` / `NORMAL` / `UNKNOWN` |
| `email`, `phone`, `phoneSecondary` | string | Email and phones formatted as `+55 (DDD) ...` |
| `address`, `city`, `state`, `zip`, `cityIbgeCode` | string | Composed street address + structured location |
| `partnerCount`, `hasForeignPartner`, `partners[]` | number / boolean / array | Partner (QSA) count, foreign-partner flag, and clean partner rows |

### Example tasks

- [Enrich a list of CNPJ numbers into clean company data](https://apify.com/webdata_labs/brazil-cnpj-lookup/examples/enrich-cnpj-list)
- [Validate supplier CNPJs by registration status](https://apify.com/webdata_labs/brazil-cnpj-lookup/examples/validate-supplier-cnpjs)
- [Build an English firmographic profile for a Brazilian company](https://apify.com/webdata_labs/brazil-cnpj-lookup/examples/english-firmographic-profile)

### ⚙️ How to enrich CNPJ data

1. Open the Actor on Apify.
2. Paste one or more CNPJ numbers into `cnpjs` (comma, space, or new line separated; punctuation is fine).
3. Optionally set `maxItems` and toggle `includeRaw` to keep the original record.
4. Run the Actor and open the `Companies` dataset view.
5. Export JSON, CSV, Excel, HTML, or XML, or call the Actor through the Apify API.

### 📥 Input

```json
{
  "cnpjs": "47.960.950/0001-21, 33000167000101, 19131243000197",
  "maxItems": 1000,
  "includeRaw": false
}
```

### 📤 Output

```json
{
  "recordType": "company",
  "cnpj": "47960950000121",
  "cnpjFormatted": "47.960.950/0001-21",
  "legalName": "MAGAZINE LUIZA S/A",
  "tradeName": "MAGALU",
  "status": "ACTIVE",
  "isActive": true,
  "sizeTier": "OTHER",
  "sector": "Wholesale & retail trade; vehicle repair",
  "primaryActivityCode": "4713004",
  "primaryActivity": "Lojas de departamentos ou magazines",
  "companyAgeYears": 59.7,
  "taxRegime": "NORMAL",
  "shareCapital": 14202162000.0,
  "branchType": "HEADQUARTERS",
  "isHeadquarters": true,
  "phone": "+55 (16) 3711-2002",
  "address": "RUA VOLUNTARIOS DA FRANCA, 1465, CENTRO, FRANCA - SP, 14400-490",
  "city": "FRANCA",
  "state": "SP",
  "partnerCount": 3,
  "hasForeignPartner": false
}
```

### 💵 How much does it cost?

The launch price is about `$2.00 / 1,000 companies`, tier-discounted for higher Apify plans. One company row is one charged result. A run enriching 500 CNPJs is 500 results. Invalid and not-found rows are not charged.

### 🔁 Run it on the Apify platform

Schedule a recurring run to keep a CNPJ list fresh (status changes, new branches), call it from the Apify API, export to CSV/JSON/Excel, or connect the dataset to Make, Zapier, webhooks, a warehouse, a CRM, or an LLM pipeline.

### ⚠️ Limits and caveats

- This Actor reads **public Receita Federal open-data endpoints**. It is not affiliated with the Brazilian government and returns only data already public in the CNPJ registry.
- **You supply the CNPJs.** This is an enrichment/validation Actor, not a company-discovery search over the full registry.
- **Field coverage varies.** Not every company publishes an email or a second phone. Missing fields are returned as `null` rather than guessed.
- **`sector` is the CNAE division label** for the primary activity; the exact 7-digit code and full secondary list are always preserved.
- Personal identifiers of partners (CPF) are masked at source; only the public partner name, role, and entry date are returned.
- Data reflects the Receita Federal open-data refresh cadence, not real time.

### 🧩 Related Actors

- [Clinical Trials API](https://apify.com/webdata_labs/clinical-trials-api) - ClinicalTrials.gov records in a flat, queryable shape.
- [EU Tenders API](https://apify.com/webdata_labs/eu-tenders-api) - TED public procurement notices, normalized.
- [GLEIF LEI Company Registry Scraper](https://apify.com/webdata_labs/gleif-lei-company-registry-scraper) - legal entity records and ownership, decoded into readable firmographics.
- [Polymarket & Kalshi Scraper](https://apify.com/webdata_labs/prediction-markets-scraper) - prediction-market odds as a forward-looking signal.
- [Buyer Fit Brief API](https://apify.com/webdata_labs/buyer-fit-brief-api) - score a finished lead list against your ideal customer profile.

### ❓ FAQ

#### What is a CNPJ?

The CNPJ (Cadastro Nacional da Pessoa Jurídica) is Brazil's national company registration number. Every legal entity has one. This Actor turns a CNPJ into a clean, English-labeled firmographic record.

#### Where does the data come from?

From public open-data endpoints over the official Receita Federal CNPJ dataset. The Actor uses two sources with automatic failover, so a rate limit on one does not fail your run.

#### Can it find companies by sector or city?

No. This Actor enriches CNPJs you already have. It is built for validation and lead enrichment, not discovery over the full registry.

#### Why is the sector in English but the activity description in Portuguese?

The `sector` is a normalized English label derived from the CNAE division so you can group and filter internationally. The `primaryActivity` keeps the official Portuguese description for exactness.

#### Why were the accents broken before, and are they fixed?

The source feeds return accented text double-encoded (mojibake). This Actor detects and repairs it, so `Associações` comes back correctly, not `AssociaÃ§Ãµes`.

#### Does it need a proxy?

No. The sources are public official endpoints served reliably to datacenter IPs. Enable Apify Proxy only for very large batches.

### 🛠️ Support

For bugs, missing fields, or a feature request, open an Actor issue with the run URL, the CNPJs used, and the field or behavior you expected.

### ⭐ Rate this Actor

If this Actor saved you time, please take 30 seconds to leave a review on the **Reviews** tab of [Brazil CNPJ Lookup - Company Data from Receita Federal](https://apify.com/webdata_labs/brazil-cnpj-lookup) - reviews are the main trust signal other users see, and they directly decide which features get built next. If something is broken or a field is missing, please [open an issue](https://apify.com/webdata_labs/brazil-cnpj-lookup/issues) first - we typically respond within a day and would love the chance to fix it before you rate.

# Actor input Schema

## `cnpjs` (type: `string`):

One or more Brazilian CNPJ numbers, separated by comma, space or new line. Punctuation is fine - '19.131.243/0001-97' and '19131243000197' both work. Each valid CNPJ returns one normalized company row.

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

Safety cap on how many CNPJs to enrich in one run.

## `includeRaw` (type: `boolean`):

Attach the original unnormalized Receita Federal record under 'raw' for auditing. Off by default to keep rows clean.

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

Optional. The CNPJ data sources are public official endpoints and work without a proxy; enable Apify Proxy only for very large batches.

## Actor input object example

```json
{
  "cnpjs": "47960950000121, 19131243000197",
  "maxItems": 1000,
  "includeRaw": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `companies` (type: `string`):

One normalized row per CNPJ: name, status, size, CNAE sector, age, tax regime, phone, address - in clean English.

## `errors` (type: `string`):

CNPJs that could not be retrieved or were invalid.

## `OUTPUT` (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": "47960950000121, 19131243000197"
};

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

# Run the Actor and wait for it to finish
run = client.actor("webdata_labs/brazil-cnpj-lookup").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": "47960950000121, 19131243000197"
}' |
apify call webdata_labs/brazil-cnpj-lookup --silent --output-dataset

```

## MCP server setup

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

```

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/ppgPbneG97mqBBkCk/builds/GAbzlGt7KimfuHajj/openapi.json
