By default, the API returns rates for all currencies, but if you need to minimise transfer size, you can request a limited subset of exchange rates, where available, by setting the symbols
(alias: currencies
) parameter in your request.
Requesting specific currency rates is available for all clients, including Free subscribers.
We recommend using this parameter as much as possible to reduce response weight, which can improve performance, especially on mobile devices and low-bandwidth connections.
Symbols (currencies) should be provided as a comma-separated list of standard 3-letter ISO currency codes (see our list of available API currencies if in doubt), in any order.
Basic Request & Response
Append the symbols
query parameter to your API request, along with the comma-separated list of 3-digit ISO currency codes or symbols you require (in any order), like so:
https://openexchangerates.org/api/latest.json
?app_id=[[app:app_id]]
&symbols=GBP,EUR,AED,CAD
$.get('https://openexchangerates.org/api/latest.json', {app_id: '[[app:app_id]]', symbols: 'GBP,EUR,AED,CAD'}, function(data) {
console.log(data);
});
The response format is exactly the same as the standard API response, with all rates in the rates
object given relative to 1 standard unit of your requested base
currency:
{
disclaimer: "https://openexchangerates.org/terms/",
license: "https://openexchangerates.org/license/",
"timestamp": 1424127600,
"base": "USD",
"rates": {
"AED": 3.67295,
"CAD": 0.99075,
"EUR": 0.793903,
"GBP": 0.62885
}
}
The response format is the same as the standard API response, with only your requested currencies delivered in the rates
object.
Basic Code Samples
$.get('https://openexchangerates.org/api/latest.json', {app_id: '[[app:app_id]]', symbols: 'QAR,RUB,SEK'}, function(data) {
console.log("1 US Dollar equals " + data.rates.SEK + " Swedish Krona");
});
More code samples are on their way! Please get in touch if you'd like to submit a new/improved code sample in your languague or framework.
Combining Parameters
Requesting specific currency symbols can be combined with other API parameters, such as changing the base currency (base
) and JSONP callbacks (callback
) – for example:
https://openexchangerates.org/api/historical/2015-02-16.json
?app_id=[[app:app_id]]
&base=CAD
&symbols=AUD,GBP,EUR
&callback=someFunctionName
The response will combine your parameters:
someFunctionName(
{
disclaimer: "https://openexchangerates.org/terms/",
license: "https://openexchangerates.org/license/",
timestamp: 1424127600,
base: "CAD",
rates: {
AUD: 1.032828,
EUR: 0.706867,
GBP: 0.522328,
}
}
)
The parameter is also available (and strongly recommended) for Time Series requests.