# BrasilAPI

> Look up Brazilian public data: addresses by CEP, companies by CNPJ, banks, DDD area codes, holidays, FIPE vehicle prices, books by ISBN, NCM codes, PIX participants, .br domains, interest and exchange rates and CVM brokers.

App · 15 actions. Web page: https://docs.lodol.com/docs/integrations/brasilapi

## Actions

### Check a .br domain

Check on registro.br whether a .br domain is registered or free to register, and when a registered one expires.

**Inputs**

- Domain (`domain`, text, required): The domain, such as petrobras.com.br. A name without an ending is checked as .com.br.

**Outputs**

- `domain` (text): The domain checked. A bare name is checked as .com.br.
- `expires_at` (text): When the registration expires, for a registered domain.
- `is_available` (true/false): True when the domain can be registered.
- `is_registered` (true/false): True when someone holds it.
- `name_servers` (list): Its name servers, for a registered domain.
- `reasons` (list): Why it cannot be registered, in Portuguese.
- `status` (text): registro.br's status, such as AVAILABLE, REGISTERED or UNAVAILABLE.
- `suggestions` (list): Other .br endings where the same name is free.

**Example output**

```json
{
  "domain": "petrobras.com.br",
  "expires_at": "2030-06-14T00:00:00-03:00",
  "is_available": false,
  "is_registered": true,
  "name_servers": [
    "ns-187.awsdns-23.com",
    "ns-1611.awsdns-09.co.uk"
  ],
  "reasons": [],
  "status": "REGISTERED",
  "suggestions": []
}
```

### Get a bank

Get a bank's names, ISPB identifier and headquarters address from its three-digit code, such as 341 for Itaú.

**Inputs**

- Bank (`code`, text, required): The bank, or its three-digit code, such as 341.

**Outputs**

- `code` (number): Three-digit bank code (COMPE), such as 341. Empty for institutions without one.
- `full_name` (text): Full legal name.
- `headquarters` (object): Headquarters address, as the Central Bank lists it.
- `ispb` (text): 8-digit ISPB identifier used in transfers and PIX.
- `logo_url` (text): Address of the bank's logo, when there is one.
- `name` (text): Short name.

**Example output**

```json
{
  "code": 341,
  "full_name": "ITA\u00da UNIBANCO S.A.",
  "headquarters": {
    "cep": "04344-902",
    "city": "S\u00c3O PAULO",
    "complement": "TORRE OLAVO SETUBAL",
    "neighborhood": "PARQUE JABAQUARA",
    "number": null,
    "state": "SP",
    "street": "PCA ALFREDO EGYDIO SOUZA ARANHA  100"
  },
  "ispb": "60701190",
  "logo_url": "https://cdn.jsdelivr.net/npm/logos-bancos-br@0/logos/svg/60701190.svg",
  "name": "ITA\u00da UNIBANCO S.A."
}
```

### Get a vehicle's FIPE price

Get the average price of a vehicle in the FIPE table: pick the type, then the brand, model and year. Also gives its FIPE code.

**Inputs**

- Vehicle type (`vehicle_type`, text, required): Cars, motorcycles or trucks. One of: `carros` (Cars), `motos` (Motorcycles), `caminhoes` (Trucks). Default: `carros`.
- Brand (`brand`, text, required): The brand, or its FIPE brand code, such as 21 for Fiat.
- Model (`model`, text, required): The model, or its FIPE model code.
- Year (`year`, text, required): The model year and fuel, or its code, such as 2020-1. 32000 is a brand-new (zero km) vehicle.

**Outputs**

- `brand` (text): Brand.
- `fipe_code` (text): FIPE code of the model, as 001004-9.
- `fuel` (text): Fuel, such as Gasolina, Álcool, Flex or Diesel.
- `model` (text): Model and version.
- `model_year` (number): Model year. 32000 means a brand-new (zero km) vehicle.
- `price` (number): Average price in reais.
- `price_text` (text): The price as FIPE writes it, such as R$ 4.890,00.
- `reference_month` (text): The month the price is for, in Portuguese.
- `vehicle_type` (text): car, motorcycle or truck.

**Example output**

