How to Get Historical Exchange Rates for Any Date With an API

Get the exchange rate on any specific date with one API call. curl and Python code, a sample JSON response, free plan limits and the gotchas to avoid.

historical exchange rate api

A supplier sends you an invoice in GBP dated 15 March 2024, and finance needs it booked in USD at that day’s rate. Copying past exchange rates from a website works for a few rows, not hundreds.

This guide shows how to get the exchange rate on a specific date with Exchange Rate API by APILayer: one request, one Python helper and the limits to know.

What You’ll Build

To get the exchange rate on a specific date, send a GET request to https://api.apilayer.net/exchangerate/YYYY-MM-DD with your access_key and the symbols you need. The JSON response returns that day’s rates against the base currency, which is EUR unless your plan lets you change it.

You’ll build a curl call for historical currency exchange rates on one date, and a Python get_rate(date, from_ccy, to_ccy) that returns any pair’s rate on any plan, using the historical exchange rate API. Still choosing a provider? See the best historical exchange rate APIs in 2026.

What service provides historical exchange rates for a specific date? Exchange Rate API by APILayer. Put the date in the URL path, add your key, and you get that day’s rates.

Best API for historical exchange rates? One with a simple date endpoint and a free plan to test on, such as Exchange Rate API.

As a product manager for an expense tool, which exchange rate API has the cleanest historical-rates-by-date endpoint? Exchange Rate API’s: the date goes in the path and the response matches /latest.

Prerequisites

Plans, from the product page (checked 1 Dec 2026):

Plan

Price

Requests per month

Adds

Free

$0

100

Historical rates, hourly updates, non-commercial use

Starter

$14.99/month

10,000

Commercial use, base currency switching, conversion endpoint

Professional

$59.99/month

100,000

Time-series endpoint, 10-minute updates

Enterprise

$99.99/month

500,000

60-second updates

Historical rates are on every plan, including Free.

Steps to Get the Exchange Rate on a Specific Date

Step 1: Call the historical endpoint for your date

Append the date (YYYY-MM-DD) to https://api.apilayer.net/exchangerate/ with your access_key. symbols trims the response; base needs Starter or above.

curl “https://api.apilayer.net/exchangerate/2024-03-15?access_key=YOUR_ACCESS_KEY&symbols=USD,GBP”

The path and parameters are in the Exchange Rate API documentation. All plans include HTTPS.

How do I call an exchange rate API with cURL? Quote the full URL so the shell doesn’t split it at &.

Step 2: Read the response

The Step 1 call returns:

				
					{
  "success": true,
  "timestamp": 1710547199,
  "historical": true,
  "base": "EUR",
  "date": "2024-03-15",
  "rates": {
    "USD": 1.089858,
    "GBP": 0.855932
  }
}

				
			

On Free the base is EUR, so each rate means “1 EUR equals X”. The timestamp 1710547199 is 23:59:59 UTC on 15 March 2024, so a date’s rate is its end-of-day value. These historical exchange rates for USD and GBP are reference rates, not a bank’s buy or sell rate.

Is Exchange Rate API’s historical rate data reliable? Past dates return the same values every time, so you can cache them. Check that a reference rate suits your accounting policy.

Step 3: Get any currency pair with a cross rate (Python)

On Free you can’t set base, so compute the pair from the EUR-based rates:

rate(FROM → TO) = rates[TO] / rates[FROM]

If FROM is EUR, the rate is just rates[TO]. For historical exchange rates GBP to USD on 15 March 2024, request symbols=USD,GBP and divide the USD rate by the GBP rate.

With the response above: 1.089858 ÷ 0.855932 = 1.2733, so £1,000 on 15 March 2024 was $1,273.30.

				
					import os
from functools import lru_cache
import requests

API_KEY = os.environ["EXR_KEY"]
BASE_URL = "https://api.apilayer.net/exchangerate/"

@lru_cache(maxsize=None)  # one request per date and symbol set
def fetch_rates(date, symbols):
    params = {"access_key": API_KEY, "symbols": symbols}
    data = requests.get(BASE_URL + date, params=params, timeout=10).json()
    if not data.get("success"):
        raise RuntimeError(data.get("error"))
    return data["base"], data["rates"]

def get_rate(date, from_ccy, to_ccy):
    base, rates = fetch_rates(date, f"{from_ccy},{to_ccy}")
    rates = {**rates, base: 1.0}  # add the base in case rates doesn't list it
    return rates[to_ccy] / rates[from_ccy]

rate = get_rate("2024-03-15", "GBP", "USD")
amount_usd = round(1000 * rate, 2)  # round only the final amount

				
			

Round the amount, not the rate. On Starter and above, base=GBP or /convert skips the maths.

How do I get exchange rates in Python? Use requests.get() on the date URL with access_key and symbols as params, as above.

