Exchange rate APIs you can call without a commercial contract, plus the thing most tutorials skip: what kind of rate you are actually getting.
5 providers
Rate types explained
Sample responses
The APIs covered on this page
Currency API terms change more often than most categories - several providers have introduced keys or paid tiers at short notice. Confirm current pricing and limits on the provider's documentation before you build.
The rate returned by a free API is almost never the rate anyone pays. Understanding which rate you have is the difference between a useful conversion feature and a support queue full of confused customers.
Reference rates versus market rates
Most free APIs serve reference rates: an official snapshot published once a day by a central bank, most commonly the European Central Bank at around 16:00 Central European Time. They are accurate, authoritative and completely static until the next publication. Market rates, by contrast, move continuously during trading hours and are what a bank or broker actually quotes. Real-time market data is a licensed product, which is why it is not available for free.
The gap between the two is usually small for major pairs and can be significant for thinly traded currencies. Neither is the rate a consumer gets, because retail providers add a spread of anywhere from a fraction of a percent to several percent on top.
Where this matters in practice
Displaying an approximate price in a visitor's currency - reference rates are fine, with a clear "approximate" label.
Charging in multiple currencies - use your payment processor's rate, not a public API, or you will book a loss on every transaction.
Accounting and reporting - use the official rate your jurisdiction specifies for the relevant date.
Anything resembling trading - free APIs are unsuitable, and their terms usually say so explicitly.
Caching is not optional
If the data updates once per working day, fetching it on every page view wastes your quota and adds latency for no benefit. Fetch once per day on a schedule, store the result, and serve from your own store. This also protects you from an upstream outage - a rate from yesterday displayed with its date is far better than an error message.
Crypto is the exception. Those prices genuinely move by the second, so the caching question becomes a trade-off between freshness and rate limits. A ten to thirty second cache is usually a reasonable compromise for a display-only ticker.
Handling the arithmetic correctly
Never store money as a floating point number. The classic demonstration is that 0.1 plus 0.2 does not equal 0.3 in binary floating point, and those errors accumulate across a ledger. Store amounts as integers in the smallest unit - cents, paise, satoshi - or use a decimal library, and round only at the point of display.
Also handle currencies that are not two decimal places. The Japanese yen has none, several Middle Eastern currencies have three, and code that assumes two will produce wrong totals in all of them.
Converting between arbitrary pairs
Euro-based feeds like the ECB one require a cross-rate calculation: to convert USD to GBP, divide the EUR-to-GBP rate by the EUR-to-USD rate. The arithmetic is simple but the rounding is not - round once at the end, not at each step, or the error compounds. APIs that accept a base parameter do this for you, which is one practical reason to prefer them.
Plan for the day the API is down
Currency data is a dependency that fails quietly. If the fetch throws and nothing handles it, a price either disappears from the page or falls back to a hard-coded number that is months old. Store every successful response with its timestamp, serve the stored copy when the request fails, and show the date alongside the figure so nobody mistakes stale data for live data. If the stored rate is older than your tolerance - a few days, usually - it is better to hide the converted price entirely than to display a number you no longer trust.
Related resources
The evaluation checklist in Public APIs for Developers applies here in full. For a non-financial worked example of consuming a daily-updating API, see Free Weather APIs, and the Percentage Calculator is handy when you are reasoning about the spread between two rates.
Frequently asked questions
Why does my converted amount differ from what my bank charges?
Free APIs return reference or mid-market rates. Banks and payment providers add a spread and sometimes a fixed fee, so the customer rate is always less favourable than the published one.
Which currency API needs no API key?
Frankfurter and the ExchangeRate-API open endpoint both document key-free access, and the European Central Bank publishes its daily reference rates as a public XML feed.