```json
{
  "brand": "Fiat",
  "fipe_code": "001124-0",
  "fuel": "Gasolina",
  "model": "147 C/ CL",
  "model_year": 1985,
  "price": 4890.0,
  "price_text": "R$ 4.890,00",
  "reference_month": "outubro de 2026",
  "vehicle_type": "car"
}
```

### Get an exchange rate

Get the Central Bank's rate for a currency in reais on a date. For a weekend or holiday, the last business day before it is used.

**Inputs**

- Currency (`currency`, text, required): The currency, such as USD or EUR. Default: `USD`.
- Date (`date`, date, required): The day to get the rate for. It can't be in the future.

**Outputs**

- `bulletin` (text): Which bulletin buy_rate and sell_rate come from, such as PTAX closing.
- `buy_rate` (number): Reais per unit of the currency, buying, from the day's closing PTAX bulletin (or its last one).
- `currency` (text): Currency code, such as USD.
- `date` (text): The date the rates are from: the last business day on or before the date asked for.
- `quoted_at` (text): When that bulletin was published.
- `quotes` (list): Every bulletin of the day, in order.
- `requested_date` (text): The date asked for.
- `sell_rate` (number): Reais per unit of the currency, selling.

**Example output**

```json
{
  "bulletin": "PTAX closing",
  "buy_rate": 4.9886,
  "currency": "USD",
  "date": "2026-10-09",
  "quoted_at": "2026-10-09 13:07:30.746597",
  "quotes": [
    {
      "bulletin": "opening",
      "buy_parity": 1.0,
      "buy_rate": 5.0012,
      "sell_parity": 1.0,
      "sell_rate": 5.0018,
      "time": "2026-10-09 10:10:14.047225"
    },
    {
      "bulletin": "PTAX closing",
      "buy_parity": 1.0,
      "buy_rate": 4.9886,
      "sell_parity": 1.0,
      "sell_rate": 4.9892,
      "time": "2026-10-09 13:07:30.746597"
    }
  ],
  "requested_date": "2026-10-11",
  "sell_rate": 4.9892
}
```

### Get interest rates

Get Brazil's official rates: SELIC (the Central Bank's base rate), CDI (the interbank rate) and IPCA (inflation), in percent.

**Inputs**: None.

**Outputs**

- `cdi` (number): CDI, the interbank rate, in percent a year.
- `ipca` (number): IPCA, official inflation over the last 12 months, in percent.
- `rates` (list): Every rate BrasilAPI publishes.
- `selic` (number): SELIC, the Central Bank's base rate, in percent a year.

**Example output**

```json
{
  "cdi": 13.65,
  "ipca": 4.58,
  "rates": [
    {
      "name": "SELIC",
      "value": 13.75
    },
    {
      "name": "CDI",
      "value": 13.65
    },
    {
      "name": "IPCA",
      "value": 4.58
    }
  ],
  "selic": 13.75
}
```

### List banks

List Brazil's banks and payment institutions with their three-digit codes and ISPB identifiers, ordered by code.

**Inputs**

- Name contains (`search`, text): Keep only entries whose name contains this. Leave empty for all.

**Outputs**

- `banks` (list): Banks and payment institutions, by code.
- `count` (number): How many entries the list holds.

**Example output**

```json
{
  "banks": [
    {
      "code": 341,
      "full_name": "ITA\u00da UNIBANCO S.A.",
      "ispb": "60701190",
      "name": "ITA\u00da UNIBANCO S.A."
    },
    {
      "code": 479,
      "full_name": "Banco ItauBank S.A.",
      "ispb": "60394079",
      "name": "BCO ITAUBANK S.A."
    }
  ],
  "count": 2
}
```

### List brokers

List the brokerage firms (corretoras) registered with the CVM, Brazil's securities regulator, with their CNPJ and contacts.

**Inputs**

- State (`state`, text): Only brokers based in this state. Leave empty for all. One of: `AC` (AC - Acre), `AL` (AL - Alagoas), `AP` (AP - Amapá), `AM` (AM - Amazonas), `BA` (BA - Bahia), `CE` (CE - Ceará), `DF` (DF - Distrito Federal), `ES` (ES - Espírito Santo), `GO` (GO - Goiás), `MA` (MA - Maranhão), and 17 more.
- Name contains (`search`, text): Keep only entries whose name contains this. Leave empty for all.
- Operating only (`active_only`, true/false): Leave on to skip brokers whose registration was cancelled, which are most of the list. Default: `true`.

