Skip to main content

Historical Rates API

Fetch historical exchange rates for a specified date and base currency.

Endpoint

GET /historical_rates

Parameters

ParameterTypeRequiredDescription
basestringYesBase currency code (ISO 4217) - e.g., USD, EUR, GBP
datestringYesDate in YYYY-MM-DD format - e.g., 2024-01-15
targetsstringNoComma-separated target currencies. Defaults to all if omitted.

Request Example

curl -X GET "https://api.openfxrates.com/historical_rates?base=USD&date=2024-01-15&targets=EUR,GBP,JPY" \
-H "X-API-Key: your-api-key-here"

Response Schema

{
"base": "USD",
"date": "2024-01-15",
"rates": {
"EUR": 0.89,
"GBP": 0.76,
"JPY": 145.30
}
}

Response Fields

FieldTypeDescription
basestringThe base currency code
datestringThe requested date (YYYY-MM-DD format)
ratesobjectHistorical exchange rates for that date

Status Codes

StatusDescription
200Success - Historical rates returned
400Bad Request - Invalid date or parameters
401Unauthorized - Invalid or missing API key
404Not Found - No data for specified date
429Too Many Requests - Rate limit exceeded
500Server Error - Internal error

Examples

Get rates for a specific date

curl -X GET "https://api.openfxrates.com/historical_rates?base=USD&date=2024-01-15" \
-H "X-API-Key: your-api-key"

Get historical rates for specific currencies

curl -X GET "https://api.openfxrates.com/historical_rates?base=EUR&date=2024-06-30&targets=USD,GBP,JPY" \
-H "X-API-Key: your-api-key"

Date Range Support

  • Available Data: 1999-01-01 to present
  • Weekends & Holidays: Market rates from previous trading day
  • Future Dates: Not available

Use Cases

  • 📊 Financial Analysis - Analyze exchange rate trends over time
  • 📈 Backtesting - Test trading strategies with historical data
  • 💼 Reporting - Generate accurate historical reports
  • 🧮 Reconciliation - Match historical transactions

Performance Tips

  1. Cache historical data - It never changes
  2. Batch requests for date ranges using multiple concurrent requests
  3. Request only needed currencies to reduce payload size

Rate Limiting

Same as Latest Rates API. Check response headers for limit info.

See Also