Skip to main content

Latest Rates API

Fetch the latest exchange rates for a specified base currency.

Endpoint

GET /latest_rates

Parameters

ParameterTypeRequiredDescription
basestringYesBase currency code (ISO 4217) - e.g., USD, EUR, GBP
targetsstringNoComma-separated target currencies - e.g., EUR,GBP,JPY. Defaults to all currencies if omitted.

Request Example

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

Response Schema

{
"base": "USD",
"date": "2024-12-25",
"rates": {
"EUR": 0.92,
"GBP": 0.79,
"JPY": 150.25
}
}

Response Fields

FieldTypeDescription
basestringThe base currency code
datestringThe date of the rates (YYYY-MM-DD format)
ratesobjectExchange rates with currency codes as keys and rates as values

Status Codes

StatusDescription
200Success - Rates returned
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
429Too Many Requests - Rate limit exceeded
500Server Error - Internal error

Examples

Get rates for all currencies

curl -X GET "https://api.openfxrates.com/latest_rates?base=USD" \
-H "X-API-Key: your-api-key"

Get rates for specific currencies

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

Rate Limiting

Rate limits depend on your plan. Check response headers:

  • X-RateLimit-Limit - Requests allowed per minute
  • X-RateLimit-Remaining - Requests remaining
  • X-RateLimit-Reset - Unix timestamp when limit resets

Caching

For optimal performance, cache latest rates for 1-5 minutes depending on your requirements.

See Also