BYTETOOLS

Banco Central do Brasil PTAX API

Free Banco Central do Brasil PTAX API with no key: the official BRL/USD buying and selling rate for any date, plus every quoted currency. OData interface, tested example.

No API key requiredCORS enabledHTTPSFree tier

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

What is the Banco Central do Brasil PTAX API?

The Banco Central do Brasil publishes the official PTAX exchange rate through a free OData API at olinda.bcb.gov.br with no key. It returns the buying and selling rate for a given date along with the exact timestamp of the quotation.

PTAX is not a market rate — it is an average of dealer quotes collected by the central bank in four windows through the day, and it is the number Brazilian contracts, tax rules and derivatives settlement point at. That makes this endpoint categorically different from an exchange ticker: slower, less granular, and authoritative in a way a ticker never is.

The interface is OData, which explains the parentheses and the `@` placeholders in the URL. Two details trip people up. The date parameter is `MM-DD-YYYY` — US order, inside single quotes — even though every date in the response comes back Brazilian style. And `$format=json` is mandatory; leave it off and you get XML. Weekends and Brazilian holidays return an empty `value` array with HTTP 200, not an error.

Quick facts

Base URL
https://olinda.bcb.gov.br/olinda/servico/PTAX/versao/v1/odata
Authentication
No key or registration required. Published by the BCB as open data.
Rate limit
No documented limit. PTAX closes once per working day; cache aggressively.
Pricing
Free.
CORS
Enabled — callable directly from browser JavaScript
Official docs
Read the docs

How to use the Banco Central do Brasil PTAX API

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

1. Official PTAX BRL/USD rate for 20 August 2026

GET https://olinda.bcb.gov.br/olinda/servico/PTAX/versao/v1/odata/CotacaoDolarDia(dataCotacao=@dataCotacao)?@dataCotacao='08-20-2026'&$format=json

curl
curl 'https://olinda.bcb.gov.br/olinda/servico/PTAX/versao/v1/odata/CotacaoDolarDia(dataCotacao=@dataCotacao)?@dataCotacao='\''08-20-2026'\''&$format=json'
JavaScript (fetch)
const res = await fetch("https://olinda.bcb.gov.br/olinda/servico/PTAX/versao/v1/odata/CotacaoDolarDia(dataCotacao=@dataCotacao)?@dataCotacao='08-20-2026'&$format=json");
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://olinda.bcb.gov.br/olinda/servico/PTAX/versao/v1/odata/CotacaoDolarDia(dataCotacao=@dataCotacao)?@dataCotacao='08-20-2026'&$format=json", timeout=20)
res.raise_for_status()
print(res.json())
Response — HTTP 200
{
  "@odata.context": "https://was-p.bcnet.bcb.gov.br/olinda/servico/PTAX/versao/v1/odata$metadata#_CotacaoDolarDia",
  "value": [
    {
      "cotacaoCompra": 5.1856,
      "cotacaoVenda": 5.1862,
      "dataHoraCotacao": "2026-08-20 13:06:16.554671"
    }
  ]
}

Parameters

ParameterTypeRequiredDescription
@dataCotacaoqueryRequiredQuotation date in `MM-DD-YYYY`, wrapped in single quotes. Note the US component order. '08-20-2026'
$formatqueryRequired`json`. Without it the service returns XML. json
$selectqueryOptionalComma-separated list of fields to return, trimming the payload. cotacaoCompra,cotacaoVenda
$top / $skipqueryOptionalStandard OData paging, used on the multi-currency and period endpoints. 10

Response fields

value[]array
Result rows. Empty when the requested date had no PTAX close.
value[].cotacaoCompranumber
Official buying rate — reais per US dollar.
value[].cotacaoVendanumber
Official selling rate. The gap to `cotacaoCompra` is the PTAX spread.
value[].dataHoraCotacaostring
Timestamp of the closing quotation in Brasília time, to microsecond precision.
@odata.contextstring
OData metadata URL describing the entity set, safe to ignore.

What you can build with the Banco Central do Brasil PTAX API

  • Convert USD amounts to reais using the rate Brazilian tax rules specify
  • Reconcile cross-border invoices against the official close for the booking date
  • Backfill a PTAX series for a reporting dashboard
  • Compare the official close against an exchange rate to show the difference

Common errors and how to fix them

Empty `value` array with HTTP 200

The date is a weekend, a Brazilian holiday, or the current day before the close.

Fix: Step back to the previous working day. This is not an error condition and will not raise.

XML instead of JSON

`$format=json` was omitted.

Fix: The parameter is required. Note the leading dollar sign, which some HTTP clients need escaped.

400 on the date

The date was sent as `2026-08-20` or without quotes.

Fix: The format is `'MM-DD-YYYY'` including the single quotes, URL-encoded as part of the query string.

Banco Central do Brasil PTAX API — frequently asked questions

What is PTAX and how is it different from a market rate?

PTAX is the Banco Central do Brasil's official rate, calculated from dealer quotes gathered in four consultation windows through the day. It is a daily reference number used in contracts and tax rules, not a live market quote.

Is the PTAX API free?

Yes. The Olinda service needs no key or registration and serves both the daily close and historical periods as open data.

Why does the date parameter use American ordering?

The Olinda OData layer expects `MM-DD-YYYY` in single quotes, which is inconsistent with the Brazilian formatting used in responses but is what the service requires. Convert explicitly rather than reusing a response value.

Can I get every currency instead of just the dollar?

Yes. A sibling entity set returns all quoted currencies for a date, and another returns a currency across a date range. Both live under the same OData base URL.

Tools that pair with this API

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