Forex API Documentation

Forex API

Elk Layer API provides you the real time and historical exchange rates data of all currencies for more than 40 countries. It gives you the most recent and reliable data sourced by our aggregated feed. Elk Layer API is more trusted by all bankers and financial businessmen worldwide. Our professional developers are always available for all users who search for Elk Layer API and cannot use the proper way. Along with the indicators and signal API, users can access the most recent data, market trends in just one click.

You can add or remove any irregular prices as well. You can access Elk Layer API by signing up to our services. Thousands of analysts and developers are using our most popular exchange rates API. You can install a server by utilizing the different API to get live-time Data information just like currency converters to check the most recent rates and it sounds like the most significant API we have offered you now.

Parameters and their use

ParameterUsage
IDSet pair ID in parameter value to get your required pair data.
Default: none. Example: id=1,2,3... etc,
To get all list of Pair ID's or Pair short name use "Pair List API".
SymbolYou can use currency pair name, instant of ID when you need.
Default: none.
Example: symbol=EURUSD,USDJPY,GBPNZD etc,

Note: When you use ID and symbol parameter, than symbol param will be ignored.
CategoryCategory is used to get all paris in specific forex category, to get all forex pairs, use category=forex
Default: none.
Valid values: forex, crypto, stock
PeriodTo get specifi time period history or candle prices, use the period parameter
Default: 1h
Valid Values: 1m,5m,15m,30m,1h,2h,4h,1d,1w,month
Alternate: 1,5,15,30,60,120,240,1440,10080,43200
FromWhen you need history data of specific date.
Default: none
Format: YYYY-MM-DD E.g: 2024-04-27
OR YYYY-MM-DD Hour:Min E.g: 2024-04-27 06:04
To When you need history data of specific date.
Default: none
Format: YYYY-MM-DD E.g: 2024-04-27
OR YYYY-MM-DD Hour:Min E.g: 2024-04-27 06:04
CandleLatest Rates API return last 2 candles of each pair, so you can filter, which candle you need. A previous closed candle, or current active candle prices.
Default: active
Values: active, close, both
OutputSet your API response format.
Default: JSON
Valid Values: JSON, JSONP, object, XML, serialize and array
Note: All parameters are in lower case sensitive.

Available Pairs List

This API will return all available forex pairs list that we have in our database. First you need to use this api to get all IDs and pairs name to use in other APIs.

Accepted Params:
category = forex
auth_key = AUTH_KEY

API:

Return All forex currency symbols list.

https://elklayer.com/api/v1/list?category=forex&auth_key=AUTH_KEY
Response:
{
  "id"2090,
  "name""Australian Dollar vs US Dollar",
  "symbol""AUDUSD",
  "category""forex",
  "type""major",
  "decimal"5, // No of decimals in price
  "points""0.00001", // smallest price unit of currency
  "base""AUD", // Base Currency
  "quote""USD" // Quote Currency
},
{and more...},

Forex Pair Details

Get pair profile details such as id, name, decimals, Trading times, bank, country

Accepted Params:
id = {any valid ID}
symbol = {any valid short name}
category = major,exotic,minor
auth_key = AUTH_KEY

Profile by IDs
https://elklayer.com/api/v1/profile?id=2090,2091,2092&auth_key=AUTH_KEY
By Symbol Combination:
https://elklayer.com/api/v1/profile?symbol=EURUSD,GBPCHF&auth_key=AUTH_KEY
By Currency Short Name:
https://elklayer.com/api/v1/profile?category=major&auth_key=AUTH_KEY
Response:
{ //Forex Currency Profile
  "id" : 2090,
  "short_name" : "AUDUSD",
  "name" : "Australian Dollar vs US Dollar",
  "status" : 1,
  "decimals" : 5,
  "points" : "0.00001",
  "base_curr" : "AUD",
  "quote_curr" : "USD",
  "category" : "forex",
  "type" : "major",
  "trading_days" : ["..."],
},
{and more...},

Currency Latest Price

Forex latest price API is very useful, you must have to get in touch with the updated price of a currency That's why the latest prices are included in any API which is the most common part. We provide one or multiple currency prices at the same time, To do so, you just have to send the request with symbols parameter in API request and set it to one or more comma-separated codes of a currency.
Note: We update the prices of each currency in every 30 seconds or less.
And use Last Candle API if you need time frame latest price, like 5m,1h,1week candle price.

