- Guides
- historical exchange rates API (ECB)
Historical exchange rates API with ECB reference rates
GET /v1/exchange-rates/history?base=USD&symbol=IDR&from=2026-11-23&to=2026-11-27 returns the daily ECB reference rate for that currency pair between the two dates, back to 4 January 1999 and up to 1,830 days per call. Rates against a base other than the euro are cross rates calculated from the ECB figures, and each call costs 1 credit.
Last checked . Service: Exchange rates and currency conversion API. Reference: endpoint docs.
How the ECB rates work
The European Central Bank publishes euro reference rates for more than 30 currencies once per working day, around 16:00 CET. Weekends and holidays have no new rates, so a request for a Saturday returns the last publication; requested_date shows the day you asked for and date the day the rate belongs to.
The ECB quotes everything per 1 euro. When you ask for base=USD, APIFor divides the two euro rates and sets calculated to true. GET /v1/exchange-rates for a single day also returns the untouched ECB numbers in published, which matters if your auditor wants the source figure.
Request
Send your key in the x-api-key header. New accounts get 1,000 free requests after email verification; the quickstart takes about a minute.
curl 'https://api.apifor.dev/v1/exchange-rates/history?base=USD&symbol=IDR&from=2026-11-23&to=2026-11-27' \
-H 'x-api-key: YOUR_API_KEY'import os
import requests
r = requests.get(
"https://api.apifor.dev/v1/exchange-rates/history",
params={
"base": "USD",
"symbol": "IDR",
"from": "2026-11-23",
"to": "2026-11-27",
},
headers={"x-api-key": os.environ["APIFOR_API_KEY"]},
timeout=30,
)
r.raise_for_status()
print(r.json()["data"])const res = await fetch("https://api.apifor.dev/v1/exchange-rates/history?base=USD&symbol=IDR&from=2026-11-23&to=2026-11-27", {
headers: { "x-api-key": process.env.APIFOR_API_KEY },
});
const { data } = await res.json();
console.log(data);Response
This is the example recorded from the live API and published in our OpenAPI spec. Long lists and strings are shortened here. The full spec is at api.apifor.dev/v1/openapi.json.
{
"success": true,
"data": {
"source": "ecb",
"base": "USD",
"symbol": "IDR",
"from": "2026-11-23",
"to": "2026-11-27",
"calculated": true,
"count": 5,
"rates": [
{
"date": "2026-11-23",
"rate": 18221.90328
},
{
"date": "2026-11-24",
"rate": 18228.20396
}
]
},
"meta": {
"attribution": {
"source": "Source: ECB statistics (euro foreign exchange reference rates)",
"license": "ESCB policy on free reuse of statistics (source must be quoted, statistics not modified)",
"license_url": "https://www.ecb.europa.eu/stats/ecb_statistics/governance_and_quality_framework/html/usage_policy.en.html",
"source_url": "https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html",
"attribution_page": "https://apifor.dev/sources",
"notice": "ECB rates are returned unchanged in `published` (units per 1 EUR). Rates against any other base are cross rates calculated by APIFor. The..."
}
}
}Convert an amount
GET /v1/exchange-rates/convert?from=USD&to=JPY&amount=250 returns the rate, the result and the date of the rate. Add date for a past day.
Official tax exchange rates
For tax filings you often need the government's rate, not the market or ECB one. source=tax&country=US returns the US Treasury's quarterly reporting rates, and country=GB HMRC's monthly rates. source=central-bank serves the Federal Reserve H.10 and Bank of Canada rates.
Errors, limits and cost
A missing or wrong key returns 401, bad parameters return 400 with an error.code, and an unknown id returns 404. Rate limits are per key: a limited request gets 429 with a Retry-After header in seconds, so wait that long and retry. Calls that fail before any work starts are refunded. Details are in errors and rate limits.
This request costs 1 credit. Pricing is prepaid: 1,000 free requests once after email verification, then packs from $5 for 5,000 requests to $149 for 400,000. Credits never expire and there is no subscription. See pricing.
From an AI assistant
The same data is available as a tool on the APIFor MCP server at https://mcp.apifor.dev/mcp. Add it as a remote server in any client that supports remote MCP, sign in with OAuth or send your API key as a Bearer token, and ask in plain language. MCP calls use the same key and credits as REST. Setup steps are on the MCP page.
Alternatives
- Frankfurter: Free, no key and open source. Its v2 API blends rates from many central banks by default, and providers=ecb returns ECB rates alone. It has no quotas, but requests are rate-limited.
- ECB reference rates: The source itself, free, as web pages and downloadable files.
Facts about other services come from their own pages or a test call on 1 Dec 2026. Prices and limits change, so confirm them there.
Source and licence
Source: ECB statistics (euro foreign exchange reference rates), reused under the ESCB policy on free reuse of statistics: the source must be quoted. Cross rates against other bases are calculated by APIFor. The ECB publishes these rates for information purposes only.
Every APIFor response carries the same attribution in meta.attribution. All sources are listed on sources and licences.
FAQ
How far back do the historical exchange rates go?
ECB rates start on 4 January 1999. One history call covers up to 1,830 days.
Are these real-time rates?
No. They are daily reference rates published once per working day. Do not use them for trading.
Can I use them for tax reporting?
Use the tax source for that: source=tax with country=US for Treasury rates or country=GB for HMRC rates, whichever your filing requires.