CNPJ & CEP Bulk Lookup Brazil — Consulta CNPJ e CEP em Lote avatar

CNPJ & CEP Bulk Lookup Brazil — Consulta CNPJ e CEP em Lote

Pricing

$2.00 / 1,000 successful lookups

Go to Apify Store
CNPJ & CEP Bulk Lookup Brazil — Consulta CNPJ e CEP em Lote

CNPJ & CEP Bulk Lookup Brazil — Consulta CNPJ e CEP em Lote

Bulk CNPJ and CEP lookup for Brazil. Validates check digits (incl. new alphanumeric CNPJ) and returns Receita Federal open data: razão social, situação cadastral, CNAE, Simples/MEI, address. CEP to full address. Pay only for results found.

Pricing

$2.00 / 1,000 successful lookups

Rating

0.0

(0)

Developer

Eduardo Yuji Matheus

Eduardo Yuji Matheus

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Share

Brazil CNPJ & CEP Bulk Lookup — Consulta CNPJ e CEP em Lote

Bulk CNPJ lookup and CEP lookup for Brazil in one run. Paste a list or a spreadsheet column of CNPJs (company tax IDs) and CEPs (postal codes). You get one clean row per input: company registry data from Receita Federal open data (razão social, nome fantasia, situação cadastral, CNAE, porte, Simples Nacional/MEI, address) and full addresses for CEPs (street, neighborhood, city, UF, IBGE code, and coordinates when the source has them).

Every CNPJ and CEP is validated locally first (check digits, length, repeated digits), so typos are flagged for free instead of being sent to a data source. You pay only for lookups that return data.

🇧🇷 Português: consulta CNPJ em lote e consulta CEP em lote com dados abertos da Receita Federal. Veja a seção Em português no final desta página.

What does it do?

  • CNPJ + CEP in one Actor: mix both in the same run, or paste a mixed column (bulkText)
  • CNPJ validation: check digits (dígitos verificadores), including the new alphanumeric CNPJ format (IN RFB 2.229/2024)
  • Fixes spreadsheet damage: restores leading zeros lost in Excel (191 → 00.000.000/0001-91, 1001000 → 01001-000)
  • Automatic fallbacks: BrasilAPI → Minha Receita for CNPJ; BrasilAPI → ViaCEP → OpenCEP for CEP
  • Polite to the free public APIs: at most 90 BrasilAPI requests per minute per run (extra lookups go to the fallback source), no retry loops on BrasilAPI rate limits, and exponential backoff on other 429/5xx errors, honoring Retry-After
  • One output row per input with a status field, so results line up with your original spreadsheet
  • Privacy-friendly (LGPD): no partner (QSA/sócios) personal data; the CPF digits that the registry appends to MEI/individual-entrepreneur names are removed; contact details are opt-in
  • Pay only for successful lookups: invalid, duplicate, not-found and failed inputs are free

Use cases

  • Accounting and bookkeeping: check that the CNPJs of clients and suppliers exist, are ATIVA, and whether they opted for Simples Nacional or MEI, before issuing or booking invoices
  • Supplier onboarding and KYB (know your business): verify registration status, opening date, legal nature, main CNAE and registered address of a new supplier or B2B customer
  • E-commerce address validation and checkout: turn a CEP into street, neighborhood, city and UF to autofill checkout forms, validate shipping addresses and reduce failed deliveries
  • CRM and ERP data cleaning: normalize and validate CNPJ/CEP columns before an import, and flag invalid or duplicate values
  • B2B segmentation: group companies you already have by CNAE, size (porte), state or tax regime

Input

FieldTypeDescription
cnpjsarray of stringsCNPJs in any format (33.000.167/0001-01, 33000167000101, 191)
cepsarray of stringsCEPs in any format (01001-000, 01001000, 1001000)
bulkTextstringMixed list pasted from a spreadsheet (new lines, tabs, spaces, commas or semicolons). Rule: letters or 9-14 digits = CNPJ; 7-8 digits = CEP (1001000 → 01001-000); 1-6 digits = CNPJ that lost its leading zeros (191 → 00.000.000/0001-91, no CEP is that short)
bulkTextTypestring (default auto)How to read bulkText: auto (rule above), cnpj (every value is a CNPJ, zero-padded to 14 digits) or cep (every value is a CEP, zero-padded to 8). Use it for the rare CNPJ that lost 6+ leading zeros and would otherwise be read as a CEP
includeContactInfoboolean (default false)Adds the establishment's phone/fax/e-mail as published in the registry
padLeadingZerosboolean (default true)Restores leading zeros lost in Excel
deduplicateboolean (default true)Each unique value is looked up (and charged) once
maxConcurrencyinteger (default 3, max 10)Parallel requests; kept low to respect the free public APIs
maxRetriesinteger (default 4, max 8)Retries per source on 429/5xx before falling back to the next source
requestTimeoutSecsinteger (default 15, max 60)Timeout per HTTP request