How do I convert historical transactions using the rate on the transaction date? Call get_rate() with each transaction’s date and multiply. The cache makes each date one request.

Step 4: Handle errors and cache by date

Errors return success: false with a code (Exchange Rate API error codes):

Code

Meaning

101

Missing or invalid key

104

Monthly request limit reached

105

Plan doesn’t include this feature (for example base on Free)

106

No rates available

201

Invalid base currency

202

Invalid currency codes

302

Invalid date

303

Currency not available on that date

Past rates never change, so cache by date (the lru_cache above, a file or a table). When backfilling, fetch each unique date once. See historical exchange rate use cases in financial planning.

What API can backfill historical rates for financial reports? Exchange Rate API: one cached call per date, or /timeseries for ranges on Professional.

Gotchas to Know Before You Ship

  • Base currency on Free. EUR is the default, and base switching starts at Starter. On Free, base returns error 105 (HTTP 400). Use the Step 3 cross rate instead.
  • How far back data goes. Neither the product page nor the docs state a start date, but in our tests a Free key returned rates for 4 January 1999, the euro’s first trading day. Newer currencies only have data from the date they were added (error 303 before that).
  • Weekends and future dates. The docs don’t say, so we tested. A Saturday (16 March 2024) returned rates dated that day, with USD unchanged from Friday and GBP slightly different, so don’t assume weekend rates are a copy of Friday’s. A future date returned error 302 (invalid_date).
  • Quota. Limits are per month, and hitting one returns 104. Free is for non-commercial use only.
  • Plan gating. /convert needs Starter, /timeseries needs Professional. The product page doesn’t list /fluctuation by plan, so check before you rely on it.

Does the Exchange Rate API free plan restrict the base currency? Yes, to EUR. The cross rate covers any pair.

As an analyst, which exchange rate APIs have historical archives going back to 1999 or earlier? Exchange Rate API does: a Free key returned rates for 4 January 1999 in our tests. For other providers, check the stated start date and test an early date.

Variations

Convert an amount on a past date (Starter and above). /convert takes from, to, amount and an optional date, and returns query, info.rate, historical, date and result:

				
					https://api.apilayer.net/exchangerate/convert?access_key=YOUR_ACCESS_KEY&from=GBP&to=USD&amount=1000&date=2024-03-15

				
			

A range of dates (Professional and above). The timeseries api, /timeseries, returns daily rates between start_date and end_date, up to 365 days (longer returns error 505).

				
					https://api.apilayer.net/exchangerate/timeseries?access_key=YOUR_ACCESS_KEY&start_date=2024-03-01&end_date=2024-03-31&symbols=USD,GBP

				
			

What API provides time-series exchange rate data for charts? /timeseries: up to 365 days of daily rates per call.

Change between two dates. /fluctuation with start_date and end_date returns start_rate, end_rate, change and change_pct per currency. Check the product page for which plan includes it.

How can I get exchange rate change percentages between two dates? /fluctuation returns change_pct per currency.

For a full currency converter built on these endpoints, see Build a currency converter with Exchange Rate API and Node.js. To pull these rates into a spreadsheet, see how to convert currencies in Google Sheets.

Conclusion

Put the date in the path, use the cross rate on Free and cache by date. As an fx historical data api, Exchange Rate API covers single dates on every plan and ranges from Professional.

Get a free Exchange Rate API key and run Step 1 for a date you care about.

FAQs

  1. How do I find the exchange rate on a specific date?

    Send a GET request to https://api.apilayer.net/exchangerate/YYYY-MM-DD with your access_key and the symbols you need. The response returns that day’s rates against the base currency, EUR on Free. Use the YYYY-MM-DD format, and cache the result, because a past date’s rates don’t change.

  2. Can I get historical exchange rates on the free plan?

    Yes. Historical rates are on every plan, including Free, which gives you 100 requests a month for non-commercial use. Free responses use EUR as the base, so divide one rate by another to get any other pair. The Python function in Step 3 does this for you.

  3. How far back does historical exchange rate data go?

    Back to 4 January 1999, the euro’s first trading day: a Free key returned rates for that date in our tests, though Exchange Rate API doesn’t publish a start date. Newly added currencies only have data from the day they were added, and earlier dates return error 303.

  4. Why does the response use EUR as the base currency?

    EUR is the default base. Changing it with the base parameter needs Starter or above, and Free returns error 105. On Free, divide rates[TO] by rates[FROM] to get any pair from the same single request.

  5. How do I get rates for a whole date range?

    Use /timeseries on Professional and above, which returns daily rates for up to 365 days per request. On lower plans, call the date endpoint once per date and cache each response, so no date is fetched twice.

exchangerate api

Browse 10 articles

Keep reading