BYTETOOLS

BrasilAPI

Free Brazilian public data API with no key: CEP postcode lookup, CNPJ company registry, banks, holidays, DDD area codes and more. Tested GET examples.

No API key requiredCORS enabledHTTPSFree tier

Endpoint tested and returned HTTP 200 on 2026-08-20

What is the BrasilAPI?

BrasilAPI is a free, key-free community API aggregating Brazilian public data — CEP postcode lookup, CNPJ company registry records, bank directories, national holidays, DDD area codes and vehicle data — behind one consistent interface.

Brazilian public data is scattered across many government systems with inconsistent interfaces and frequent downtime. BrasilAPI consolidates the most useful ones into a single modern API with no key required.

The CEP and CNPJ endpoints are the ones most applications need. CEP turns a postcode into a full address, and CNPJ returns the official Receita Federal company registry record — including partners, capital and activity codes — which is essential for any Brazilian B2B onboarding.

Quick facts

Base URL
https://brasilapi.com.br/api
Authentication
No API key required.
Rate limit
No published hard limit; it is community-run, so cache rather than polling.
Pricing
Free and open source.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the BrasilAPI

Every request below was executed against the live API on 2026-08-20, and the response shown is the real body it returned — not an illustration.

1. Look up a Brazilian postcode (CEP)

GET https://brasilapi.com.br/api/cep/v1/01001000

curl
curl 'https://brasilapi.com.br/api/cep/v1/01001000'
JavaScript (fetch)
const res = await fetch("https://brasilapi.com.br/api/cep/v1/01001000");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://brasilapi.com.br/api/cep/v1/01001000", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "cep": "01001000",
  "state": "SP",
  "city": "São Paulo",
  "neighborhood": "Sé",
  "street": "Praça da Sé",
  "service": "open-cep",
  "ibge": {
    "city": "3550308",
    "state": "35"
  }
}

2. Look up a company by CNPJ

GET https://brasilapi.com.br/api/cnpj/v1/19131243000197

