# Consulta CNPJ (`kairodev/consulta-cnpj`) Actor

API de consulta CNPJ com acesso rápido a dados cadastrais, situação fiscal, endereço, atividades econômicas e muito mais, diretamente da Receita Federal.

- **URL**: https://apify.com/kairodev/consulta-cnpj.md
- **Developed by:** [Kairo](https://apify.com/kairodev) (community)
- **Categories:** Other, Developer tools
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.90 / 1,000 record scrapeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Consulta CNPJ — Receita Federal

Consulte qualquer empresa brasileira pelo CNPJ e obtenha o registro completo direto da Receita Federal: razão social, endereço, atividades, quadro societário, regime tributário e muito mais — tudo em JSON estruturado, pronto para integrar com o seu sistema.

---

### O que este Actor faz

Recebe um CNPJ, consulta a fonte oficial e devolve o cadastro completo da empresa em um único objeto JSON. Os dados incluem situação cadastral, endereço detalhado, sócios com qualificação e faixa etária, CNAEs principal e secundários, natureza jurídica, capital social, dados de contato, e flags de Simples Nacional e MEI.

---

### Para quem é útil

**Times de vendas B2B** — enriqueça seu CRM com dados cadastrais atualizados sem depender de fornecedores externos caros.

**Fintechs e provedores de KYC** — valide o CNPJ de um cliente em tempo real e capture o quadro societário para análise de risco e conformidade com normas de prevenção à lavagem de dinheiro.

**Consultorias tributárias** — identifique de imediato o regime tributário da empresa (Simples Nacional, Lucro Presumido, Lucro Real) e sua situação junto à Receita.

**Seguradoras e provedores de crédito** — pré-preencha formulários de subscrição com data de abertura, capital social, porte e sócios sem custo por chamada de API externa.

**Pesquisadores e jornalistas** — acesse o quadro societário completo com CPFs parcialmente mascarados (conforme publicação oficial da Receita Federal).

---

### Input

Informe apenas o CNPJ desejado. Formatação é opcional — pontos, barras e traços são ignorados automaticamente.

```json
{
  "cnpj": "00000000000191"
}
````

| Campo | Tipo   | Obrigatório | Descrição |
|-------|--------|-------------|-----------|
| `cnpj` | string | Sim | CNPJ com 14 dígitos. Aceita formatado (`00.000.000/0001-91`) ou apenas números. |

***

### Output

O Actor devolve um array com um objeto contendo o cadastro completo da empresa. Veja um exemplo real com o Banco do Brasil:

```json
[
  {
    "status": "OK",
    "consultado_em": "2026-06-18T01:57:25.942Z",
    "fonte": "RECEITA FEDERAL",
    "cnpj": "00.000.000/0001-91",
    "cnpj_numerico": "00000000000191",
    "abertura": "01/08/1966",
    "situacao": "ATIVA",
    "data_situacao": "03/11/2005",
    "motivo_situacao": "SEM MOTIVO",
    "situacao_especial": null,
    "data_situacao_especial": null,
    "tipo": "MATRIZ",
    "nome": "BANCO DO BRASIL SA",
    "fantasia": "DIRECAO GERAL",
    "porte": "DEMAIS",
    "capital_social": "120000000000.00",
    "natureza_juridica": {
      "codigo": "203-8",
      "descricao": "Sociedade de Economia Mista",
      "texto": "203-8 - Sociedade de Economia Mista"
    },
    "atividade_principal": [
      { "code": "64.22-1-00", "text": "Bancos múltiplos, com carteira comercial" }
    ],
    "atividades_secundarias": [
      { "code": "64.99-9-99", "text": "Outras atividades de serviços financeiros não especificadas anteriormente" }
    ],
    "endereco": {
      "logradouro": "QUADRA SAUN QUADRA 5 BLOCO B TORRE I, II, III",
      "numero": "SN",
      "complemento": "ANDAR T I SL S101 A S1602",
      "bairro": "ASA NORTE",
      "municipio": "BRASILIA",
      "uf": "DF",
      "cep": "70.040-912"
    },
    "contato": {
      "email": "secex@bb.com.br",
      "telefone": "(61) 34939002",
      "telefones": ["(61) 34939002"]
    },
    "simples": {
      "optante": false,
      "data_opcao": "01/07/2007",
      "data_exclusao": "01/07/2007",
      "ultima_atualizacao": "2026-06-18T01:57:25.942Z"
    },
    "simei": {
      "optante": false,
      "data_opcao": "01/07/2009",
      "data_exclusao": "01/07/2009",
      "ultima_atualizacao": "2026-06-18T01:57:25.942Z"
    },
    "socios": [
      {
        "nome": "TARCIANA PAULA GOMES MEDEIROS",
        "cpf_cnpj": "***128734**",
        "tipo": "PJ",
        "qualificacao": "Presidente",
        "data_entrada": "26/01/2023",
        "faixa_etaria": 5
      }
    ],
    "ultima_atualizacao": "2026-06-18T01:57:25.942Z"
  }
]
```

***

### Campos do Output

#### Identificação

| Campo | Tipo | Descrição |
|-------|------|-----------|
| `status` | string | `OK` quando a consulta teve sucesso. |
| `fonte` | string | Origem dos dados (`RECEITA FEDERAL`). |
| `cnpj` | string | CNPJ formatado com máscara. |
| `cnpj_numerico` | string | CNPJ apenas com os 14 dígitos. |
| `nome` | string | Razão social da empresa. |
| `fantasia` | string | Nome fantasia (DBA). |
| `tipo` | string | `MATRIZ` ou `FILIAL`. |
| `porte` | string | Porte da empresa: `MICRO EMPRESA`, `EPP` ou `DEMAIS`. |
| `capital_social` | string | Capital social declarado em reais. |

#### Situação Cadastral

| Campo | Tipo | Descrição |
|-------|------|-----------|
| `situacao` | string | `ATIVA`, `SUSPENSA`, `INAPTA`, `BAIXADA` ou `NULA`. |
| `data_situacao` | string | Data em que a situação atual entrou em vigor. |
| `motivo_situacao` | string | Motivo da situação cadastral. |
| `situacao_especial` | string|null | Situação especial, quando aplicável. |
| `data_situacao_especial` | string|null | Data da situação especial. |
| `abertura` | string | Data de abertura da empresa. |

#### Atividades

| Campo | Tipo | Descrição |
|-------|------|-----------|
| `atividade_principal` | array | CNAE principal com código e descrição. |
| `atividades_secundarias` | array | Lista de CNAEs secundários com código e descrição. |
| `natureza_juridica` | object | Código, descrição e texto formatado da natureza jurídica. |

#### Endereço

| Campo | Tipo | Descrição |
|-------|------|-----------|
| `endereco.logradouro` | string | Tipo e nome do logradouro. |
| `endereco.numero` | string | Número. |
| `endereco.complemento` | string | Complemento (sala, andar, bloco). |
| `endereco.bairro` | string | Bairro. |
| `endereco.municipio` | string | Município. |
| `endereco.uf` | string | Estado (sigla de 2 letras). |
| `endereco.cep` | string | CEP formatado. |

#### Contato

| Campo | Tipo | Descrição |
|-------|------|-----------|
| `contato.email` | string | E-mail informado à Receita Federal. |
| `contato.telefone` | string | Telefone principal com DDD. |
| `contato.telefones` | array | Lista de todos os telefones cadastrados. |

#### Regime Tributário

| Campo | Tipo | Descrição |
|-------|------|-----------|
| `simples.optante` | boolean | `true` se a empresa é optante do Simples Nacional. |
| `simples.data_opcao` | string | Data de adesão ao Simples Nacional. |
| `simples.data_exclusao` | string | Data de exclusão do Simples Nacional. |
| `simei.optante` | boolean | `true` se é MEI (Microempreendedor Individual). |
| `simei.data_opcao` | string | Data de adesão ao SIMEI. |
| `simei.data_exclusao` | string | Data de exclusão do SIMEI. |

#### Quadro Societário (QSA)

O campo `socios` é um array de objetos. Cada sócio contém:

| Campo | Tipo | Descrição |
|-------|------|-----------|
| `nome` | string | Nome completo do sócio ou administrador. |
| `cpf_cnpj` | string | CPF mascarado no formato `***123456**` (conforme publicado pela Receita Federal) ou CNPJ da empresa sócia. |
| `tipo` | string | `PF` (pessoa física) ou `PJ` (pessoa jurídica). |
| `qualificacao` | string | Cargo ou qualificação (ex.: Diretor, Presidente, Sócio-Administrador). |
| `data_entrada` | string | Data de entrada no quadro societário. |
| `faixa_etaria` | integer | Faixa etária codificada pela Receita Federal (1 a 9). |

***

### Perguntas Frequentes

**Os CPFs dos sócios ficam expostos?**
Não. A própria Receita Federal publica os CPFs parcialmente mascarados no formato `***123456**`. O Actor retorna exatamente o que consta na fonte oficial, sem qualquer dado sensível adicional.

**Com que frequência os dados são atualizados?**
Os dados refletem o cadastro da Receita Federal, que é atualizado de forma contínua. Alterações como mudança de situação cadastral, troca de sócios e atualização de endereço são refletidas conforme a empresa as reporta ao órgão.

**Funciona para qualquer CNPJ do Brasil?**
Sim. Todos os mais de 55 milhões de CNPJs registrados na Receita Federal podem ser consultados, incluindo empresas ativas, baixadas, inaptas e suspensas.

**Preciso de proxy ou navegador headless?**
Não. O Actor opera via API JSON pura, sem automação de browser, sem captcha e sem necessidade de proxy.

**E se o CNPJ não existir ou estiver inválido?**
O Actor retorna um objeto com `status` indicando o erro, sem interromper a execução ou gerar custos adicionais.

# Actor input Schema

## `cnpj` (type: `string`):

CNPJ da empresa a ser consultada.

## Actor input object example

```json
{}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("kairodev/consulta-cnpj").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("kairodev/consulta-cnpj").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 '{}' |
apify call kairodev/consulta-cnpj --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Consulta CNPJ",
        "description": "API de consulta CNPJ com acesso rápido a dados cadastrais, situação fiscal, endereço, atividades econômicas e muito mais, diretamente da Receita Federal.",
        "version": "0.0",
        "x-build-id": "4njNoDGbm0UP4cBze"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/kairodev~consulta-cnpj/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-kairodev-consulta-cnpj",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/kairodev~consulta-cnpj/runs": {
            "post": {
                "operationId": "runs-sync-kairodev-consulta-cnpj",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/kairodev~consulta-cnpj/run-sync": {
            "post": {
                "operationId": "run-sync-kairodev-consulta-cnpj",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "cnpj"
                ],
                "properties": {
                    "cnpj": {
                        "title": "CNPJ",
                        "type": "string",
                        "description": "CNPJ da empresa a ser consultada."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
