Government — entry 003 of 90

Brazil

Verified Aug 2026

BrasilAPI is a community-maintained, open-source project — not an official government service — that aggregates and normalizes public Brazilian registries into one keyless REST API. A live `GET /api/cep/v1/{cep}` call confirmed the postal-code lookup works with no key over HTTPS with a wildcard `Access-Control-Allow-Origin` header; the same gateway also fronts CNPJ business-registry lookups, bank/ISPB codes, DDD area codes, national holidays, and IBGE municipality data, each sourced from the relevant official agency. Because it re-serves government data rather than being run by a government body, treat it as a convenience layer, not a primary source for compliance-grade queries.

BrasilAPI is a community-maintained aggregator that re-serves Brazilian public registries — postal codes, CNPJ business records, bank codes, and national holidays — through one keyless REST gateway. A live GET this run against /cep/v1/01001000 returned a genuine 118 B address object at HTTP 200 with access-control-allow-origin: * and no key, signup, or credit card of any kind.

open-datagovernment-databrazilcepcnpj
AuthenticationNone requiredCall it straight away — no key, no signup.
HTTPSSupportedTraffic is encrypted in transit.
CORSEnabledCallable directly from browser JavaScript.
PricingFreeNo paid tier — free for the documented use case.
FormatsJSONResponses can be requested as JSON.

GreatAPIs Score

Score74out of 100
Authentication25/25No authentication required
Pricing20/20Free to use
Docs0/20No docs or spec available
Formats9/15Single response format
Freshness20/20Verified within 6 months

Embed this badge

Scored 74 on greatapis.com
<a href="https://greatapis.com/api/brazil/"><img src="https://greatapis.com/badge/brazil.svg" alt="Scored 74 on greatapis.com"></a>

Auth quickstart

  1. No API key, signup, or credit card required — a live GET this run against /cep/v1/01001000 returned HTTP 200 with a full address object and a wildcard Access-Control-Allow-Origin header on the first anonymous try.
Stored keyNo key stored

Your key is stored only in this browser (localStorage) and sent directly to the API — never to greatapis.

Look up an address by CEP (postal code)

GEThttps://brasilapi.com.br/api/cep/v1/01001000

200 application/json; charset=utf-8

{"cep":"01001000","state":"SP","city":"São Paulo","neighborhood":"Sé","street":"Praça da Sé","service":"open-cep"}

A live GET this run against /cnpj/v1/19131243000197 (Open Knowledge Brasil's own CNPJ) returned a genuine 2,991 B business-registry record at HTTP 200, including registered address, cnae_fiscal activity code, and a qsa array of partners — confirming the same gateway also fronts the Receita Federal company registry, not just postal codes.

Try it

Developer reference

Base URLhttps://brasilapi.com.br/api
Key endpoints
  • GET/cep/v1/{cep}
  • GET/cnpj/v1/{cnpj}
  • GET/banks/v1

Gotchas & limits

  • A CEP with no match is a real HTTP 404, but the body is a multi-provider error object, not a simple message string — a live GET this run against /cep/v1/00000000 returned exactly 547 B: {"message":"Todos os serviços de CEP retornaram erro.","type":"service_error","name":"CepPromiseError","errors":[...]} with one nested errors[] entry per upstream provider BrasilAPI tried (correios, viacep, widenet, correios-alt) and failed.
  • /feriados/v1/{year} only covers 1900 through 2199 — a live GET this run against /feriados/v1/1600 returned HTTP 404 with body {"message":"Ano fora do intervalo suportado entre 1900 e 2199.","type":"feriados_range_error","name":"NotFoundError"} (117 B), while /feriados/v1/2100 inside the range answered a normal 200.
  • /banks/v1 mixes real banks with non-bank settlement systems that carry code: null — a live GET this run confirmed the entry {"ispb":"00038121","name":"Selic","code":null,"fullName":"Banco Central do Brasil - Selic"} in the same array as normal numbered banks like Banco do Brasil (code: 1). Code that assumes every list entry has a numeric bank code will get null for Selic.
  • The /cnpj partner (qsa) list privacy-masks CPF numbers rather than omitting them — the live Open Knowledge Brasil lookup above returned "cnpj_cpf_do_socio":"***112108**" for its listed partner: a real field that looks like a usable identifier but is a redacted string, not a real CPF, so it cannot be used to cross-reference partners across different companies.