Input example

This is the input of a real test run (one valid CNPJ, one CNPJ with a wrong check digit, one CEP):

{
"cnpjs": ["33.000.167/0001-01", "33000167000102"],
"ceps": ["01001000"]
}

Output

One dataset item per input. Export as JSON, CSV, Excel, XML or HTML, or read it through the API. The dataset has three views: Overview, CNPJ companies and CEP addresses. A SUMMARY record in the key-value store holds the counts per status.

status is one of success, not_found, invalid_input, duplicate or error. Only success is charged, and each row tells you whether it was charged (charged).

Output example: CNPJ

From the test run above (secondaryCnaes shortened from 5 to 2 entries):

{
"inputType": "cnpj",
"input": "33.000.167/0001-01",
"normalized": "33000167000101",
"formatted": "33.000.167/0001-01",
"status": "success",
"errorMessage": null,
"source": "brasilapi",
"legalName": "PETROLEO BRASILEIRO S A PETROBRAS",
"tradeName": "PETROBRAS - EDISE",
"registrationStatus": "ATIVA",
"registrationStatusDate": "2005-11-03",
"registrationStatusReason": "SEM MOTIVO",
"specialSituation": null,
"openingDate": "1966-09-28",
"establishmentType": "MATRIZ",
"legalNature": "Sociedade de Economia Mista",
"legalNatureCode": "2038",
"companySize": "DEMAIS",
"shareCapital": 205431960000,
"mainCnae": "0600001",
"mainCnaeDescription": "Extração de petróleo e gás natural",
"secondaryCnaes": [
{ "code": "1921700", "description": "Fabricação de produtos do refino de petróleo" },
{ "code": "3520401", "description": "Produção de gás; processamento de gás natural" }
],
"simplesNacional": null,
"mei": null,
"latestTaxRegime": "LUCRO REAL",
"address": {
"streetType": "AVENIDA",
"street": "REPUBLICA DO CHILE",
"number": "65",
"complement": null,
"neighborhood": "CENTRO",
"city": "RIO DE JANEIRO",
"state": "RJ",
"cep": "20031170",
"ibgeCityCode": "3304557"
},
"partnersCount": 8,
"charged": true,
"fetchedAt": "2026-09-28T17:22:09.145Z"
}

Output example: CEP

{
"inputType": "cep",
"input": "01001000",
"normalized": "01001000",
"formatted": "01001-000",
"status": "success",
"errorMessage": null,
"source": "brasilapi",
"street": "Praça da Sé",
"complement": null,
"neighborhood": "Sé",
"city": "São Paulo",
"state": "SP",
"ibgeCityCode": "3550308",
"latitude": -23.5503898,
"longitude": -46.633081,
"ddd": null,
"charged": true,
"fetchedAt": "2026-09-28T17:22:09.368Z"
}

ddd (area code) is filled when the address comes from ViaCEP or OpenCEP; latitude/longitude when it comes from BrasilAPI and the coordinates are known.

Output example: invalid input (free)

{
"inputType": "cnpj",
"input": "33000167000102",
"normalized": null,
"formatted": null,
"status": "invalid_input",
"errorMessage": "Invalid check digits (dígitos verificadores)",
"source": null,
"charged": false,
"fetchedAt": "2026-09-28T17:22:08.796Z"
}

Pricing

This Actor uses pay per event pricing:

Chargedresult event: US$0.002 per successful lookup (US$2 per 1,000), i.e. each CNPJ or CEP that returns data (status: "success")
FreeInvalid inputs, duplicates (with deduplicate on), not found, and errors after all retries and fallbacks
NoStart fee or monthly rental

