Authentication
Most API endpoints require authentication using a Bearer token. After creating an account, you can find your API key in the dashboard.
Include your API key in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEY
Important: Keep your API key secret. Do not expose it in client-side code, public repositories, or share it with unauthorized parties. If your key is compromised, regenerate it immediately from your dashboard.
Base URL
All API requests should be made to the following base URL:
https://xratesapi.com/api/v1
Error Handling
The API uses standard HTTP status codes. Error responses include a JSON body with details:
| Status Code | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized - Invalid or missing API key |
| 422 | Validation error - Invalid parameters |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
{
"success": false,
"error": {
"code": 401,
"message": "Invalid API key."
}
}
Endpoints
/api/v1/status
Check the API status and availability. This endpoint does not require authentication and can be used for health checks and monitoring.
Parameters
No parameters required.
Example Request
curl https://xratesapi.com/api/v1/status
Example Response
{
"success": true,
"status": "operational",
"message": "XRates API is running.",
"timestamp": "2026-03-09T12:00:00Z"
}
/api/v1/latest
Retrieve the latest exchange rates. Returns the most recent exchange rate data available for the specified base currency and target symbols.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| base | string | No | Base currency code (default: USD) |
| symbols | string | No | Comma-separated list of target currency codes |
Example Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://xratesapi.com/api/v1/latest?base=USD&symbols=EUR,GBP"
Example Response
{
"success": true,
"base": "USD",
"date": "2026-03-09",
"rates": {
"EUR": 0.8654,
"GBP": 1.3354
}
}
/api/v1/{date}
Retrieve historical exchange rates for a specific date. The date must be provided in
YYYY-MM-DD format.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| {date} | string | Yes | Date in YYYY-MM-DD format (URL path parameter) |
| base | string | No | Base currency code (default: USD) |
| symbols | string | No | Comma-separated list of target currency codes |
Example Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://xratesapi.com/api/v1/2026-03-01?base=USD&symbols=EUR,GBP"
Example Response
{
"success": true,
"historical": true,
"base": "USD",
"date": "2026-03-01",
"rates": {
"EUR": 0.8621,
"GBP": 1.3298
}
}
/api/v1/currencies
Retrieve a list of all supported currencies with their full names. Useful for building currency selectors and validating currency codes.
Parameters
No parameters required.
Example Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://xratesapi.com/api/v1/currencies"
Example Response
{
"success": true,
"currencies": {
"USD": "United States Dollar",
"EUR": "Euro",
"GBP": "British Pound Sterling",
"JPY": "Japanese Yen",
"CHF": "Swiss Franc",
"CAD": "Canadian Dollar",
"AUD": "Australian Dollar",
"CNY": "Chinese Yuan",
"RUB": "Russian Ruble",
"..."
}
}
/api/v1/convert
Convert an amount from one currency to another using the latest exchange rates. Returns both the converted amount and the exchange rate used.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| from | string | Yes | Source currency code |
| to | string | Yes | Target currency code |
| amount | number | Yes | Amount to convert |
Example Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://xratesapi.com/api/v1/convert?from=USD&to=EUR&amount=100"
Example Response
{
"success": true,
"query": {
"from": "USD",
"to": "EUR",
"amount": 100
},
"info": {
"rate": 0.8654,
"timestamp": "2026-03-09T12:00:00Z"
},
"date": "2026-03-09",
"result": 86.54
}
/api/v1/timeseries
Retrieve daily exchange rates between two dates. Useful for building charts and analyzing currency trends over time. Maximum date range is 365 days.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| start_date | string | Yes | Start date in YYYY-MM-DD format |
| end_date | string | Yes | End date in YYYY-MM-DD format |
| base | string | No | Base currency code (default: USD) |
| symbols | string | No | Comma-separated list of target currency codes |
Example Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://xratesapi.com/api/v1/timeseries?start_date=2026-01-01&end_date=2026-01-31&base=USD&symbols=EUR"
Example Response
{
"success": true,
"timeseries": true,
"base": "USD",
"start_date": "2026-01-01",
"end_date": "2026-01-31",
"rates": {
"2026-01-01": {
"EUR": 0.8612
},
"2026-01-02": {
"EUR": 0.8625
},
"2026-01-03": {
"EUR": 0.8598
},
"...": "..."
}
}
/api/v1/fluctuation
Retrieve currency fluctuation data between two dates. Returns the start rate, end rate, change amount, and change percentage for each specified currency. Maximum date range is 365 days.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| start_date | string | Yes | Start date in YYYY-MM-DD format |
| end_date | string | Yes | End date in YYYY-MM-DD format |
| base | string | No | Base currency code (default: USD) |
| symbols | string | No | Comma-separated list of target currency codes |
Example Request
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://xratesapi.com/api/v1/fluctuation?start_date=2026-01-01&end_date=2026-01-31&base=USD&symbols=EUR"
Example Response
{
"success": true,
"fluctuation": true,
"base": "USD",
"start_date": "2026-01-01",
"end_date": "2026-01-31",
"rates": {
"EUR": {
"start_rate": 0.8612,
"end_rate": 0.8654,
"change": 0.0042,
"change_pct": 0.4878
}
}
}