DEV Community

Daniel Igel
Daniel Igel

Posted on

Live exchange rates from the ECB via REST API — no key, no sign-up required

Building a multi-currency feature usually means wiring up a third-party data service, signing up for another API key, and hoping their quota tiers fit your usage. The ECB (European Central Bank) publishes official reference rates daily — but parsing their XML, rebasing to non-EUR currencies, and adding a history lookup is more boilerplate than most apps need.

One GET returns live exchange rates for any base currency:

curl --request GET \
  --url 'https://currency-exchange-rate-api11.p.rapidapi.com/api/v1/rates?base=USD' \
  --header 'x-rapidapi-key: YOUR_RAPIDAPI_KEY' \
  --header 'x-rapidapi-host: currency-exchange-rate-api11.p.rapidapi.com'
Enter fullscreen mode Exit fullscreen mode

You get base, date, and a flat rates object with every currency the ECB publishes, already rebased to your chosen currency. Need a direct conversion? Hit /api/v1/convert?from=USD&to=EUR&amount=250 and you get result and rate in one call. Dashboard spark-line? /api/v1/history?currency=USD&days=30 returns up to 90 days of daily rates.

const res = await fetch(
  'https://currency-exchange-rate-api11.p.rapidapi.com/api/v1/convert?from=USD&to=EUR&amount=250',
  { headers: { 'x-rapidapi-key': process.env.RAPIDAPI_KEY, 'x-rapidapi-host': 'currency-exchange-rate-api11.p.rapidapi.com' } }
);
const { result, rate } = await res.json();
Enter fullscreen mode Exit fullscreen mode

Rates are cached for one hour and sourced directly from the ECB — no upstream API key, no hidden quota from a third-party data provider. Suitable for e-commerce price display, expense tracking, and invoice automation; not intended for live trading.

Free tier on RapidAPI: https://rapidapi.com/danieligel/api/currency-exchange-rate-api11

What's the trickiest part of multi-currency work you've had to handle — rounding edge cases, timezone cutoffs on rate updates, or something else?

Top comments (0)