Brazilian Central Bank time series (SGS) as clean JSON
A SGS API entrega séries do Sistema Gerenciador de Séries Temporais do Banco Central — Selic, IPCA, IGP-M, câmbio, PIB, desemprego — em JSON limpo. A API do BC é gratuita e sem chave; este serviço acrescenta o que falta: um catálogo pesquisável (o BC não tem busca por nome) e saída normalizada com padrões sensatos. Ótima como ferramenta para IA.
The SGS API serves series from the Brazilian Central Bank's time-series system (Selic, IPCA, IGP-M, FX, GDP, unemployment) as clean JSON. The BCB API is free and keyless; this service adds the two things it lacks — a searchable catalog (BCB has no name search) and normalized output with sane defaults. Great as a tool for an AI.
Base: https://sgs.api.insyde.one — aberta, sem autenticação / open, no auth.
O catálogo mapeia apelidos amigáveis (PT/EN, sem acento) para os códigos do SGS. Busque com ?q=:
The catalog maps friendly aliases (PT/EN, accent-insensitive) to SGS codes. Search with ?q=:
// GET /series?q=inflacao
[
{ "code": 433, "slug": "ipca", "name": "IPCA — variação mensal",
"unit": "% a.m.", "frequency": "monthly", "aliases": ["ipca", "inflação", "cpi"] },
{ "code": 13522, "slug": "ipca-12m", "name": "IPCA — acumulado em 12 meses", ... }
]
Sem q, retorna o catálogo inteiro. / With no q, returns the whole catalog.
Use o slug (ex. ipca) ou qualquer código SGS (ex. 433):
Use the slug (e.g. ipca) or any SGS code (e.g. 433):
https://sgs.api.insyde.one/series/ipca
https://sgs.api.insyde.one/series/433?last=24
https://sgs.api.insyde.one/series/dolar?start=2024-01-01&end=2024-06-30
| Param | Descrição / Description |
|---|---|
type |
ai (padrão) → normalizado + metadados. raw → payload exato do BC. / ai (default) → normalized + metadata. raw → BCB's exact payload. |
last |
Últimas N observações (padrão 12, máx 3650). / Last N observations (default 12, max 3650). |
start |
Início do intervalo, ISO AAAA-MM-DD. / Range start, ISO YYYY-MM-DD. |
end |
Fim do intervalo, ISO AAAA-MM-DD. / Range end, ISO YYYY-MM-DD. |
start/end têm prioridade sobre last. / start/end take precedence over last.
type=ai (padrão / default) — datas em ISO, valores numéricos, com metadados:
// GET /series/ipca?last=3
{
"code": 433, "slug": "ipca", "name": "IPCA — variação mensal",
"unit": "% a.m.", "frequency": "monthly", "source": "BCB SGS",
"count": 3,
"observations": [
{ "date": "2025-04-01", "value": 0.43 },
{ "date": "2025-05-01", "value": 0.26 },
{ "date": "2025-06-01", "value": 0.21 }
]
}
type=raw — exatamente como o BC devolve (datas dd/MM/yyyy, valores como texto):
// GET /series/433?type=raw&last=3
[
{ "data": "01/04/2025", "valor": "0.43" },
{ "data": "01/05/2025", "valor": "0.26" },
{ "data": "01/06/2025", "valor": "0.21" }
]
curl:
curl "https://sgs.api.insyde.one/series/selic"
curl "https://sgs.api.insyde.one/series?q=cambio"
JavaScript (fetch):
const BASE = 'https://sgs.api.insyde.one';
async function series(idOrSlug, params = {}) {
const qs = new URLSearchParams(params);
const res = await fetch(`${BASE}/series/${idOrSlug}?${qs}`);
if (!res.ok) throw new Error((await res.json()).error);
return res.json();
}
const ipca = await series('ipca', { last: 24 });
const usd = await series('dolar', { start: '2024-01-01', end: '2024-06-30' });
Python (requests):
import requests
resp = requests.get("https://sgs.api.insyde.one/series/selic", params={
"last": 12,
})
resp.raise_for_status()
data = resp.json()
for o in data["observations"]:
print(o["date"], o["value"], data["unit"])
Erros sempre retornam { "error": "..." }. / Errors always return { "error": "..." }.
| HTTP Code | Significado / Meaning | O que fazer / What to do |
|---|---|---|
400 |
type, last ou start/end inválidos / Invalid type, last, or start/end |
Use type=ai|raw, last inteiro, datas ISO / Use type=ai|raw, integer last, ISO dates |
404 |
Slug desconhecido (e não é um código numérico) / Unknown slug (and not a numeric code) | Busque em /series?q= ou passe um código SGS / Search /series?q= or pass an SGS code |
502 |
Falha no upstream do BC ou resposta bloqueada / BCB upstream failed or was blocked | Tente novamente / Retry |
Cerca de 18 indicadores mais usados (Selic, IPCA, IGP-M, INPC, IGP-DI, INCC, dólar, euro, PIB, IBC-Br, desemprego, poupança, TR, CDI). Qualquer código SGS também funciona diretamente, mesmo fora do catálogo.
Around 18 of the most-used indicators. Any SGS code also works directly, even if not catalogued.
AI tool guide · Explorer · Inflation · Selic · Compare · Back to Insyde APIs