Real-Time Currency Exchange Rates with the ECB API
Why ECB rates?
The European Central Bank publishes daily reference exchange rates for 31 currencies against the euro. These rates are the standard reference for financial applications, invoicing, and accounting in Europe.
Unlike commercial exchange rate providers that charge hundreds per month, ECB rates are free and official. The European Business API makes them accessible via a simple REST endpoint with conversion, history, and caching built in.
Get current rates
import httpx
response = httpx.get(
"https://frenchbusinessapi.com/currency/rates",
headers={"X-API-Key": "your_api_key"}
)
data = response.json()
print(f"EUR/USD: {data['rates']['USD']}")
print(f"EUR/GBP: {data['rates']['GBP']}")
print(f"Last updated: {data['date']}")
Returns rates for all 31 currencies: USD, GBP, JPY, CHF, SEK, NOK, DKK, PLN, CZK, HUF, RON, BGN, TRY, AUD, CAD, BRL, CNY, and more.
Convert amounts
Don't do the math yourself, the API handles it with proper rounding:
response = httpx.get(
"https://frenchbusinessapi.com/currency/convert",
params={"from": "EUR", "to": "USD", "amount": 1500.00},
headers={"X-API-Key": "your_api_key"}
)
data = response.json()
print(f"€1,500.00 = ${data['result']}")
print(f"Rate: {data['rate']}")
The conversion works between any two supported currencies, not just EUR pairs. Converting GBP to JPY uses the cross-rate via EUR.
Historical rates
Get rates for a specific date or a date range:
# Rates on a specific date
response = httpx.get(
"https://frenchbusinessapi.com/currency/rates/2026-03-15",
headers={"X-API-Key": "your_api_key"}
)
# Rate history for a currency pair
response = httpx.get(
"https://frenchbusinessapi.com/currency/history",
params={"base": "EUR", "target": "USD", "days": 90},
headers={"X-API-Key": "your_api_key"}
)
for point in response.json()["history"]:
print(f"{point['date']}: {point['rate']}")
Historical data goes back 90 days. Useful for charts, trend analysis, or computing average rates over a period.
Use cases
Multi-currency invoicing
When invoicing a client in their local currency, use the ECB rate on the invoice date. For French invoices in foreign currencies, the VAT amount must always be converted to euros.
E-commerce pricing
Display prices in the visitor's currency without maintaining manual rate tables. Call the API once per day and cache the result, rates update daily around 16:00 CET.
Accounting and reconciliation
ECB rates are the standard reference for European accounting. When your bank statement shows a foreign currency transaction, use the ECB rate to compute the euro equivalent for your books.
SaaS billing
If you bill European customers in USD but report in EUR, use the ECB rate on the billing date for consistent conversion.
Caching strategy
ECB rates update once per day (around 16:00 CET, no updates on weekends). The API caches rates for 6 hours. For most applications, calling the API once per day and caching locally is sufficient:
import json
from datetime import date
CACHE_FILE = "rates_cache.json"
def get_rates(api_key):
try:
with open(CACHE_FILE) as f:
cache = json.load(f)
if cache["date"] == str(date.today()):
return cache["rates"]
except (FileNotFoundError, KeyError):
pass
response = httpx.get(
"https://frenchbusinessapi.com/currency/rates",
headers={"X-API-Key": api_key}
)
data = response.json()
with open(CACHE_FILE, "w") as f:
json.dump(data, f)
return data["rates"]
Next steps
- Get your free API key, 100 requests/day
- API documentation
- Related: SEPA payments, VAT validation, IBAN verification
Ready to build for Europe?
One API for company lookup, VAT validation, IBAN verification, SEPA payments, and more.
Get your API key