Currency Conversion API
Convert an amount from one currency to one or multiple target currencies using current exchange rates.
Endpoint
GET /convert
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | Yes | Source currency code - e.g., USD |
to | string | Yes | Comma-separated target currencies - e.g., EUR,GBP,JPY |
amount | number | No | Amount 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
| Field | Type | Description |
|---|---|---|
from | string | The source currency code |
amount | number | The amount that was converted |
conversions | object | Converted amounts by target currency |
timestamp | string | ISO 8601 timestamp of conversion |
Status Codes
| Status | Description |
|---|---|
| 200 | Success - Conversion completed |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Server 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-LimitX-RateLimit-RemainingX-RateLimit-Reset
Performance Tips
- Cache rates for short periods if doing multiple conversions
- Use specific target currencies instead of converting to all
- Batch multiple conversions in single requests when possible
See Also
- Latest Rates API - Get individual rates
- Historical Rates API - Historical conversions
- List Currencies - Supported currencies