The test run above had 3 inputs and 2 successful lookups, so it cost US$0.004 in events. The current price is always shown on the Actor's Pricing tab.

To cap your spend, set "Max cost per run" in the run options (or maxTotalChargeUsd in the API). The Actor checks the remaining budget before every lookup, stops when the budget is reached, and reports in SUMMARY how many inputs were not processed. It never charges beyond your limit.

Integrations and API

You can run the Actor from Apify Console, on a schedule, or from your own code, and send the results to other tools.

  • Apify API: start a run and read the dataset over HTTP. For small lists, the run-sync-get-dataset-items endpoint returns the rows in the same request:
curl -X POST "https://api.apify.com/v2/acts/brasil_utils~brazil-cnpj-cep-bulk-lookup/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"cnpjs": ["33.000.167/0001-01"], "ceps": ["01001-000"]}'
  • Make, Zapier and n8n: use Apify's integrations for these platforms ("Run an Actor" / "Get dataset items" steps) to look up a CNPJ or CEP whenever a new row, form submission or CRM record arrives.
  • Webhooks, Google Sheets, Slack and more: available in the Actor's Integrations tab in Apify Console.

JavaScript / TypeScript (npm install apify-client):

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('brasil_utils/brazil-cnpj-cep-bulk-lookup').call({
cnpjs: ['33.000.167/0001-01'],
ceps: ['01001-000'],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items.map((i) => [i.formatted, i.status, i.legalName ?? i.city]));

Python (pip install apify-client):

import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("brasil_utils/brazil-cnpj-cep-bulk-lookup").call(
run_input={"cnpjs": ["33.000.167/0001-01"], "ceps": ["01001-000"]}
)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item["formatted"], item["status"], item.get("legalName") or item.get("city"))