**Outputs**

- `brokers` (list): Brokers, A to Z.
- `count` (number): How many entries the list holds.

**Example output**

```json
{
  "brokers": [
    {
      "cep": "22250-911",
      "city": "RIO DE JANEIRO",
      "cnpj": "02.332.886/0001-04",
      "complement": "BLOCO I, SAL\u00c3O 501",
      "cvm_code": "3247",
      "email": "fabricio.almeida@xpi.com.br",
      "name": "XP INVESTIMENTOS CCTVM S.A.",
      "neighborhood": "BOTAFOGO",
      "net_worth": 7394627000.0,
      "net_worth_date": "2025-12-31",
      "phone": "40033710",
      "registered_on": "1997-12-05",
      "state": "RJ",
      "status": "EM FUNCIONAMENTO NORMAL",
      "street": "PRAIA BOTAFOGO, 501",
      "trade_name": "XP INVESTIMENTOS"
    }
  ],
  "count": 1
}
```

### List holidays

List Brazil's national holidays for a year, moveable ones such as Carnaval included. Choose a state to add its own holidays.

**Inputs**

- Year (`year`, number): The year, from 1900 to 2199. Leave empty for this year. From 1900 to 2199.
- State (`state`, text): Add this state's holidays to the national ones. Leave empty for national holidays only. One of: `AC` (AC - Acre), `AL` (AL - Alagoas), `AP` (AP - Amapá), `AM` (AM - Amazonas), `BA` (BA - Bahia), `CE` (CE - Ceará), `DF` (DF - Distrito Federal), `ES` (ES - Espírito Santo), `GO` (GO - Goiás), `MA` (MA - Maranhão), and 17 more.

**Outputs**

- `count` (number): How many entries the list holds.
- `holidays` (list): Holidays, in date order.
- `state` (text): The state whose holidays were added, when one was chosen.
- `year` (number): The year.

**Example output**

```json
{
  "count": 3,
  "holidays": [
    {
      "date": "2026-01-01",
      "name": "Confraterniza\u00e7\u00e3o mundial",
      "state": null,
      "type": "national",
      "weekday": "Thursday"
    },
    {
      "date": "2026-01-25",
      "name": "Anivers\u00e1rio da Cidade de S\u00e3o Paulo",
      "state": "SP",
      "type": "state",
      "weekday": "Sunday"
    },
    {
      "date": "2026-02-16",
      "name": "Carnaval",
      "state": null,
      "type": "national",
      "weekday": "Monday"
    }
  ],
  "state": "SP",
  "year": 2026
}
```

### List PIX participants

List the banks and payment institutions taking part in PIX, Brazil's instant payment system, with their ISPB identifiers.

**Inputs**

- Name contains (`search`, text): Keep only entries whose name contains this. Leave empty for all.
- Max results (`limit`, number): Return at most this many participants. From 1 to 1000. Default: `100`.

**Outputs**

- `count` (number): How many are listed here.
- `participants` (list): Participants, A to Z.
- `total_matching` (number): How many matched, before Max results.

**Example output**

```json
{
  "count": 1,
  "participants": [
    {
      "ispb": "18236120",
      "modality": "Provedor de Conta Transacional",
      "name": "NU PAGAMENTOS - IP",
      "participation": "Direta",
      "short_name": "NU PAGAMENTOS - IP",
      "started_on": null
    }
  ],
  "total_matching": 1
}
```

### List vehicle brands

List the car, motorcycle or truck brands in the FIPE table, Brazil's reference for used vehicle prices, with their codes.

**Inputs**

- Vehicle type (`vehicle_type`, text, required): Cars, motorcycles or trucks. One of: `carros` (Cars), `motos` (Motorcycles), `caminhoes` (Trucks). Default: `carros`.

**Outputs**

- `brands` (list): Brands, A to Z.
- `count` (number): How many entries the list holds.
- `vehicle_type` (text): carros, motos or caminhoes.

**Example output**

```json
{
  "brands": [
    {
      "code": "60",
      "name": "ADLY"
    },
    {
      "code": "61",
      "name": "AGRALE"
    },
    {
      "code": "62",
      "name": "APRILIA"
    }
  ],
  "count": 3,
  "vehicle_type": "motos"
}
```

