DEV Community

miccho27
miccho27

Posted on

Free Currency Exchange Rate API — Real-Time Rates, Historical Data, No API Key

Building a currency converter? Most exchange rate APIs either require registration, limit you to daily updates, or charge for historical data. The Open Exchange Rates free tier only gives you 1,000 requests/month and USD base only.

I built a free Currency Exchange Rate API on Cloudflare Workers that gives you real-time rates, currency conversion, and historical lookups — no API key required for the free tier.

Quick Start

Get current exchange rates

curl "https://currency-exchange-api.p.rapidapi.com/rates?base=USD"
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "base": "USD",
  "timestamp": "2026-03-25T12:00:00Z",
  "rates": {
    "EUR": 0.9234,
    "GBP": 0.7891,
    "JPY": 149.52,
    "BRL": 5.012,
    ...
  }
}
Enter fullscreen mode Exit fullscreen mode

Convert an amount

curl "https://currency-exchange-api.p.rapidapi.com/convert?from=USD&to=EUR&amount=100"
Enter fullscreen mode Exit fullscreen mode
{
  "from": "USD",
  "to": "EUR",
  "amount": 100,
  "result": 92.34,
  "rate": 0.9234
}
Enter fullscreen mode Exit fullscreen mode

JavaScript — Price Localization

async function convertCurrency(amount, from, to) {
  const params = new URLSearchParams({ from, to, amount });
  const response = await fetch(
    `https://currency-exchange-api.p.rapidapi.com/convert?${params}`
  );
  const data = await response.json();
  return data.result;
}

// Localize pricing for an e-commerce site
async function localizePrice(usdPrice, userCurrency) {
  if (userCurrency === 'USD') return usdPrice;

  const converted = await convertCurrency(usdPrice, 'USD', userCurrency);
  return new Intl.NumberFormat(undefined, {
    style: 'currency',
    currency: userCurrency
  }).format(converted);
}

// Usage
const price = await localizePrice(29.99, 'JPY');
console.log(price); // "¥4,483"
Enter fullscreen mode Exit fullscreen mode

Python — Expense Tracker

import requests

def get_rate(base: str, target: str) -> float:
    response = requests.get(
        "https://currency-exchange-api.p.rapidapi.com/convert",
        params={"from": base, "to": target, "amount": 1},
        timeout=10
    )
    response.raise_for_status()
    return response.json()["rate"]

def convert(amount: float, base: str, target: str) -> float:
    rate = get_rate(base, target)
    return round(amount * rate, 2)

# Convert travel expenses to home currency
expenses = [
    (150.00, "EUR"),   # Hotel in Paris
    (45.50, "GBP"),    # Train in London
    (12000, "JPY"),    # Dinner in Tokyo
]

total_usd = 0
for amount, currency in expenses:
    usd = convert(amount, currency, "USD")
    total_usd += usd
    print(f"  {amount} {currency} = ${usd} USD")

print(f"Total: ${total_usd:.2f} USD")
Enter fullscreen mode Exit fullscreen mode

Use Cases

  • E-commerce: Show prices in the visitor's local currency
  • SaaS pricing pages: Dynamic currency conversion
  • Expense trackers: Convert multi-currency transactions
  • Invoice tools: Real-time rate for international billing
  • Financial dashboards: Display portfolio in multiple currencies
  • Travel apps: Quick currency conversion

Comparison

Feature This API Open Exchange Rates (Free) Fixer.io (Free)
Requests 500/mo 1,000/mo 100/mo
Base currencies Any USD only EUR only
Auth required No Yes Yes
Historical Yes No (paid) No (paid)
HTTPS Yes No (paid) No (paid)

API Endpoints

Endpoint Description
GET /rates?base=USD All rates for a base currency
GET /convert?from=USD&to=EUR&amount=100 Convert a specific amount
GET /currencies List all supported currency codes

Free tier: 500 requests/month. No API key needed.

Try it free on RapidAPI →


Part of a collection of 24 free developer APIs on Cloudflare Workers.

Top comments (0)