Fixer API
Powered by 15+ exchange rate data sources, the Fixer API is capable of delivering real-time exchange rate data for 170 world currencies. The API comes with multiple endpoints, each serving a different use case. Endpoint functionalities include getting the latest exchange rate data for all or a specific set of currencies, converting amounts from one currency to another, retrieving Time-Series data for one or multiple currencies and querying the API for daily fluctuation data.
Throughout this documentation you will learn about API structure, methods, potential errors and code examples. In case there any question is left unanswered, please make sure to contact us and our team will be happy to help out.
Quickstart Tool
No time for long documentation articles? We've got you covered - in the Dashboard section of your control panel you will be able to access our Quickstart tool and test all API endpoints at the click of a button.
Sign up for a free using the button below to use the Fixer Quickstart tool.
Get a free API keyGetting Started
Definitions
Definition | Description |
---|---|
API Key | A unique key assigned to each API account used to authenticate with the API. |
Symbol | Refers to the three-letter currency code of a given currency. |
Base Currency | The currency to which exchange rates are relative to. (If 1 USD = X EUR, USD is the base currency) |
Target Currency | The currency an amount is converted to. (If 1 USD = X EUR, EUR is the target currency) |
Base URL | Refers to URL which all API request endpoints and URLs are based on. |
API Key
Your API Key is the unique key that is passed into the API base URL's access_key
parameter in order to authenticate with the Fixer API.
Base URL:
https://data.fixer.io/api/
Append your API Key: Here is how to authenticate with the Fixer API:
Sign Up to Run API Requesthttps://data.fixer.io/api/latest ? access_key = API_KEY
API Response
Exchange rates delivered by the Fixer API are by default relative to EUR. All data is returned in standard JSON format and can be parsed easily using any programming language.
Example Response: Below you will find an example API response carrying a number of common world currencies, all relative to the currency EUR and time stamped at the exact time they were collected.
{ "success": true, "timestamp": 1519296206, "base": "EUR", "date": "2023-09-21", "rates": { "AUD": 1.566015, "CAD": 1.560132, "CHF": 1.154727, "CNY": 7.827874, "GBP": 0.882047, "JPY": 132.360679, "USD": 1.23396, [...] } }
As illustrated above, the API's response - when queried for real-time exchange rates - always contains a timestamp
object containing a standard UNIX time stamp indicating the time the given exchange rate data was collected, a base
object containing the three-letter currency code of the base currency, a date
object containing the date the given exchange rate data was collected, and a rates
object containing the actual exchange rate data.
Further below, in the Endpoints section, the API response structure will be discussed in detail.
Available Endpoints
The Fixer API comes with X API endpoints, each providing a different functionality. Please note that depending on your subscription plan, certain API endpoints may or may not be available.
- Latest rates endpointReturns real-time exchange rate data for all available or a specific set of currencies.
- Convert endpointAllows for conversion of any amount from one currency to another.
- Historical rates endpointReturns historical exchange rate data for all available or a specific set of currencies.
- Time-Series data endpointReturns daily historical exchange rate data between two specified dates for all available or a specific set of currencies.
- Fluctuation data endpointReturns fluctuation data between two specified dates for all available or a specific set of currencies.
SSL Connection
All paid subscription plans available on Fixer.io come with 256-bit SSL encryption. To connect to the API via SSL, simply use the https
protocol instead of standard http
.
JSONP Callbacks
The Fixer API comes with support for JSONP Callbacks. This feature enables you to specify a function name, pass it into the API's callback
GET parameter and cause the API to return your requested API response wrapped inside that function.
Example Call:
Sign Up to Run API Requesthttps://data.fixer.io/api/latest ? access_key = API_KEY & callback = MY_FUNCTION
In the example call above we are requesting the API to use the callback name MY_FUNCTION
.
Example Response: Your API response will be wrapped inside your preferred callback function.
({ "success": true, "timestamp": 1519296206, "base": "EUR", "date": "2023-09-21", "rates": { "AUD": 1.566015, "CAD": 1.560132, "CHF": 1.154727, "CNY": 7.827874, "GBP": 0.882047, "JPY": 132.360679, "USD": 1.23396, [...] } })
Access-Control / CORS
Fixer also supports Cross-Origin Resource Sharing (CORS) and Access-Control Headers. This will enable you to use the Fixer API via Cross-Origin HTTP Requests.
HTTP ETags
HTTP ETags are a way of reducing the load on your back-end by requesting new Fixer data only if rates have changed since the last API response.
What are ETags?
An ETag is a part of the HTTP protocol and one of the several mechanisms used for cache validation. The ETag is an identifier assigned to a data resource in a server, and if that resource is ever updated at the server, the ETag is changed.
Whenever a resource is requested (via its URL), the data and ETag are retrieved and stored in the Web cache, and the ETag is sent along with subsequent requests. If the ETag at the server has not changed, a "Not Modified" message is returned, and the cached data is used. (Definition by pcmag.com)
ETags - Quickstart Guide
Step 1Your initial request to the Fixer API will create an ETag
object containing a unique ETag key and a Date
object containing the exact date and time at which the data was last modified. This data must be cached along with the entire API response in order for ETags to work.
ETag: "202567a75aef2e66a3ebf2366bff048f" Date: Mon, 12 Apr 2018 11:30:01 GMTStep 2
Once you make another API request, make sure to include the If-None-Match
HTTP header abd set ut to your previously generated ETag value. Moreover, you will need to add the If-Modified-Since
HTTP header to your API request containing the date and time data from your last request.
If-None-Match: "1872ade88f3013edeb33decd74a4f947" If-Modified-Since: Fri, 10 Apr 2015 12:10:04 GMTStep 3
Depending on whether or not your result set has updated since your last API request, the API will return either:
- the results from your initial API request along with a
304 – Not Modified
HTTP header indicating that no change has occured. In this case, the size of the API response will be as small as 0.2kb; - or new results with an entirely new set of
ETag
andDate
objects indicating that new data has been accessed. In this case, the size of your API response will be normal.
Potential Errors
Whenever a requested resource is not available or an API call fails for another reason, a JSON error is returned. Errors always come with an error code and a description.
Example Error: The following error is returned if your monthly API request volume has been exceeded.
{ "success": false, "error": { "code": 104, "info": "Your monthly API request volume has been reached. Please upgrade your plan." } }
Other Errors:
Error Code | Description |
---|---|
404 |
The requested resource does not exist. |
101 |
No API Key was specified or an invalid API Key was specified. |
103 |
The requested API endpoint does not exist. |
104 |
The maximum allowed API amount of monthly API requests has been reached. |
105 |
The current subscription plan does not support this API endpoint. |
106 |
The current request did not return any results. |
102 |
The account this API request is coming from is inactive. |
201 |
An invalid base currency has been entered. |
202 |
One or more invalid symbols have been specified. |
301 |
No date has been specified. [historical ] |
302 |
An invalid date has been specified. [historical , convert ] |
403 |
No or an invalid amount has been specified. [convert ] |
501 |
No or an invalid timeframe has been specified. [timeseries ] |
502 |
No or an invalid "start_date" has been specified. [timeseries , fluctuation ] |
503 |
No or an invalid "end_date" has been specified. [timeseries , fluctuation ] |
504 |
An invalid timeframe has been specified. [timeseries , fluctuation ] |
505 |
The specified timeframe is too long, exceeding 365 days. [timeseries , fluctuation ] |
Endpoints
Supported Symbols Endpoint
The Fixer API comes with a constantly updated endpoint returning all available currencies. To access this list, make a request to the API's symbols
endpoint.
API Request:
Sign Up to Run API Requesthttps://data.fixer.io/api/symbols ? access_key = API_KEY
Request Parameters:
Parameter | Description |
---|---|
access_key |
[Required] Your API Key. |
API Response:
{ "success": true, "symbols": { "AED": "United Arab Emirates Dirham", "AFN": "Afghan Afghani", "ALL": "Albanian Lek", "AMD": "Armenian Dram", [...] } }
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
symbols |
Returns all supported currencies with their respective three-letter currency codes and names. |
Latest Rates Endpoint
Depending on your subscription plan, the API's latest
endpoint will return real-time exchange rate data updated every 60 minutes, every 10 minutes or every 60 seconds.
API Request:
Sign Up to Run API Requesthttps://data.fixer.io/api/latest ? access_key = API_KEY & base = USD & symbols = GBP,JPY,EUR
Request Parameters:
Parameter | Description |
---|---|
access_key |
[required] Your API Key. |
base |
[optional] Enter the three-letter currency code of your preferred base currency. |
symbols |
[optional] Enter a list of comma-separated currency codes to limit output currencies. |
API Response:
{ "success": true, "timestamp": 1519296206, "base": "USD", "date": "2023-09-21", "rates": { "GBP": 0.72007, "JPY": 107.346001, "EUR": 0.813399, } }
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
timestamp |
Returns the exact date and time (UNIX time stamp) the given rates were collected. |
base |
Returns the three-letter currency code of the base currency used for this request. |
rates |
Returns exchange rate data for the currencies you have requested. |
Historical Rates Endpoint
Historical rates are available for most currencies all the way back to the year of 1999. You can query the Fixer API for historical rates by appending a date (format YYYY-MM-DD
) to the base URL.
API Request:
Sign Up to Run API Requesthttps://data.fixer.io/api/2013-12-24 ? access_key = API_KEY & base = GBP & symbols = USD,CAD,EUR
Request Parameters:
Parameter | Description |
---|---|
YYYY-MM-DD |
[required] A date in the past for which historical rates are requested. |
access_key |
[required] Your API Key. |
base |
[optional] Enter the three-letter currency code of your preferred base currency. |
symbols |
[optional] Enter a list of comma-separated currency codes to limit output currencies. |
API Response:
{ "success": true, "historical": true, "date": "2013-12-24", "timestamp": 1387929599, "base": "GBP", "rates": { "USD": 1.636492, "EUR": 1.196476, "CAD": 1.739516 } }
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
historical |
Returns true if a request for historical exchange rates was made. |
date |
Returns the date for which historical rates were requested. |
timestamp |
Returns the exact date and time (UNIX time stamp) the given rates were collected. |
base |
Returns the three-letter currency code of the base currency used for this request. |
rates |
Returns exchange rate data for the currencies you have requested. |
Specify Symbols
To reduce bandwidth you can limit the number of output currencies to a specific set of your choice on most API endpoints. To do so, simply append the Fixer API's symbols
parameter to your API request and set it to one or more comma-separated currency codes.
Example:
Sign Up to Run API Requesthttps://data.fixer.io/api/latest ? access_key = API_KEY & symbols = USD,CAD,JPY
The API's response for the request above will be limited to the currencies USD, CAD and JPY.
Changing base currency
Provided changing base currency is supported on your subscription plan, you can change the currency to which your output currency rates are relative to by appending the base
parameter to your API request URL and setting it to the three-letter code of your preferred base currency.
Example:
Sign Up to Run API Requesthttps://data.fixer.io/api/latest ? access_key = API_KEY & base = USD
Please note: The default base currency is EUR.
Convert Endpoint
The Fixer API comes with a separate currency conversion endpoint, which can be used to convert any amount from one currency to another. In order to convert currencies, please use the API's convert
endpoint, append the from
and to
parameters and set them to your preferred base and target currency codes.
It is also possible to convert currencies using historical exchange rate data. To do this, please also use the API's date parameter
and set it to your preferred date. (format YYYY-MM-DD
)
API Request:
Sign Up to Run API Requesthttps://data.fixer.io/api/convert ? access_key = API_KEY & from = GBP & to = JPY & amount = 25
Request Parameters:
Parameter | Description |
---|---|
access_key |
[required] Your API Key. |
from |
[required] The three-letter currency code of the currency you would like to convert from. |
to |
[required] The three-letter currency code of the currency you would like to convert to. |
amount |
[required] The amount to be converted. |
date |
[optional] Specify a date (format YYYY-MM-DD ) to use historical rates for this conversion. |
API Response:
{
"success": true,
"query": {
"from": "GBP",
"to": "JPY",
"amount": 25
},
"info": {
"timestamp": 1519328414,
"rate": 148.972231
},
"historical": ""
"date": "2018-02-22"
"result": 3724.305775
}
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
query > from |
Returns the three-letter currency code of the currency converted from. |
query > to |
Returns the three-letter currency code of the currency converted to. |
query > to |
Returns the amount that is converted. |
info > timestamp |
Returns the exact date and time (UNIX time stamp) the given exchange rare was collected. |
info > rate |
Returns the exchange rate used for your conversion. |
historical |
Returns true if historical rates are used for this conversion. |
date |
Returns the date (format YYYY-MM-DD ) the given exchange rate data was collected. |
result |
Returns your conversion result. |
Time-Series Endpoint
If supported by your subscription plan, the Fixer API's timeseries
endpoint lets you query the API for daily historical rates between two dates of your choice, with a maximum time frame of 365 days.
API Request:
Sign Up to Run API Requesthttps://data.fixer.io/api/timeseries ? access_key = API_KEY & start_date = 2012-05-01 & end_date = 2012-05-25
Request Parameters:
Parameter | Description |
---|---|
access_key |
[required] Your API Key. |
start_date |
[required] The start date of your preferred timeframe. |
end_date |
[required] The end date of your preferred timeframe. |
base |
[optional] Enter the three-letter currency code of your preferred base currency. |
symbols |
[optional] Enter a list of comma-separated currency codes to limit output currencies. |
API Response:
{ "success": true, "timeseries": true, "start_date": "2012-05-01", "end_date": "2012-05-03", "base": "EUR", "rates": { "2012-05-01":{ "USD": 1.322891, "AUD": 1.278047, "CAD": 1.302303 }, "2012-05-02": { "USD": 1.315066, "AUD": 1.274202, "CAD": 1.299083 }, "2012-05-03": { "USD": 1.314491, "AUD": 1.280135, "CAD": 1.296868 }, [...] } }
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
timeseries |
Returns true if a request to the timeseries endpoint is made. |
start_date |
The start date of your time frame. |
end_date |
The end date of your time frame. |
base |
Returns the three-letter currency code of the base currency used for this request. |
rates |
Returns exchange rate data for the currencies you have requested. |
Fluctuation Endpoint
Using the Fixer API's fluctuation
endpoint you will be able to retrieve information about how currencies fluctuate on a day-to-day basis. To use this feature, simply append a start_date
and end_date
and choose which currencies (symbols) you would like to query the API for. Please note that the maximum allowed timeframe is 365 days.
API Request:
Sign Up to Run API Requesthttps://data.fixer.io/api/fluctuation ? access_key = API_KEY & start_date = 2015-12-01 & end_date = 2015-12-24
Request Parameters:
Parameter | Description |
---|---|
access_key |
[required] Your API Key. |
start_date |
[required] The start date of your preferred fluctuation timeframe. |
end_date |
[required] The end date of your preferred fluctuation timeframe. |
base |
[optional] Enter the three-letter currency code of your preferred base currency. |
symbols |
[optional] Enter a list of comma-separated currency codes to limit output currencies. |
API Response:
{ "success":true, "fluctuation":true, "start_date":"2018-02-25", "end_date":"2018-02-26", "base":"EUR", "rates":{ "USD":{ "start_rate":1.228952, "end_rate":1.232735, "change":0.0038, "change_pct":0.3078 }, "JPY":{ "start_rate":131.587611, "end_rate":131.651142, "change":0.0635, "change_pct":0.0483 }, [...] } }
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
fluctuation |
Returns true if a request to the fluctuation endpoint is made. |
start_date |
The start date of your time frame. |
end_date |
The end date of your time frame. |
base |
Returns the three-letter currency code of the base currency used for this request. |
rates |
Returns exchange rate data for the currencies you have requested. |
rates > start_rate |
Returns the exchange collected on your start date. |
rates > end_rate |
Returns the exchange collected on your end date. |
rates > change |
Returns the change (decimal number) of the given currency rate between your start and end date. |
rates > change |
Returns the percentage change of the given currency rate between your start and end date. |
Sample Code
PHP (cURL)
Real-time rates: Find below a simple PHP example for getting exchange rate data via the Fixer API's latest
endpoint.
// set API Endpoint and API key $endpoint = 'latest'; $access_key = 'API_KEY'; // Initialize CURL: $ch = curl_init('https://data.fixer.io/api/'.$endpoint.'?access_key='.$access_key.''); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Store the data: $json = curl_exec($ch); curl_close($ch); // Decode JSON response: $exchangeRates = json_decode($json, true); // Access the exchange rate values, e.g. GBP: echo $exchangeRates['rates']['GBP'];
Convert currencies: Here is how to convert currencies using PHP cURL.
// set API Endpoint, access key, required parameters $endpoint = 'convert'; $access_key = 'API_KEY'; $from = 'USD'; $to = 'EUR'; $amount = 10; // initialize CURL: $ch = curl_init('https://data.fixer.io/api/'.$endpoint.'?access_key='.$access_key.'&from='.$from.'&to='.$to.'&amount='.$amount.''); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // get the JSON data: $json = curl_exec($ch); curl_close($ch); // Decode JSON response: $conversionResult = json_decode($json, true); // access the conversion result echo $conversionResult['result'];
JavaScript (jQuery.ajax)
Real-time rates: Find below a simple jQuery.ajax example for getting exchange rate data via the Fixer API's latest
endpoint.
// set endpoint and your access key endpoint = 'latest' access_key = 'API_KEY'; // get the most recent exchange rates via the "latest" endpoint: $.ajax({ url: 'https://data.fixer.io/api/' + endpoint + '?access_key=' + access_key, dataType: 'jsonp', success: function(json) { // exchange rata data is stored in json.rates alert(json.rates.GBP); // base currency is stored in json.base alert(json.base); // timestamp can be accessed in json.timestamp alert(json.timestamp); } });
Convert currencies: Here is how to convert currencies using jQuery.ajax.
// set endpoint and your API key endpoint = 'convert'; access_key = 'API_KEY'; // define from currency, to currency, and amount from = 'EUR'; to = 'GBP'; amount = '10'; // execute the conversion using the "convert" endpoint: $.ajax({ url: 'https://data.fixer.io/api/' + endpoint + '?access_key=' + access_key +'&from=' + from + '&to=' + to + '&amount=' + amount, dataType: 'jsonp', success: function(json) { // access the conversion result in json.result alert(json.result); } });
Business Continuity - API Overages
Ensuring our customers achieve success is paramount to what we do at APILayer. For this reason, we will be rolling out our Business Continuity plan guaranteeing your end users will never see a drop in coverage. Every plan has a certain amount of API calls that you can make in the given month. However, we would never want to cut your traffic or impact user experience negatively for your website or application in case you get more traffic.
What is an overage?
An overage occurs when you go over a quota for your API plan. When you reach your API calls limit, we will charge you a small amount for each new API call so we can make sure there will be no disruption in the service we provide to you and your website or application can continue running smoothly.
Prices for additional API calls will vary based on your plan. See table below for prices per call and example of an overage billing.
Plan Name | Monthly Price | Number of Calls | Overage Price per call | Overage | Total price |
---|---|---|---|---|---|
Basic | $14.99 | 10,000 | 0.0017988 | 2000 | $18.59 |
Professional | $49.99 | 100,000 | 0.00059988 | 20,000 | $61.99 |
Professional Plus | $99.99 | 500,000 | 0.000239976 | 100,000 | $123.99 |
Why does APILayer have overage fees?
Overage fees allow developers to continue using an API once a quota limit is reached and give them time to upgrade their plan based on projected future use while ensuring API providers get paid for higher usage.
How do I know if I will be charged for overages?
When you are close to reaching your API calls limit for the month, you will receive an automatic notification (at 75%, 90% and 100% of your monthly quota). However, it is your responsibility to review and monitor for the plan’s usage limitations. You are required to keep track of your quota usage to prevent overages. You can do this by tracking the number of API calls you make and checking the dashboard for up-to-date usage statistics.
How will I be charged for my API subscription?
You will be charged for your monthly subscription plan, plus any overage fees applied. Your credit card will be billed after the billing period has ended.
What happens if I don’t have any overage fees?
In this case, there will be no change to your monthly invoice. Only billing cycles that incur overages will see any difference in monthly charges. The Business Continuity plan is an insurance plan to be used only if needed and guarantees your end users never see a drop in coverage from you.
What if I consistently have more API calls than my plan allows?
If your site consistently surpasses the set limits each month, you may face additional charges for the excess usage. Nevertheless, as your monthly usage reaches a certain threshold, it becomes more practical to consider upgrading to the next plan. By doing so, you ensure a smoother and more accommodating experience for your growing customer base.
I would like to upgrade my plan. How can I do that?
You can easily upgrade your plan by going to your Dashboard and selecting the new plan that would be more suitable for your business needs. Additionally, you may contact your Account Manager to discuss a custom plan if you expect a continuous increase in usage.