### Look up a book by ISBN

Get a book's title, authors, publisher, synopsis and details from its ISBN. Best for books published in Brazil.

**Inputs**

- ISBN (`isbn`, text, required): The 10- or 13-digit ISBN, with or without hyphens, such as 978-85-359-1484-9.

**Outputs**

- `authors` (list): Authors, translators and illustrators.
- `cover_url` (text): Address of the cover image.
- `format` (text): PHYSICAL or DIGITAL.
- `height_cm` (number): Height in centimetres.
- `isbn` (text): ISBN-13.
- `location` (text): Where it was published.
- `page_count` (number): Number of pages.
- `price` (number): Retail price, when known.
- `price_currency` (text): Currency of the retail price.
- `publisher` (text): Publisher.
- `source` (text): The catalogue the book was found in, such as cbl.
- `subjects` (list): Subjects.
- `subtitle` (text): Subtitle.
- `synopsis` (text): Synopsis, usually in Portuguese.
- `title` (text): Title.
- `width_cm` (number): Width in centimetres.
- `year` (number): Year published.

**Example output**

```json
{
  "authors": [
    "George Orwell",
    "Alexandre Hubner",
    "Heloisa Jahn"
  ],
  "cover_url": null,
  "format": "PHYSICAL",
  "height_cm": 21.0,
  "isbn": "9788535914849",
  "location": "S\u00e3o Paulo, SP",
  "page_count": 416,
  "price": null,
  "price_currency": null,
  "publisher": "Companhia das Letras",
  "source": "cbl",
  "subjects": [
    "Literatura"
  ],
  "subtitle": null,
  "synopsis": "Publicada originalmente em 1949, a distopia futurista 1984 \u00e9 um dos romances mais influentes do s\u00e9culo XX.",
  "title": "1984",
  "width_cm": 13.0,
  "year": 2009
}
```

### Look up a CEP

Get the street, neighborhood, city and state of a CEP (Brazilian postal code), with map coordinates when known. The coordinates are often the city's centre rather than the street's.

**Inputs**

- CEP (`cep`, text, required): The 8-digit postal code, with or without the hyphen, such as 01001-000.

**Outputs**

- `cep` (text): The CEP (postal code), as 01001-000.
- `city` (text): City.
- `city_ibge_code` (text): The city's 7-digit IBGE code.
- `has_coordinates` (true/false): Whether latitude and longitude are filled in.
- `latitude` (number): Latitude, when BrasilAPI knows where the CEP is.
- `longitude` (number): Longitude, when BrasilAPI knows where the CEP is.
- `neighborhood` (text): Neighborhood (bairro).
- `source` (text): The service BrasilAPI found the address in.
- `state` (text): Two-letter state code, such as SP.
- `street` (text): Street name. Empty for a CEP that covers a whole town.

**Example output**

```json
{
  "cep": "01001-000",
  "city": "S\u00e3o Paulo",
  "city_ibge_code": "3550308",
  "has_coordinates": true,
  "latitude": -23.5475,
  "longitude": -46.63611,
  "neighborhood": "S\u00e9",
  "source": "open-cep",
  "state": "SP",
  "street": "Pra\u00e7a da S\u00e9"
}
```

### Look up a company by CNPJ

Get a company's public registration from its CNPJ (Brazilian company number): legal and trade names, status, activities, address, phone and partners.

**Inputs**

- CNPJ (`cnpj`, text, required): The 14-digit company number, with or without punctuation, such as 33.000.167/0001-01.

**Outputs**

