Historical Rates API
Fetch historical exchange rates for a specified date and base currency.
Endpoint
GET /historical_rates
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
base | string | Yes | Base currency code (ISO 4217) - e.g., USD, EUR, GBP |
date | string | Yes | Date in YYYY-MM-DD format - e.g., 2024-01-15 |
targets | string | No | Comma-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
| Field | Type | Description |
|---|---|---|
base | string | The base currency code |
date | string | The requested date (YYYY-MM-DD format) |
rates | object | Historical exchange rates for that date |
Status Codes
| Status | Description |
|---|---|
| 200 | Success - Historical rates returned |
| 400 | Bad Request - Invalid date or parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 404 | Not Found - No data for specified date |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Server 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
- Cache historical data - It never changes
- Batch requests for date ranges using multiple concurrent requests
- Request only needed currencies to reduce payload size
Rate Limiting
Same as Latest Rates API. Check response headers for limit info.
See Also
- Latest Rates API - Get real-time rates
- Currency Conversion API - Convert amounts
- List Currencies - Supported currencies