curl
curl 'https://brasilapi.com.br/api/cnpj/v1/19131243000197'
JavaScript (fetch)
const res = await fetch("https://brasilapi.com.br/api/cnpj/v1/19131243000197");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://brasilapi.com.br/api/cnpj/v1/19131243000197", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
{
  "uf": "SP",
  "cep": "01311902",
  "qsa": [
    {
      "pais": null,
      "nome_socio": "HAYDEE SVAB",
      "codigo_pais": null,
      "faixa_etaria": "Entre 41 a 50 anos",
      "cnpj_cpf_do_socio": "***112108**",
      "qualificacao_socio": "Presidente",
      "codigo_faixa_etaria": 5,
      "data_entrada_sociedade": "2024-02-27",
      "identificador_de_socio": 2,
      "cpf_representante_legal": "***000000**",
      "nome_representante_legal": "",
      "codigo_qualificacao_socio": 16,
      "qualificacao_representante_legal": "Não informada",
      "codigo_qualificacao_representante_legal": 0
    }
  ],
  "cnpj": "19131243000197",
  "pais": null,
  "email": null,
  "porte": "DEMAIS",
  "bairro": "BELA VISTA",
  "numero": "37",
  "ddd_fax": "",
  "municipio": "SAO PAULO",
  "logradouro": "PAULISTA 37",
  "cnae_fiscal": 9430800,
  "codigo_pais": null,
  "complemento": "ANDAR 4",
  "codigo_porte": 5,
  "razao_social": "OPEN KNOWLEDGE BRASIL",
  "nome_fantasia": "REDE PELO CONHECIMENTO LIVRE",
  "capital_social": 0,
  "ddd_telefone_1": "1123851939",
  "ddd_telefone_2": "",
  "opcao_pelo_mei": null,
  "codigo_municipio": 7107,
  "cnaes_secundarios": [
    {
      "codigo": 9493600,
      "descricao": "Atividades de organizações associativas ligadas à cultura e à arte"
    },
    {
      "codigo": 9499500,
      "descricao": "Atividades associativas não especificadas anteriormente"
    },
    {
      "codigo": 8599699,
      "descricao": "Outras atividades de ensino não especificadas anteriormente"
    },
    {
      "codigo": 8230001,
      "descricao": "Serviços de

3. List every Brazilian bank

GET https://brasilapi.com.br/api/banks/v1

curl
curl 'https://brasilapi.com.br/api/banks/v1'
JavaScript (fetch)
const res = await fetch("https://brasilapi.com.br/api/banks/v1");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);
Python (requests)
import requests

res = requests.get("https://brasilapi.com.br/api/banks/v1", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200 (truncated)
[
  {
    "ispb": "00000000",
    "name": "BCO DO BRASIL S.A.",
    "code": 1,
    "fullName": "Banco do Brasil S.A.",
    "localizacao_sede": "SBS Quadra 1, Bloco A, Edifício Sede I, Asa Sul, Brasília-DF",
    "cnpj": null,
    "headquarters_address": {
      "street": "SAUN QUADRA 5  BLOCO B  TORRE SUL  4  ANDAR",
      "number": null,
      "complement": "EDIFICIO BANCO DO BRASIL",
      "district": "ASA NORTE",
      "city": "BRASÍLIA",
      "state": "DF",
      "zipCode": "70040-912"
    },
    "address_source": "bcb_sedes_exact_match",
    "address_last_sync": "2026-08-19T21:57:51.972Z",
    "address_confidence": "high",
    "logo_url": "https://cdn.jsdelivr.net/npm/logos-bancos-br@0/logos/svg/00000000.svg"
  },
  {
    "ispb": "00000208",
    "name": "BRB - BCO DE BRASILIA S.A.",
    "code": 70,
    "fullName": "BRB - BANCO DE BRASILIA S.A.",
    "localizacao_sede": "SCS Quadra 1, Bloco A, Edifício Brasília Trade Center, Asa Sul, Brasília-DF",
    "cnpj": null,
    "headquarters_address": {
      "street": "CENTRO EMPRESARIAL CNC   ST SAUN QUADRA 5",
      "number": null,
      "complement": "LOTE C BLOCO B",
      "district": "ASA NORTE",
      "city": "BRASÍLIA",
      "state": "DF",
      "zipCode": "70040-250"
    },
    "address_source": "bcb_sedes_exact_match",
    "address_last_sync": "2026-08-19T21:57:51.972Z",
    "address_confidence": "high",
    "logo_url": "https://cdn.jsdelivr.net/npm/logos-bancos-br@0/logos/svg/00000208.svg"
  },
  {
    "ispb": "00038121",
    "name": "Selic",
    "code": null,
    "fullName": "Banco Central do Brasil - Selic",
    "l

Parameters

ParameterTypeRequiredDescription
cep/v1/<cep>pathOptionalPostcode lookup, digits only. cep/v1/01001000
cnpj/v1/<cnpj>pathOptionalCompany registry lookup by CNPJ. cnpj/v1/19131243000197
banks/v1pathOptionalAll Brazilian banks with ISPB codes. banks/v1
feriados/v1/<year>pathOptionalNational holidays for a year. feriados/v1/2026
ddd/v1/<ddd>pathOptionalCities within a telephone area code. ddd/v1/11

Response fields

cepstring
The postcode queried.
state / city / neighborhood / streetstring
Resolved address components.
servicestring
Which upstream source answered — BrasilAPI queries several.
location.coordinatesobject
Latitude and longitude, when available.
(cnpj) razao_social / nome_fantasiastring
Legal and trading company names.
(cnpj) qsaarray
Company partners and their roles.
(banks) ispb / code / fullNamestring|integer
Bank identifiers used for transfers.

What you can build with the BrasilAPI

  • Autofill Brazilian addresses from a CEP at checkout
  • Verify company details during B2B onboarding via CNPJ
  • Populate a bank selector for PIX or TED transfers
  • Calculate Brazilian business days around national holidays

Common errors and how to fix them

404 on a CEP

The postcode does not exist or is not covered by any upstream source.

Fix: BrasilAPI queries several providers; a 404 means all of them failed.

Slow CNPJ lookups

It proxies Receita Federal, which is often slow.

Fix: Set a generous timeout and cache results — company records change rarely.

Formatted input rejected

CEP and CNPJ must be digits only.

Fix: Strip dots, hyphens and slashes before sending.

BrasilAPI — frequently asked questions

Is BrasilAPI free?

Yes, completely free and open source with no API key. It is community-run, so cache rather than polling aggressively.

What is a CEP?

Código de Endereçamento Postal — the Brazilian postcode. Looking one up returns the full street, neighbourhood, city and state, which is how Brazilian address forms autofill.

What can I do with a CNPJ lookup?

It returns the official Receita Federal company record — legal name, trading name, address, partners, share capital and activity codes — which is essential for Brazilian B2B verification.

Do I need to strip formatting from the input?

Yes. Send digits only — no dots, hyphens or slashes — or the request will fail.

Tools that pair with this API

BrasilAPI is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-20; always check the official documentation before relying on this API in production, as terms and limits can change.