Data sources and limits

  • CNPJ data comes from the official open data (dados abertos) published by Receita Federal, served by the free, open-source APIs BrasilAPI (primary) and Minha Receita (fallback).
  • CEP data comes from BrasilAPI, ViaCEP and OpenCEP, in that order.
  • The Actor does not scrape the Receita Federal website, does not solve captchas and is not affiliated with Receita Federal, Correios or the API providers.
  • Freshness: Receita Federal publishes the CNPJ dataset monthly, so changes from the last few weeks may be missing.
  • Speed: about 2–5 lookups per second with the default concurrency of 3 (roughly 1,000 inputs in 5–8 minutes). 256 MB of memory is enough.
  • Public API limits: the sources are free community services without an SLA, and none of them is meant for heavy bulk traffic. BrasilAPI has no published limit, but its maintainers apply ad-hoc rules of about 100 requests per 60 seconds to bulk traffic (BrasilAPI issue #684). So the Actor:
    • sends at most 90 requests per minute to BrasilAPI in each run; lookups above that go straight to the fallback (Minha Receita for CNPJ, ViaCEP then OpenCEP for CEP) instead of waiting;
    • on a BrasilAPI 429 or 403 (edge rate limit / bot protection, sent without Retry-After), does not retry: it uses the fallback and pauses BrasilAPI for 60 seconds;
    • retries the other sources with exponential backoff on 429/5xx/timeouts, honoring Retry-After, and uses low concurrency (default 3);
    • uses BrasilAPI again at the end of the chain if the fallbacks fail, waiting for a free slot. If every source fails for an input, that row gets status: "error" and is not charged, so you can re-run just those inputs. The source field of each row tells you which API answered.
  • Not included: partner names (QSA), state registration (inscrição estadual), search by CNAE/city (this Actor looks up CNPJs you already have).

FAQ

How do I look up a list of CNPJs from Excel? Copy the column and paste it into cnpjs (or paste a mixed CNPJ/CEP column into bulkText), run the Actor, then export the dataset as Excel or CSV.

Does it return partners (sócios / QSA)? No. Only partnersCount is returned. Names of individuals are personal data under LGPD and are intentionally excluded. For individual entrepreneurs (natureza jurídica 213-5, which includes MEI), the CPF digits that the registry appends to the company name are removed.

Does it return phone and e-mail? Only if you enable includeContactInfo, and only what the company published in the registry. You are responsible for having a legal basis under LGPD to use it.

Does it support the new alphanumeric CNPJ? Yes for validation (check digits). Lookups will work as soon as the public data sources publish those CNPJs.

Can I check if a CNPJ is active (situação cadastral)? Yes. registrationStatus is ATIVA, BAIXADA, INAPTA, SUSPENSA or NULA, with the date and reason.

What happens with an invalid or non-existent CNPJ or CEP? You still get a row, with status set to invalid_input or not_found and an errorMessage. These rows are free.

Is this an official Receita Federal API? No. It uses Receita Federal's public open data through community APIs, which is the same data the official CNPJ files contain.


🇧🇷 Em português

Consulta CNPJ em lote e consulta CEP em lote, com dados abertos da Receita Federal. Cole uma lista ou uma coluna da sua planilha e receba uma linha por item com razão social, nome fantasia, situação cadastral, data de abertura, CNAE principal e secundários, natureza jurídica, porte, opção pelo Simples Nacional e MEI, capital social e endereço completo. Para CEP: logradouro, bairro, cidade, UF, código IBGE e, quando a fonte informa, DDD e coordenadas.

O que o Actor faz

  • Valida localmente os dígitos verificadores do CNPJ, inclusive o novo CNPJ alfanumérico, e o formato do CEP
  • Corrige zeros à esquerda perdidos no Excel
  • Usa fontes com redundância: BrasilAPI e Minha Receita (CNPJ); BrasilAPI, ViaCEP e OpenCEP (CEP)
  • Respeita os limites das APIs públicas gratuitas: no máximo 90 consultas por minuto à BrasilAPI em cada execução (o excedente vai para a fonte reserva) e sem repetir consultas quando a BrasilAPI responde 429
  • Retorna uma linha por item de entrada, com o campo status, para a planilha continuar alinhada
  • Não retorna dados pessoais de sócios (QSA) e remove o CPF que aparece no nome de empresários individuais e MEI (LGPD)

Casos de uso

  • Contabilidade e escritórios contábeis: conferir se o CNPJ de clientes e fornecedores está ativo e se é optante do Simples Nacional ou MEI
  • Cadastro e homologação de fornecedores (KYB): validar situação cadastral, data de abertura, natureza jurídica, CNAE e endereço
  • E-commerce e checkout: preencher o endereço automaticamente a partir do CEP e validar o endereço de entrega
  • Higienização de CRM e ERP: padronizar e validar colunas de CNPJ e CEP antes de importar

Preço

US$0,002 por consulta com sucesso (US$2 por 1.000). CNPJ ou CEP inválido, duplicado, não encontrado ou com erro não é cobrado. Sem taxa de início e sem mensalidade. Use o limite "Max cost per run" para definir o valor máximo por execução.

Integração

Rode pelo Apify Console, agende execuções ou chame pela API do Apify (exemplos em JavaScript, Python e curl acima). Também dá para conectar ao Make, Zapier e n8n pelas integrações do Apify e exportar os resultados em Excel, CSV ou JSON.

Perguntas frequentes

De onde vêm os dados? Dos dados abertos do CNPJ publicados pela Receita Federal, via BrasilAPI (principal) e Minha Receita (reserva). Os CEPs vêm de BrasilAPI, ViaCEP e OpenCEP, nessa ordem. O campo source de cada linha mostra qual API respondeu. O Actor não faz scraping do site da Receita e não é um serviço oficial.

Tem limite de consultas? As fontes são serviços comunitários gratuitos, sem SLA, e não foram feitas para uso pesado em lote. A BrasilAPI não publica um limite, mas os mantenedores aplicam regras pontuais de cerca de 100 requisições a cada 60 segundos para tráfego em lote (issue #684). Por isso o Actor envia no máximo 90 requisições por minuto à BrasilAPI em cada execução e manda o excedente para a fonte reserva (Minha Receita para CNPJ; ViaCEP e OpenCEP para CEP). Se a BrasilAPI responder 429 ou 403, o Actor não insiste: usa a reserva e pausa a BrasilAPI por 60 segundos. As outras fontes recebem novas tentativas com espera exponencial. Se todas as fontes falharem, a linha sai com status: "error" e não é cobrada.

Os dados são atualizados? A Receita Federal publica a base mensalmente; alterações muito recentes podem ainda não aparecer.

Retorna sócios, telefone e e-mail? Sócios não (apenas a quantidade). Telefone e e-mail só com a opção includeContactInfo ativada.