Frankfurter is a free API for current and historical foreign exchange rates. It is based on data sets published by the European Central Bank.
No usage caps or API keys. Works great client-side in the browser or mobile apps. If preferred, you can self-host with Docker.
Frankfurter provides endpoints to retrieve latest rates, historical data, or time series.
/* curl -s https://api.frankfurter.app/latest */
base
parameter. The default is EUR. /* curl -s https://api.frankfurter.app/latest?base=USD */
/* curl -s https://api.frankfurter.app/latest?symbols=CHF */
/* curl -s https://api.frankfurter.app/1999-01-04 */
/* curl -s https://api.frankfurter.app/1999-01-04?base=USD&symbols=EUR */
/* curl -s https://api.frankfurter.app/2000-01-01..2000-12-31 */
/* curl -s https://api.frankfurter.app/2024-01-01.. */
/* curl -s https://api.frankfurter.app/2024-01-01..?symbols=USD */
/* curl -s https://api.frankfurter.app/currencies */
function convert(from, to, amount) {
fetch(`https://api.frankfurter.app/latest?base=${from}&symbols=${to}`)
.then((resp) => resp.json())
.then((data) => {
const convertedAmount = (amount * data.rates[to]).toFixed(2);
alert(`${amount} ${from} = ${convertedAmount} ${to}`);
});
}
convert("EUR", "USD", 10);
If you prefer not to use our hosted service, you can self-host with Docker.
# Runs frankfurter on port 8080
docker run -d \
-p 8080:8080 \
-e "DATABASE_URL=$POSTGRES_URL" \
hakanensari/frankfurter