Accepted Parameters :
id = {Any valid FX ID}
symbol = {Any valid FX symbol}
period = {Any valid period}
candle = {active,close,both}
category = {Any valid category}
auth_key = AUTH_KEY

Request Credit Usage: 1 credit count for each 100 record returned (rounded up).

Price of one id:
https://elklayer.com/api/v1/latest?id=2090&auth_key=AUTH_KEY
Multiple prices by ids:
https://elklayer.com/api/v1/latest?id=2090,2091,2092&auth_key=AUTH_KEY
Prices by candle:
https://elklayer.com/api/v1/latest?candle=active&auth_key=AUTH_KEY
Response:
{
  "id"2110,
  "s""GBPAUD", // Symbol
  "o""1.18000", // Open
  "h""1.18038", // High
  "l""1.17972", // Low
  "c""1.18027", // Price/Close, Current price
  "a""1.18038", // Ask
  "b""1.18016", // Bid
  "sp""2.2", // Spread
  "ch""+0.0002", // Change in 1 day candle
  "cp"+0.02%, // Change in percentage
  "v""64124", // Volume
  "t""1596575732", // When update last time Time Unix Format (UTC)
  "tm""2020-08-04 21:15:03", // When update last time (UTC)
  "up""2020-08-04 21:14:30",
},
{
and more...},
Note: All Above prices are not latest price. it is only for sample response, you can use API to get latest price.

Base Currency

On the base of 1 currency, it will return all quote prices of all available currencies.

Accepted Parameters :
symbol = {Any FX/Crypto currency symbol} e.g: EUR,USD, JPY etc
auth_key = AUTH_KEY
Candle API by ID:

https://elklayer.com/api/v1/base?symbol=USD&auth_key=AUTH_KEY
Response:

Return all quotes of all currencies in forex/crypto, depend what "type" parameter value you specified.

{
  "prices": {
      "AUD""1.4886269",
      "EUR""0.9472567",
      "USD""1"
  }
  "update_time": {
      "AUD""1677493260",
      "EUR""1677493200",
      "USD""1677493200"
  }
}
Eligibility : Users with standard and above subscription can access this endpoint.
Note: All Above quotes are not current price it is only for sample response, you can use API to get current quote price.

FX Historical Price API

Elk Layer API provides you the historical data of the stock market whenever you need the information. You can access more than 100 currencies with the pairs of multiple stock exchange rates updates in real time with all supported symbols, all in one API Elk Layer. The old currencies data is available for all symbols from the year of 1995 in 1 day and the above time frame, 1 month, 5 month or the less historical data up to 6 months. You will find the historical data by appending a date (format YYYY-MM-DD) in API URL with the base URL and specify the period parameter values: {1m, 5m, 30m, 1h, 2h, 4h, 5h, 1d, 1w, and month}

Accepted Parameters :
id = {Any valid FX ID}
symbol = {Any valid Fx symbol}
period = {TimeFrame period} {1m,5m,15m,30m,1h,2h,4h,5h,1d,1w,month}
from = {Date from} & To = {date to} (Use both at a time or ignore both for latest history)
auth_key = AUTH_KEY

Return Latest candles
https://elklayer.com/api/v1/history?id=2090&period=1h&auth_key=AUTH_KEY
History Between Specific Date {YYYY-MM-DD}
https://elklayer.com/api/v1/history
   ?symbol=EUR/USD
   &period=1d
   &from=2023-10-01 OR 1696118400 // Unix format
   &to=2024-04-26 OR 1714089600
   &auth_key=AUTH_KEY

Do not use FROM and TO parameter : If you always need the latest history upto 900 candles, then you must have to take care of From/To parameter, that should not be assigned and remove them from URL, Then it will work better, With FROM and TO parameter it will take more time in response.

Or Between Specific Date-Time
https://elklayer.com/api/v1/history?symbol=EUR/USD&period=1d&from=2023-10-01T12:00&to=2024-04-26T12:00&auth_key=AUTH_KEY
Response:
Note: Historical data my be delay from 1 minute to 5 minute.

{
  "o""0.9765", // Open
  "h""0.9806", // High
  "l""0.9765", // Low
  "c""0.9792", // Close
  "t"1665712800000, // Time Unix Format (UTC)
  "tm""2022-10-14 02:00:00" // Date Time (UTC)
},
{
and 900 more historical candles...},

Eligibility : Free users can't use "From/To" parameters.