# Brazil Company Finder (CNPJ Receita Federal) (`tasavera/brazil-cnpj-finder`) Actor

Find active Brazilian companies by CNAE, state, city, size and Simples/MEI, or look up CNPJs in bulk. Official Receita Federal open data (CC BY). No partner names. PT/ES/EN.

- **URL**: https://apify.com/tasavera/brazil-cnpj-finder.md
- **Developed by:** [Tasavera](https://apify.com/tasavera) (community)
- **Categories:** Lead generation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 empresa / 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?

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

## Empresas Brasil CNPJ: busca por CNAE, estado e cidade

**English summary:** Find active Brazilian companies by activity code (CNAE), state, city, size, Simples Nacional and MEI status, opening date, or look up a list of CNPJs. Data: Receita Federal do Brasil, Dados Abertos do CNPJ, license CC BY. Every row has a `fonte` credit. Not affiliated with Receita Federal or the Government of Brazil.

**Resumen en español:** Encuentre empresas activas en Brasil por actividad (CNAE), estado, ciudad, tamaño y régimen Simples/MEI, o consulte CNPJ en lote. Datos oficiales de la Receita Federal (CC BY).

### O que faz

- **Modo buscar (padrão):** empresas ativas filtradas por CNAE (código completo ou prefixo), UF, município, porte, Simples, MEI, matriz/filial, data de abertura, palavras no nome, e só com telefone ou e-mail.
- **Modo CNPJ:** consulta até 10.000 CNPJs por execução. CNPJ inválido ou que não está ativo na base volta com `encontrado: false` e o motivo (sem cobrança).

### Para quem

Equipes de vendas B2B, distribuidores e fornecedores que procuram clientes por atividade e cidade, empresas estrangeiras entrando no Brasil, e agentes de IA que precisam de "restaurantes ativos em Campinas" ou "dados deste CNPJ".

### Entrada

| Campo | Exemplo | Nota |
|---|---|---|
| modo | buscar | buscar ou cnpj |
| ufs | SP | vazio = Brasil todo (mais lento) |
| municipios | Campinas | com ou sem acento |
| cnaes | 5611201 | 7 dígitos ou prefixo (ex.: 47) |
| incluirSecundarios | false | procura também nos CNAEs secundários |
| portes | 01 | 01 ME, 03 EPP, 05 demais |
| simples | todos | todos, sim, nao |
| excluirMei, somenteMatriz, comTelefone, comEmail | false | |
| abertasDesde / abertasAte | 2026-01-01 | data de início de atividade |
| cnpjs | 00.000.000/0001-91 | só no modo cnpj |
| maxItems | 100 | tope de empresas (cada uma é uma cobrança) |

### Campos de saída

cnpj, razao_social, nome_fantasia, matriz_ou_filial, situacao_cadastral, data_inicio_atividade, cnae_principal e descrição, cnaes_secundarios, natureza_juridica, porte, capital_social_brl, opcao_simples, opcao_mei, endereço completo, cep, municipio, uf, telefone_1, telefone_2, email, dados_pessoais_ocultos, licenca, fonte, consultado.

### Preço

Pagamento por empresa entregue. O preço aparece na página da Apify. Consultas sem resultado não são cobradas.

### O que mudamos (aviso de transformação)

Tasavera filtra só estabelecimentos **ativos**, junta os arquivos de estabelecimentos, empresas e Simples, formata CNPJ, CEP e datas (AAAA-MM-DD), converte capital social em número e traduz códigos (CNAE, natureza jurídica, município). Esses passos são nossos, não da Receita. A base é atualizada uma vez por mês, então empresas abertas ou fechadas depois da data da base não aparecem com o status novo.

### Privacidade (LGPD)

- Não incluímos o quadro de sócios.
- Empresário individual e MEI são pessoas físicas: aparecem **sem** nome do titular, telefone e e-mail (`dados_pessoais_ocultos: true`).
- Use os dados com uma finalidade legítima e respeite a LGPD e as regras de contato comercial.

### Fonte e licença

Fonte: Receita Federal do Brasil, Dados Abertos do CNPJ. https://dados.gov.br/dados/conjuntos-dados/cadastro-nacional-da-pessoa-juridica---cnpj e https://arquivos.receitafederal.gov.br/index.php/s/YggdBLfdninEJX9. Licença: Creative Commons Attribution (CC BY). Esta ferramenta não é afiliada à Receita Federal nem ao Governo do Brasil, e a Receita não a endossa.

### Perguntas frequentes

- **Qual a data da base?** Aparece em cada linha, no campo `fonte`.
- **Posso usar com um agente de IA?** Sim: entrada simples e uma tabela clara.
- **Tem empresas baixadas ou inaptas?** Não nesta versão. Só ativas.

# Actor input Schema

## `modo` (type: `string`):

Buscar: encontra empresas ativas por CNAE, estado, cidade e outros filtros. CNPJ: consulta uma lista de CNPJs (14 dígitos, com ou sem pontuação).

## `ufs` (type: `array`):

Siglas, por exemplo SP, RJ, MG. Vazio = Brasil todo (mais lento).

## `municipios` (type: `array`):

Nome da cidade, com ou sem acento. Por exemplo: Campinas, São Paulo, Belo Horizonte.

## `cnaes` (type: `array`):

Código CNAE completo (7 dígitos) ou prefixo (2 a 6 dígitos). Ex.: 5611201 restaurantes, 4930 transporte rodoviário de carga, 47 comércio varejista.

## `incluirSecundarios` (type: `boolean`):

Também procura nos CNAEs secundários (lê mais dados, demora mais).

## `palavrasChave` (type: `array`):

Opcional. Procura na razão social e no nome fantasia.

## `portes` (type: `array`):

Opcional.

## `simples` (type: `string`):

Filtra pela opção pelo Simples Nacional.

## `excluirMei` (type: `boolean`):

MEIs são pessoas físicas: aparecem sem nome do titular, telefone ou e-mail.

## `somenteMatriz` (type: `boolean`):

Somente o estabelecimento matriz (sem filiais).

## `comTelefone` (type: `boolean`):

Somente empresas com telefone publicado.

## `comEmail` (type: `boolean`):

Somente empresas com e-mail publicado.

## `abertasDesde` (type: `string`):

AAAA-MM-DD. Opcional.

## `abertasAte` (type: `string`):

AAAA-MM-DD. Opcional.

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

Somente no modo CNPJ. Até 10.000 por execução.

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

Tope de empresas entregues (cada uma é um cobro).

## Actor input object example

```json
{
  "modo": "buscar",
  "ufs": [
    "SP"
  ],
  "municipios": [
    "Campinas"
  ],
  "cnaes": [
    "5611201"
  ],
  "incluirSecundarios": false,
  "simples": "todos",
  "excluirMei": false,
  "somenteMatriz": false,
  "comTelefone": false,
  "comEmail": false,
  "maxItems": 100
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `resultsJson` (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 = {
    "ufs": [
        "SP"
    ],
    "municipios": [
        "Campinas"
    ],
    "cnaes": [
        "5611201"
    ],
    "maxItems": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("tasavera/brazil-cnpj-finder").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 = {
    "ufs": ["SP"],
    "municipios": ["Campinas"],
    "cnaes": ["5611201"],
    "maxItems": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("tasavera/brazil-cnpj-finder").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 '{
  "ufs": [
    "SP"
  ],
  "municipios": [
    "Campinas"
  ],
  "cnaes": [
    "5611201"
  ],
  "maxItems": 100
}' |
apify call tasavera/brazil-cnpj-finder --silent --output-dataset

```

## MCP server setup

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

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/kNwdQ1uKhvvR9ZaqY/builds/nyy1qVUaf3vzfB4kZ/openapi.json
