Central bank rates quickstart
Each central bank is identified by a short code, such as ecb (European Central Bank), boc (Bank of Canada), cbsl (Central Bank of Sri Lanka) or banxico (Banco de México). The full list of 141 central banks shows every code with its currencies and publication time.
Requests need an API key. You can get a free API key in a minute.
Latest official table
curl -H "Authorization: Bearer $ALLRATES_KEY" \
https://allratestoday.com/api/v1/central-bank/ecb/latest
The response carries the publication date (rate_date), whether the table is stale, and every rate in it.
One currency pair
curl -H "Authorization: Bearer $ALLRATES_KEY" \
"https://allratestoday.com/api/v1/central-bank/ecb/latest?source=EUR&target=USD"
A past date
For month-end revaluation or an audit, ask for the table in force on a given day:
curl -H "Authorization: Bearer $ALLRATES_KEY" \
https://allratestoday.com/api/v1/central-bank/boc/2026-06-30
Python
import os, requests
r = requests.get(
"https://allratestoday.com/api/v1/central-bank/ecb/latest",
params={"source": "EUR", "target": "USD"},
headers={"Authorization": f"Bearer {os.environ['ALLRATES_KEY']}"},
timeout=10,
)
r.raise_for_status()
d = r.json()
print(d["rate_date"], d["rate"])
JavaScript
const res = await fetch(
"https://allratestoday.com/api/v1/central-bank/ecb/latest?source=EUR&target=USD",
{ headers: { Authorization: `Bearer ${process.env.ALLRATES_KEY}` } }
);
const d = await res.json();
console.log(d.rate_date, d.rate);
Things to watch for
- Publication time. Each bank publishes at its own hour, in its own time zone. Before that, "latest" is still yesterday's table.
- Holidays. No table is published on bank holidays; the previous one stays in force.
- Buy and sell rates. Some central banks publish two-sided tables. Pick the rate type your rules require.
More endpoints, including history and CSV or Excel output, are in the API documentation.