Currency Conversion API provides a simple REST API with real-time and historical exchange rates for 161 world currencies, delivering currency pairs in universally usable JSON format - compatible with any of your applications.
Spot exchange rate data is retrieved from several major forex data providers in real-time, validated, processed and delivered hourly, every 10 minutes, or even within the 60-second market window.
Providing the most representative forex market value available ("midpoint" value) for every API request, the Currency Conversion API powers currency converters, mobile applications, financial software components and back-office systems all around the world.
https://currencyconversionapi.com/api/v1/
After signing up you will receive an API access key (shown in your dashboard) used to access any of the API endpoints.
To authenticate with the API, you must provide your API access key in the access_key
parameter of the API endpoint URL:
All API data is returned in an easily parsable JSON format.
Below is an example response using the convert endpoint to convert currencies.
{
"success": true,
"terms": "https://currencyconversionapi.com/terms-and-conditions",
"privacy": "https://currencyconversionapi.com/privacy-policy",
"query": {
"from": "USD",
"to": "GBP",
"amount": 10
},
"info": {
"timestamp": 1430068515,
"quota": 0.658443
},
"result": 6.58443
}
If your request fails, the API will return a 3-digit error-code along with an internal error type and a plain text "info" parameter containing suggestions for the user.
Below is an example error caused by providing an invalid API Access Key.
{
"success": false,
"error": {
"code": 102,
"title": "invalid_access_key",
"info": "You supplied an invalid Access Key."
}
}
Code | Type | Description |
---|---|---|
101 | missing_access_key | You did not supply an Access Key. |
102 | invalid_access_key | You supplied an invalid Access Key. |
104 | usage_limit_reached | You have reached your subscription plan's monthly API request allowance. |
105 | access_restricted | Your current subscription plan does not support this API function. |
106 | invalid_callback_function_name | You have not supplied a valid callback function name. |
301 | missing_property | A required parameter has not been supplied. |
404 | 404_not_found | The requested API resource does not exist. |
405 | method_not_allowed | Method not allowed. Supported methods: GET, POST. |
500 | server_error | Something went wrong - Internal server error. |
Please Note: This is not a complete list of errors. If you come receive an error message you are not sure about please contact our support.
The API also supports JSONP callbacks so you can use the service in javascript.
To specify the javascript function to be called, provide the callback=
parameter to any of the endpoints.
Not sure what JSONP is? Here's an explanation Stack Overflow.
// Set the endpoint and the callback function name
var endpoint = 'https://currencyconversionapi.com/api/v1/live?access_key=YOUR_ACCESS_KEY&callback=my_callback_function';
// Define the callback function
function my_callback_function(json){
//log to the console
console.log('json', json);
// Alert the result object properties
alert(json.success);
alert(json.info.timestamp);
alert(json.info.quota);
alert(json.result);
}
// Validate VAT number via jQuery AJAX call with JSONP callback
$.ajax(
url: endpoint,
dataType: 'jsonp',
jsonpCallback: 'my_callback_function',
jsonp: 'callback',
});
my_callback_function({
{
"success": true,
"terms": "https://currencyconversionapi.com/terms-and-conditions",
"privacy": "https://currencyconversionapi.com/privacy-policy",
"query": {
"from": "USD",
"to": "EUR",
"amount": 10
},
"info": {
"timestamp": 1430068515,
"quota": 0.658443
},
"result": 6.58443
}
})
A full list of supported currencies can be accessed both in JSON Format (access key required) and on this website.
In order to access a JSON file containing all currently supported currencies (3-letter currency code and full currency name), simply attach your access_key
to the Currency Conversion API list endpoint:
success
boolean
Contains true
if the request was processed successfully and did not generate any errors and false
if there was a problem.
terms
stringReturns a link to the Currency Conversion API Terms & Conditions.
privacy
stringReturns a link to the Currency Conversion API Privacy Policy.
currencies
objectReturns all currencies supported by the Currency Conversion API.
Both free and paid users may access real-time exchange rates using the Currency Conversion API live endpoint.
Optionally, it is possible to define an additional source
currency and specific output currencies using the targets
parameter. Both of these options will be discussed in detail throughout this documentation.
success
boolean
Contains true
if the request was processed successfully and did not generate any errors and false
if there was a problem.
terms
stringReturns a link to the Currency Conversion API Terms & Conditions.
privacy
stringReturns a link to the Currency Conversion API Privacy Policy.
timestamp
integerReturns the exact date and time (UNIX) the exchange rates were collected.
source
string
Returns the currency to which all exchange rates are relative. (default: USD
)
quotes
objectContains all exchange rate values, consisting of the currency pairs and their respective conversion rates.
The Currency Conversion API provides accurate historical exchange rate data for every past day all the way back to the year of 1999.
Historical rates may be accessed by simply attaching the date
parameter with a valid date (Format: YYYY-MM-DD
) to the API's historical
endpoint.
success
boolean
Contains true
if the request was processed successfully and did not generate any errors and false
if there was a problem.
terms
stringReturns a link to the Currency Conversion API Terms & Conditions.
privacy
stringReturns a link to the Currency Conversion API Privacy Policy.
historical
boolean
Returns true
to confirm your request to the Historical endpoint.
date
stringContains selected date.
timestamp
integerReturns the exact date and time (UNIX) the exchange rates were collected.
source
string
Returns the currency to which all exchange rates are relative. (default: USD
)
quotes
objectContains all exchange rate values, consisting of the currency pairs and their respective conversion rates.
Using the convert
endpoint, you may request the Currency Conversion API to perform a Single currency conversion on your behalf.
To use this endpoint, simply specify a from
currency code, a to
Currency Code, and the amount
you would like to convert.
YYYY-MM-DD
)success
boolean
Contains true
if the request was processed successfully and did not generate any errors and false
if there was a problem.
terms
stringReturns a link to the Currency Conversion API Terms & Conditions.
privacy
stringReturns a link to the Currency Conversion API Privacy Policy.
query > from
stringReturns the currency the given amount is converted from.
query > to
stringReturns the currency the given amount is converted to.
query > amount
doubleReturns the conversion amount.
info > timestamp
integerReturns the exact date and time (UNIX) the exchange rate was collected.
info > quote
doubleReturns the exchange rate used for the conversion.
historical
boolean
Returns true
to confirm your historical currency conversion request.
date
stringReturns the date specified for your historical currency conversion request.
result
doubleReturns your conversion result.
If your subscription plan features the timeframe
API endpoint, you may request historical exchange rates for a time-period of your choice. (maximum range: 365 days)
To use this endpoint, simply specify your preferred time frame, consisting of a start_date
and an end_date
, both of the format YYYY-MM-DD
.
success
boolean
Contains true
if the request was processed successfully and did not generate any errors and false
if there was a problem.
terms
stringReturns a link to the Currency Conversion API Terms & Conditions.
privacy
stringReturns a link to the Currency Conversion API Privacy Policy.
timeframe
boolean
Returns true
to confirm your request to the Time-Frame endpoint.
start_date
stringReturns the specified start date.
end_date
stringReturns the specified end date.
source
string
Returns the currency to which all exchange rates are relative. (default: USD
)
quotes
object
The quotes
object will contain one sub-object with exchange rate data per day in your time frame.
Using the API's change
endpoint, you may request the change (both margin and percentage) of one or more currencies, relative to a Source Currency, within a specific time-frame (optional).
Unlike with Time-Frame Queries, performing a Currency-Change Query does not require you to specify a time-frame. If you do not provide a time-frame, the API will automatically return the change
values ranging from yesterday's EOD (End Of Day) data, to the latest available exchange rates of today.
However, if you decide to specify a start_date
and and end_date
(both of the format YYYY-MM-DD), the API will return change
values for your preferred time-frame.
success
boolean
Contains true
if the request was processed successfully and did not generate any errors and false
if there was a problem.
terms
stringReturns a link to the Currency Conversion API Terms & Conditions.
privacy
stringReturns a link to the Currency Conversion API Privacy Policy.
change
boolean
Returns true
to confirm your request to the Currency-Change endpoint.
start_date
stringReturns the specified start date.
end_date
stringReturns the specified end date.
source
string
Returns the currency to which all exchange rates are relative. (default: USD
)
quotes
object
The quotes
object will contain one sub-object with exchange rate data per day in your time frame.
Download a clean HTML <table>
containing all supported currencies:
<table>
<thead>
<tr>
<th>Code</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>AED</td>
<td>United Arab Emirates Dirham</td>
</tr>
<tr>
<td>AFN</td>
<td>Afghan Afghani</td>
</tr>
<tr>
<td>ALL</td>
<td>Albanian Lek</td>
</tr>
<tr>
<td>AMD</td>
<td>Armenian Dram</td>
</tr>
<tr>
<td>ANG</td>
<td>Netherlands Antillean Guilder</td>
</tr>
[...]
</tbody>
</table>