DEV Community

rodrigo da silva
rodrigo da silva

Posted on

Building on Brazilian public data: a developer's field guide (CNPJ, CEP, Congress, BACEN)

After working with Brazilian government data for a while, I've found the landscape confusing to navigate. Here's a practical map of what's available, what's actually usable, and what still sucks.

The good: what actually works

CNPJ / Company Registry (Receita Federal)

Best source for: any product that needs to verify, enrich, or display Brazilian company data.

The public dataset covers 65M+ registrations with full address, economic activity (CNAE), partner/director list (QSA), and contact info when declared. Updated monthly.

  • Raw dump: dados.gov.br (~7GB compressed CSV)
  • Already indexed + searchable: Jurídico Online — works for company name, CNPJ, or partner name lookups. Free.

Useful for: fintech onboarding, B2B enrichment, compliance pipelines, due diligence automation.

CEP / Address (multiple sources)

ViaCEP is the go-to. Free, no key required, returns full address from 8-digit ZIP.

curl https://viacep.com.br/ws/01310100/json/
Enter fullscreen mode Exit fullscreen mode

BrasilAPI aggregates multiple sources and handles fallback.

IBGE Localities

5,571 municipalities with IDs, state codes, population (from census). Clean REST API, no auth.

curl https://servicodados.ibge.gov.br/api/v1/localidades/municipios
Enter fullscreen mode Exit fullscreen mode

Essential for any location-based feature in Brazil. The codmun field links to dozens of other IBGE datasets.

BACEN (Central Bank)

Surprisingly good API. Time series for SELIC, IPCA, exchange rates, bank data.

# Last 5 SELIC values
curl "https://api.bcb.gov.br/dados/serie/bcdata.sgs.11/dados/ultimos/5?formato=json"
Enter fullscreen mode Exit fullscreen mode

No auth needed. Rate limits exist but are generous for normal usage.

Câmara dos Deputados

Full voting records, expenses, profiles for all 513 deputies. Well-maintained REST API.

curl "https://dadosabertos.camara.leg.br/api/v2/deputados?itens=10"
Enter fullscreen mode Exit fullscreen mode

Good for civic tech, journalism tools, transparency apps.


The bad: what's technically available but painful

Portal da Transparência — has everything (federal spending, employee salaries, contracts) but requires an API key (free), has aggressive rate limits, and documentation is incomplete. Worth it for the data quality.

TSE Electoral — candidate data is available but broken across multiple endpoints with inconsistent schemas each election cycle. Expect to write adapters.

Diário Oficial — published daily as PDF and XML. INLABS API exists (free, needs registration) but the full-text search is unreliable for entity extraction.


The ugly: what's missing

  • Consolidated debt data: available as raw CSV dumps from PGFN (Procuradoria-Geral da Fazenda Nacional), quarterly, ~10GB. No searchable interface. You process it yourself.
  • State registries (Juntas Comerciais): 27 separate systems, most without APIs, some requiring physical visits. The national integration (REDESIM) is partial.
  • Real-time company changes: no webhook API. You poll or parse the Diário Oficial.

Quick reference

Data Source Access Notes
65M+ companies Jurídico Online / RF dump Free Best UI for lookup
CEP ViaCEP / BrasilAPI Free, no key
Municipalities IBGE Localidades API Free, no key
SELIC / IPCA / FX BACEN SGS API Free, no key
Congress votes Câmara API Free, no key
Federal spending Portal Transparência Free, key needed
Electoral data TSE Dados Abertos Free Painful schema

If you're building something with Brazilian data and hit a wall, drop a comment. Happy to help navigate the mess.

Top comments (0)