Government — entry 004 of 90

Brazil Central Bank Open Data

Verified Aug 2026

A CKAN-based open-data catalogue from Banco Central do Brasil covering 4,200+ datasets — exchange rates, interest rates, public debt, and other monetary time series. Dataset metadata is browsable via the standard CKAN Action API, and most series resolve to the Central Bank's SGS (Sistema Gerenciador de Séries Temporais) endpoints, which return JSON or CSV for a specified date range with no key required.

Banco Central do Brasil publishes economic time series through its SGS (Sistema Gerenciador de Séries Temporais) API at api.bcb.gov.br/dados — a separate host from the CKAN open-data catalogue at dadosabertos.bcb.gov.br that the stored url points to (a live keyless package_search against that catalogue this run returned 200 with count: 4231 real datasets). A live GET this run against /serie/bcdata.sgs.1/dados/ultimos/2?formato=json (USD/BRL PTAX, series 1) returned a genuine 200, 79 B two-point series with access-control-allow-origin: * — unlike the CKAN catalogue host, which sent no CORS header at all on the same kind of request. Don't rely on the content type of that response, though: it varies over time for the identical request. On 2026-08-02 it answered application/json; charset=utf-8 on 16 probes at 01:07 UTC (12 of them one second apart, plus four Accept-header variations) — but the same URL, serving the very same valid-JSON body, had answered text/html; charset=utf-8 on 5 consecutive probes just 27 minutes earlier at 00:40. It flipped and flipped back inside a single hour, so see the gotchas below: it changes how you have to detect failures.

brazileconomicsopen-datagovernment-datatime-series
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.
FormatsJSON, CSVResponses can be requested as JSON or CSV.

GreatAPIs Score

Score94out of 100
Authentication25/25No authentication required
Pricing20/20Free to use
Docs14/20Documentation URL provided
Formats15/15Supports 2 response formats
Freshness20/20Verified within 6 months

Embed this badge

Scored 94 on greatapis.com
<a href="https://greatapis.com/api/brazil-central-bank-open-data/"><img src="https://greatapis.com/badge/brazil-central-bank-open-data.svg" alt="Scored 94 on greatapis.com"></a>

Auth quickstart

  1. No API key, signup, or credit card required on either host — a live GET this run against /serie/bcdata.sgs.1/dados/ultimos/2?formato=json returned full JSON on the first anonymous try. Series are addressed by a numeric SGS code (1 is the USD/BRL PTAX sale rate); a catalogue of codes lives on the separate dadosabertos.bcb.gov.br CKAN host, not on the SGS API itself.
Stored keyNo key stored

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

Fetch the two most recent values of a time series

GEThttps://api.bcb.gov.br/dados/serie/bcdata.sgs.1/dados/ultimos/2?formato=json

200 application/json; charset=utf-8

[
  {
    "data": "30/07/2026",
    "valor": "5.0739"
  },
  {
    "data": "31/07/2026",
    "valor": "5.0773"
  }
]

A live GET this run against the CKAN catalogue's package_search?rows=0 on dadosabertos.bcb.gov.br returned 200 with "result":{"count":4231,...} — confirming the two-host split: browse datasets on the CKAN host, then pull the actual numbers from the SGS API above.

Try it

Developer reference

Base URLhttps://api.bcb.gov.br/dados
Key endpoints
  • GET/serie/bcdata.sgs.{codigo}/dados/ultimos/{n}
  • GET/serie/bcdata.sgs.{codigo}/dados

Gotchas & limits

  • Both fields in every row are strings, not native JSON types — confirmed live above: data is "30/07/2026" in dd/MM/yyyy order (not ISO yyyy-MM-dd), and valor is the quoted string "5.0739", not a JSON number. Code that runs new Date(row.data) or arithmetic on row.valor directly will get garbage without an explicit parse step first.
  • A daily-periodicity series requested over a window longer than 10 years is rejected with HTTP 406 (not 400 or a truncated response) — confirmed live this run against /serie/bcdata.sgs.1/dados?dataInicial=01/01/2000&dataFinal=01/01/2026&formato=json, a 26-year span, which returned an 802 B JSON body: {"error":"O sistema aceita uma janela de consulta de, no máximo, 10 anos em séries de periodicidade diária",...} — entirely in Portuguese, with no English fallback.
  • An unknown series code returns a slow HTTP 200, so neither the status nor the content-type header is a reliable failure signal — confirmed live this run against /serie/bcdata.sgs.999999/dados/ultimos/2?formato=json, which took ~31 seconds to answer and then returned 200 (not 404), 6,254 B, a legacy Portuguese error page (<title>Requisição inválida!</title>, "Bad request!" in its English half) at content-type: text/html; charset=utf-8. Don't reach for header-sniffing to catch it: this API's success content-type is not stable over time. On 2026-08-02 the hero request above returned application/json; charset=utf-8 on 16 probes at 01:07 UTC, but had returned text/html; charset=utf-8 — the same type as this error page, which would have defeated the check entirely — on 5 consecutive probes 27 minutes earlier at 00:40, for a byte-identical request and a byte-identical JSON body. What is stable across both observations is the body: real data starts with [ or {, the error page starts with <. Set a generous timeout and branch on the first non-whitespace byte, or just wrap JSON.parse in a try/catch and treat a parse failure as the error case.
  • The stored cors: "no" for this entry was measured against the CKAN catalogue host and is wrong for the actual data API: a live GET this run against api.bcb.gov.br with an explicit Origin: https://greatapis.com header returned access-control-allow-origin: *, while the same probe against dadosabertos.bcb.gov.br returned no CORS header at all. This entry's cors is corrected to "yes" to match the host it actually documents (api.bcb.gov.br, this quickstart's baseUrl).