# Brazil Exchange Rates API (Cotação PTAX) (`br_data_hub/br-exchange-rates`) Actor

Get official PTAX exchange rates from Banco Central do Brasil: buy and sell rates in BRL, parities and bulletin time for USD, EUR and other currencies, for one day or a period.

- **URL**: https://apify.com/br_data_hub/br-exchange-rates.md
- **Developed by:** [br_data_hub](https://apify.com/br_data_hub) (community)
- **Categories:** AI, Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.40 / 1,000 exchange rates

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Brazil Exchange Rates API (Cotação PTAX)

Get the **official Brazilian exchange rates (PTAX)** published by **Banco Central do Brasil**: buy and sell rates in BRL for USD, EUR and other currencies, for one day or a whole period.

PTAX is the reference rate used in contracts, invoices, customs, taxes and accounting in Brazil. Use this Actor to convert prices, keep a daily rate history, feed spreadsheets and ERPs, or give an AI agent the official rate.

### What you get per rate

- Currency code and name, plus BCB currency type (A or B, which tells how the parity is quoted)
- Date and bulletin: closing PTAX (the official rate), opening or intermediate
- Buy and sell rate in BRL
- Buy and sell parity against USD
- Exact bulletin time (Brasília time, ISO 8601)

### Input

| Field | Description |
|---|---|
| `currencies` | ISO codes, e.g. `["USD", "EUR", "GBP"]`. Default `["USD"]`. |
| `dateFrom`, `dateTo` | Quote date range (YYYY-MM-DD, max 366 days). Both empty = the last business day with published rates. Only `dateFrom` = that single day. |
| `bulletinType` | `closing` (default, the official PTAX), `opening`, `intermediate` or `all`. |

#### Weekends and holidays

The Central Bank publishes no rates on weekends and national holidays. Those days are simply left out of the results. A range that holds only such days ends successfully with no rows and you pay nothing. With no dates, the Actor looks back up to 10 days and returns the most recent day that has rates. Before about 13:00 Brasília time that is the previous business day, since the closing PTAX is not out yet.

### Output example

```json
{
  "currency": "USD",
  "currencyName": "Dólar dos Estados Unidos",
  "currencyType": "A",
  "date": "2026-10-23",
  "bulletinType": "closing",
  "bulletinTypePt": "Fechamento PTAX",
  "buyRateBrl": 5.4002,
  "sellRateBrl": 5.4008,
  "buyParity": 1,
  "sellParity": 1,
  "quotedAt": "2026-10-23T13:06:30.325-03:00"
}
```

### How much does it cost?

Pay per event: one `rate` event (US$ 0.002) per row returned, that is one currency, date and bulletin. A month of daily closing USD rates is about 22 rows (US$ 0.044). Days without rates, input errors and failed runs cost nothing. If you set a maximum charge per run, the Actor stops when it is reached.

This Actor does one thing: PTAX exchange rates. Other Brazilian public data (company registry, public contracts) is available from the same publisher.

**$0.002 per exchange rate** (`rate` event, pay per event). Charged once per rate returned: one currency, date and bulletin. Days without rates are free.

| You get | Free tier | Bronze tier (10% off) | Gold tier (30% off) |
|---|---|---|---|
| 100 exchange rates | $0.20 | $0.18 | $0.14 |
| 1,000 exchange rates | $2.00 | $1.80 | $1.40 |
| 10,000 exchange rates | $20.00 | $18.00 | $14.00 |

Discounts follow your Apify subscription tier: Bronze 10%, Silver 20%, Gold and above 30%. No subscription to this Actor and no charge for platform usage: you pay only for results.
The Apify Free plan includes $5 of monthly credit, enough for about **2,500 exchange rates** at the list price.
You can cap the cost of any run with **Maximum cost per run**; the Actor stops when it is reached.

### Data source and limits

Official open data API of Banco Central do Brasil (Olinda, PTAX service, `olinda.bcb.gov.br`), published as open data under Brazil's open data policy (Decree 8,777/2016). Source: Banco Central do Brasil. This Actor is not affiliated with or endorsed by the Central Bank. Rates are exactly as published by the BCB. A run covers up to 366 days, so split longer histories into several runs.

### More questions

#### Which rate should I use for contracts, invoices and taxes?

The closing PTAX (`bulletinType: "closing"`, the default). It is the rate the Central Bank publishes as the official PTAX of the day. The opening and intermediate bulletins come out earlier in the day and are available with `opening`, `intermediate` or `all`.

#### Why do I get yesterday's rate when I run it in the morning?

With no dates, the Actor returns the most recent day that has the bulletin you asked for. The closing PTAX comes out around 13:00 Brasília time, so before that the latest closing rate is the previous business day's. Ask for `opening` or `intermediate` to get today's earlier bulletins.

#### Which currencies are available?

The ones the Central Bank quotes in PTAX, read live from its currency list on every run (USD, EUR, GBP, JPY, CHF, CAD and others). Use three-letter ISO codes; case and duplicates do not matter. If you ask for a currency the Central Bank does not quote, the run fails with a message listing the available codes, and nothing is charged.

#### How far back can I go, and how long can a range be?

A run covers up to 366 days. For longer histories, split the period into several runs (one per year, for example). A start date in the future is rejected; an end date after today is cut to today.

#### What happens on weekends, holidays and Carnival?

The Central Bank publishes no rates on those days, so they are simply missing from the results. A range with only such days ends successfully with no rows and costs nothing. With no dates, the Actor looks back up to 10 days, which covers long breaks such as Carnival.

#### What are the parity fields and the currency type?

`buyParity` and `sellParity` are the rates against the US dollar, as published by the Central Bank. `currencyType` (A or B) is the Central Bank's flag for how that parity is quoted for each currency. For USD both parities are 1.

#### Why not call the Central Bank API directly?

You can: it is free. This Actor saves the work of building OData URLs, converting `MM-DD-YYYY` dates, picking the closing bulletin, finding the last business day and retrying when the API is unstable (up to 5 attempts on server and network errors). It returns English field names and ISO timestamps with the Brasília offset, ready for spreadsheets, ERPs and AI agents.

### Use it via API

Run it from any language and get the results as JSON. Replace `<YOUR_API_TOKEN>` with your [Apify API token](https://console.apify.com/settings/integrations).

```bash
curl -X POST "https://api.apify.com/v2/acts/br_data_hub~br-exchange-rates/run-sync-get-dataset-items?token=<YOUR_API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"currencies": ["USD"]}'
```

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_API_TOKEN>")
run = client.actor("br_data_hub/br-exchange-rates").call(run_input={'currencies': ['USD']})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

You can also schedule runs, send results to webhooks, or connect the Actor to Make, Zapier, n8n, Google Sheets and other [integrations](https://docs.apify.com/platform/integrations).

### Use it with AI agents (MCP)

This Actor is ready for AI agents: typed input and output schemas, pay-per-event pricing, limited permissions and short runs.

- **Apify MCP server:** add `https://mcp.apify.com/?tools=br_data_hub/br-exchange-rates` to Claude, ChatGPT, Cursor, VS Code or any MCP client, and the agent can call this Actor as a tool.
- **Agent frameworks:** call it from LangChain, LlamaIndex, CrewAI or the OpenAI Agents SDK through the Apify integrations, or with the API call above.
- Results come as structured JSON with stable field names, documented in the **Output** tab.

### FAQ

#### Where does the data come from?

Official open data API of Banco Central do Brasil (Olinda, PTAX service, `olinda.bcb.gov.br`), published as open data under Brazil's open data policy (Decree 8,777/2016). Source: Banco Central do Brasil. This Actor is not affiliated with or endorsed by the Central Bank. Rates are exactly as published by the BCB. A run covers up to 366 days, so split longer histories into several runs.

#### How much does it cost?

$0.002 per exchange rate. Discounts follow your Apify subscription tier: Bronze 10%, Silver 20%, Gold and above 30%. See **How much does it cost?** above for examples.

#### Do I pay for errors or empty results?

No. Charged once per rate returned: one currency, date and bulletin. Days without rates are free.

#### Can I run it on a schedule or connect it to other tools?

Yes. Use Apify schedules to run it daily or weekly, webhooks to get notified, and integrations such as Make, Zapier, n8n and Google Sheets. Everything also works through the API.

#### Can AI agents use it?

Yes. It works as a tool in the Apify MCP server and in agent frameworks, and AI agents can pay per event. See **Use it with AI agents (MCP)**.

#### Is it legal to use this data?

The Actor reads only public, official sources and keeps personal data masked as the source publishes it. You are responsible for how you use the data, including LGPD compliance.

#### I found a bug or need a feature. What should I do?

Open an issue in the **Issues** tab. We answer within 14 days, usually much sooner.

### More Actors from BR Data Hub

| Actor | What it does |
|---|---|
| [Brazil Treasury Bonds API (Tesouro Direto)](https://apify.com/br_data_hub/br-tesouro-direto) | Daily rates and unit prices of Brazilian Treasury bonds (Tesouro Direto: Selic, Prefixado, IPCA+, Renda+, Educ |
| [Brazil Inflation Calculator (IPCA, IGP-M, Selic)](https://apify.com/br_data_hub/br-monetary-correction) | Correct BRL amounts in bulk by IPCA, INPC, IGP-M, IGP-DI, IPC-Fipe, Selic, CDI, TR or savings (poupança) using |
| [Brazil Company Financials (CVM DFP/ITR, B3)](https://apify.com/br_data_hub/br-cvm-company-financials) | Standardized financial statements of Brazilian listed companies from CVM open data (DFP annual, ITR quarterly) |
| [Brazil Investment Fund Returns (Fundos CVM)](https://apify.com/br_data_hub/br-cvm-fund-performance) | Ready-made performance metrics for Brazilian investment funds from CVM open data: period, YTD and 12-month ret |
| [Brazil Fuel Prices by City (ANP Combustíveis)](https://apify.com/br_data_hub/br-anp-fuel-prices) | Weekly fuel prices in Brazil from the ANP open data survey (not affiliated with the ANP): average, minimum, ma |

See all our Actors at [apify.com/br_data_hub](https://apify.com/br_data_hub).

### Usar em português

Cotações oficiais **PTAX do Banco Central do Brasil**: taxa de compra e de venda em reais, paridades com o dólar e horário exato do boletim, para USD, EUR e as demais moedas que o Banco Central cota, num dia ou num período.

**Para que serve:** converter valores em contratos, notas fiscais, importação e exportação, contabilidade e impostos; manter um histórico diário do câmbio numa planilha ou ERP; dar a um agente de IA a cotação oficial do dia.

**Como usar em 3 passos:**

1. Em `currencies`, informe os códigos ISO das moedas (padrão `["USD"]`).
2. Deixe as datas vazias para receber o último dia útil com cotação, ou preencha `dateFrom` e `dateTo` (AAAA-MM-DD, até 366 dias por execução).
3. Escolha o boletim em `bulletinType`: `closing` (Fechamento PTAX, a taxa oficial, padrão), `opening` (abertura), `intermediate` (intermediários) ou `all`. Rode e baixe o resultado em JSON, CSV ou Excel.

**Exemplo de entrada:**

```json
{"currencies": ["USD", "EUR"], "dateFrom": "2026-10-01", "dateTo": "2026-10-31", "bulletinType": "closing"}
```

**Campos principais:** `currency`, `currencyName`, `date`, `bulletinType` e `bulletinTypePt` (o nome do boletim em português), `buyRateBrl` (compra), `sellRateBrl` (venda), `buyParity` e `sellParity` (paridade com o dólar), `currencyType` (tipo A ou B do Banco Central) e `quotedAt` (horário do boletim, com fuso de Brasília).

**Bom saber:**

- O Fechamento PTAX sai por volta das 13h de Brasília. Antes disso, sem datas, você recebe o fechamento do dia útil anterior.
- Fins de semana, feriados nacionais e Carnaval não têm cotação: ficam fora do resultado, sem erro.
- Moeda que o Banco Central não cota gera erro com a lista das moedas disponíveis.

**O que é grátis:** dias sem cotação, erros de entrada (moeda inválida, data no futuro, período maior que 366 dias) e execuções que falham. Você paga só por cotação entregue. Fonte: Banco Central do Brasil (dados abertos). Ferramenta independente, sem vínculo com o Banco Central.

**Quanto custa:** $0.002 por resultado (`rate`); 1.000 resultados saem por $2.00. Desconto pelo nível da assinatura Apify: Bronze 10%, Silver 20%, Gold ou acima 30%. Erros e consultas sem resultado não são cobrados. Use também pela API ou por agentes de IA no servidor MCP da Apify (`https://mcp.apify.com/?tools=br_data_hub/br-exchange-rates`).

# Actor input Schema

## `currencies` (type: `array`):

Enter ISO currency codes, one per line, e.g. USD, EUR, GBP or JPY. Any currency in the Central Bank PTAX list works.

## `dateFrom` (type: `string`):

Type the first quote date as YYYY-MM-DD, e.g. 2026-01-02. Leave both dates empty to get the last business day with published rates.

## `dateTo` (type: `string`):

Type the last quote date as YYYY-MM-DD. Leave empty to use the same day as 'From date'. Up to 366 days per run.

## `bulletinType` (type: `string`):

Keep Closing PTAX for the official rate used in contracts and taxes. Pick Opening, Intermediate or All to get the other bulletins the Central Bank publishes each day.

## Actor input object example

```json
{
  "currencies": [
    "USD"
  ],
  "dateFrom": "",
  "dateTo": "",
  "bulletinType": "closing"
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset with all results

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "currencies": [
        "USD"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("br_data_hub/br-exchange-rates").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "currencies": ["USD"] }

# Run the Actor and wait for it to finish
run = client.actor("br_data_hub/br-exchange-rates").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "currencies": [
    "USD"
  ]
}' |
apify call br_data_hub/br-exchange-rates --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,br_data_hub/br-exchange-rates"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bo7Ricj3M4fxro8rG/builds/BAtZ1myqCvg3apFRQ/openapi.json