- `cep` (text): CEP (postal code), as 20031-170.
- `city` (text): City.
- `cnpj` (text): The CNPJ, as 33.000.167/0001-01.
- `company_size` (text): Size class: MICRO EMPRESA, EMPRESA DE PEQUENO PORTE or DEMAIS.
- `complement` (text): Address complement.
- `email` (text): Contact email, when registered.
- `is_active` (true/false): True when the status is ATIVA.
- `is_headquarters` (true/false): True for the head office (matriz), false for a branch (filial).
- `legal_name` (text): Registered legal name (razão social).
- `legal_nature` (text): Legal form, such as Sociedade Anônima Aberta.
- `main_activity` (text): Main activity's description.
- `main_activity_code` (text): Main activity's CNAE code.
- `mei` (true/false): Whether it is an MEI (individual micro-entrepreneur); empty when unknown.
- `neighborhood` (text): Neighborhood (bairro).
- `number` (text): Street number.
- `opened_on` (text): Date the company started (YYYY-MM-DD).
- `partners` (list): Partners and directors (quadro societário).
- `phone` (text): Phone number with its DDD (area code).
- `secondary_activities` (list): Other registered activities.
- `share_capital` (number): Share capital in reais.
- `simples_nacional` (true/false): Whether the company is in the Simples Nacional tax regime; empty when unknown.
- `state` (text): Two-letter state code.
- `status` (text): Registration status as the Receita Federal gives it, such as ATIVA (active) or BAIXADA (closed).
- `status_date` (text): Date the status took effect (YYYY-MM-DD).
- `street` (text): Street, with its type (AVENIDA, RUA...).
- `trade_name` (text): Trade name (nome fantasia), when there is one.

**Example output**

```json
{
  "cep": "20031-170",
  "city": "RIO DE JANEIRO",
  "cnpj": "33.000.167/0001-01",
  "company_size": "DEMAIS",
  "complement": null,
  "email": null,
  "is_active": true,
  "is_headquarters": true,
  "legal_name": "PETROLEO BRASILEIRO S A PETROBRAS",
  "legal_nature": "Sociedade de Economia Mista",
  "main_activity": "Extra\u00e7\u00e3o de petr\u00f3leo e g\u00e1s natural",
  "main_activity_code": "0600001",
  "mei": null,
  "neighborhood": "CENTRO",
  "number": "65",
  "opened_on": "1966-09-28",
  "partners": [
    {
      "age_range": "Entre 61 a 70 anos",
      "joined_on": "2023-04-17",
      "name": "CLARICE COPPETTI",
      "role": "Diretor"
    },
    {
      "age_range": "Entre 51 a 60 anos",
      "joined_on": "2024-07-17",
      "name": "FERNANDO SABBI MELGAREJO",
      "role": "Diretor"
    }
  ],
  "phone": "2121660000",
  "secondary_activities": [
    {
      "code": "1921700",
      "description": "Fabrica\u00e7\u00e3o de produtos do refino de petr\u00f3leo"
    },
    {
      "code": "3520401",
      "description": "Produ\u00e7\u00e3o de g\u00e1s; processamento de g\u00e1s natural"
    }
  ],
  "share_capital": 205431960000.0,
  "simples_nacional": null,
  "state": "RJ",
  "status": "ATIVA",
  "status_date": "2005-11-03",
  "street": "AVENIDA REPUBLICA DO CHILE",
  "trade_name": "PETROBRAS - EDISE"
}
```

### Look up a DDD area code

Find the state and cities a DDD (the two-digit phone area code, such as 11 for São Paulo) covers.

**Inputs**

- DDD (`ddd`, number, required): The two-digit area code, such as 21. From 11 to 99.

**Outputs**

- `cities` (list): Cities that use it, A to Z.
- `city_count` (number): How many cities use it.
- `ddd` (text): The DDD (area code).
- `state` (text): Two-letter code of the state it is in.

**Example output**

```json
{
  "cities": [
    "BELFORD ROXO",
    "NITER\u00d3I",
    "RIO DE JANEIRO"
  ],
  "city_count": 3,
  "ddd": "21",
  "state": "RJ"
}
```

### Search NCM codes

Find NCM codes, the Mercosur product codes used on Brazilian invoices and customs forms, by code or by description.

**Inputs**

- Search (`query`, text, required): A code such as 0901.11.10, or words from the description in Portuguese, such as café torrado.

**Outputs**

- `count` (number): How many entries the list holds.
- `query` (text): What was searched for.
- `results` (list): Matching codes.

**Example output**

```json
{
  "count": 1,
  "query": "caf\u00e9 torrado",
  "results": [
    {
      "code": "0901.2",
      "description": "- Caf\u00e9 torrado:",
      "legal_act": "Res Gecex 272 2021",
      "valid_from": "2022-04-01",
      "valid_until": "9999-12-31"
    }
  ]
}
```
