Skip to main content

Currency Conversion API

Convert an amount from one currency to one or multiple target currencies using current exchange rates.

Endpoint

GET /convert

Parameters

ParameterTypeRequiredDescription
fromstringYesSource currency code - e.g., USD
tostringYesComma-separated target currencies - e.g., EUR,GBP,JPY
amountnumberNoAmount to convert. Defaults to 1 if omitted.

Request Example

curl -X GET "https://api.openfxrates.com/convert?from=USD&to=EUR,GBP,JPY&amount=100" \
-H "X-API-Key: your-api-key-here"

Response Schema

{
"from": "USD",
"amount": 100,
"conversions": {
"EUR": 92.00,
"GBP": 79.00,
"JPY": 15025.00
},
"timestamp": "2024-12-25T10:30:00Z"
}

Response Fields

FieldTypeDescription
fromstringThe source currency code
amountnumberThe amount that was converted
conversionsobjectConverted amounts by target currency
timestampstringISO 8601 timestamp of conversion

Status Codes

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

Examples

Convert $100 USD to EUR, GBP, JPY

curl -X GET "https://api.openfxrates.com/convert?from=USD&to=EUR,GBP,JPY&amount=100" \
-H "X-API-Key: your-api-key"

Response:

{
"from": "USD",
"amount": 100,
"conversions": {
"EUR": 92.00,
"GBP": 79.00,
"JPY": 15025.00
},
"timestamp": "2024-12-25T10:30:00Z"
}

Convert 1 EUR to multiple currencies

curl -X GET "https://api.openfxrates.com/convert?from=EUR&to=USD,GBP,CHF,AUD" \
-H "X-API-Key: your-api-key"

Use Cases

  • 🛍️ E-commerce - Display prices in customer's currency
  • ✈️ Travel - Show converted prices for hotels and flights
  • 💳 Payment Processing - Convert payment amounts
  • 📱 Mobile Apps - Real-time currency conversion for users

Precision

  • Decimal Places: 2-4 depending on currency
  • Rounding: Follows standard banking rules
  • Accuracy: Based on current market rates

Rate Limiting

Same as other endpoints. Monitor response headers:

  • X-RateLimit-Limit
  • X-RateLimit-Remaining
  • X-RateLimit-Reset

Performance Tips

  1. Cache rates for short periods if doing multiple conversions
  2. Use specific target currencies instead of converting to all
  3. Batch multiple conversions in single requests when possible

See Also