CAMBIO
Cotação de câmbio
Cotação PTAX de moeda estrangeira frente ao Real, por data, direto do Banco Central.
Exchange rates
PTAX foreign currency rate against the Real, by date, straight from the Central Bank.
SYNC resposta na mesma chamada answers in the same call
Endpoints
Endpoints
/api/v1/cambio/moedas
lista as moedas disponíveis
lists the available currencies
/api/v1/cambio/{moeda}/{data}
cotação de uma moeda numa data
a currency's rate on a given date
Parâmetros
Parameters
| Nome | Name | Onde | In | Descrição | Description |
|---|---|---|---|---|---|
moeda |
path | sigla ISO 4217 (ex.: USD, EUR) — lista completa em /cambio/moedas |
ISO 4217 sigla (e.g. USD, EUR) — full list at /cambio/moedas |
||
data |
path | formato YYYY-MM-DD |
YYYY-MM-DD format |
Exemplo
Example
curl https://api.alicercelabs.com.br/api/v1/cambio/USD/2026-08-25 \
-H "Authorization: Bearer <token>"
{
"success": true,
"data": {
"moeda": "USD",
"data": "2026-08-25",
"cotacoes": [
{ "paridade_compra": 1, "paridade_venda": 1, "cotacao_compra": 5.148, "cotacao_venda": 5.149,
"data_hora_cotacao": "2026-08-25 13:04:44.743388", "tipo_boletim": "Fechamento PTAX" }
],
"meta": { "fonte": "bcb" }
},
"meta": { "elapsed_ms": 210, "request_id": "..." }
}
O array cotacoes tem um item por boletim do dia (abertura, intermediários, fechamento PTAX) — cortado aqui pra caber no exemplo.
The cotacoes array has one item per bulletin of the day (opening, intermediates, PTAX closing) — trimmed here just to fit the example.
Erros possíveis
Possible errors
| Status | Motivo | Reason |
|---|---|---|
| 400 | data fora do formato YYYY-MM-DD | date isn't in YYYY-MM-DD format |
| 401 | token ausente ou inválido | missing or invalid token |
| 404 | nenhuma cotação nos últimos 10 dias retrocedendo a partir da data pedida | no rate found in the 10 days walking back from the requested date |
| 429 | limite de taxa excedido | rate limit exceeded |
| 503 | as duas fontes falharam | both sources failed |
Duas fontes
Two sources
Primeiro a PTAX do Banco Central via API Olinda, gratuita, sem chave — a mesma cotação usada pra fins contábeis e fiscais no Brasil. Fim de semana e feriado não têm boletim: a busca recua dia a dia, até 10 dias, até achar o último dia útil disponível (o campo data na resposta mostra qual data foi realmente usada). Se a fonte oficial falhar por erro de rede, a chamada cai pra BrasilAPI, que já faz esse mesmo recuo internamente.
First, the Central Bank's PTAX via the Olinda API, free, no key — the same rate used for accounting and tax purposes in Brazil. Weekends and holidays have no bulletin: the search walks back day by day, up to 10 days, until it finds the last available business day (the response's data field shows which date was actually used). If the official source fails with a network error, the call falls through to BrasilAPI, which already does this same walk-back internally.
Usando o SDK
Using the SDK
SDKs oficiais: Go · Python · JavaScript.
Official SDKs: Go · Python · JavaScript.
Buscar a cotação de uma moeda
Look up a currency's rate
import (
"context"
"fmt"
alicercelabs "github.com/alicercelabs/alicercesdk-go"
)
client := alicercelabs.New("alk_...") // ou um token JWT de login/register
ctx := context.Background()
cotacao, err := client.Cambio.Get(ctx, "USD", "2026-08-25")
if err != nil {
panic(err)
}
fmt.Println(cotacao.Cotacoes[0].CotacaoVenda)from alicercelabs import AlicerceLabs
client = AlicerceLabs(api_key="alk_...") # ou um token JWT de login/register
cotacao = client.cambio.get("USD", "2026-08-25")
print(cotacao["cotacoes"][0]["cotacao_venda"])import { AlicerceLabs } from "alicercesdk-javascript";
const client = new AlicerceLabs("alk_..."); // ou um token JWT de login/register
const cotacao = await client.cambio.get("USD", "2026-08-25");
console.log(cotacao.cotacoes[0].cotacao_venda);Limites
Limits
100/dia · 4/hora sem token, por IP chamador; com token (JWT de login ou API key gerada no painel), 1.000/dia · 41/hora. Resposta em cache por 24h.
100/day · 4/hour without a token, per calling IP; with one (a login JWT or an API key generated in the panel), 1,000/day · 41/hour. Response cached for 24h.