Exchange Rate API
The Exchange Rate API provides current and historical exchange rates on global currencies. Choose from hundreds of different currency pairs.
Note: This API provides exchange rates between fiat currencies. For crypto-to-fiat rates, use the Crypto Price API instead.
Available endpoints:
- /v1/exchangerate - Get the current exchange rate for a given currency pair.
- /v1/exchangeratehistorical - Get daily historical exchange rates back to 1999.
- /v1/currencyvolatility - Get the latest realized volatility, volatility cone, and HV rank for a currency pair.
- /v1/currencyvolatilityhistorical - Get a daily time series of historical volatility for a currency pair.
- /v1/currencyvolatilityforecast - Get EWMA or GARCH(1,1) volatility forecasts for a currency pair.
All supported currencies are available on the free tier with once-daily rates. Premium plans add real-time rates and historical data.
Analyzing FX risk? See the Currency Volatility endpoints below for realized volatility, cones, HV rank, and EWMA/GARCH forecasts (premium).
Supported Currencies
| Symbol | Currency | Symbol | Currency |
|---|---|---|---|
| USD | United States Dollar | EUR | Euro |
| GBP | British Pound | JPY | Japanese Yen |
| AUD | Australian Dollar | CAD | Canadian Dollar |
| CHF | Swiss Franc | CNY | Chinese Yuan |
| INR | Indian Rupee | HKD | Hong Kong Dollar |
| SGD | Singapore Dollar | MXN | Mexican Peso |
From 3,186 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 313ms | 353ms | 409ms | 622ms | 986ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
https://api.api-ninjas.com/v1/exchangerate
Returns the exchange rate for a given currency pair.
Data freshness depends on your plan: free-tier accounts receive once-daily exchange rates, while premium subscribers receive real-time rates.
Parameters
pairrequiredCurrency pair to query. Must be in the form of
currency1_currency2(e.g.USD_EUR).
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
currency_pairThe requested currency pair.
exchange_rateThe exchange rate for the given currency pair.
timestampUnix timestamp (in seconds) indicating the time at which the exchange rate was applied.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/exchangerate?pair=GBP_AUDHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/exchangerate?pair=GBP_AUD" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Premium only
https://api.api-ninjas.com/v1/exchangeratehistorical
Returns daily historical exchange rates for a given currency pair. Data is available back to January 1, 1999 for most currency pairs.
Parameters
pairrequiredCurrency pair to query. Must be in the form of
currency1_currency2(e.g.USD_EUR).dateoptionalSingle date to query, in
YYYY-MM-DDformat. EitherdateOR bothstart_dateandend_datemust be provided.start_dateoptionalStart date of a range query, in
YYYY-MM-DDformat. Must be used together withend_date.end_dateoptionalEnd date of a range query, in
YYYY-MM-DDformat. Date range cannot exceed 180 days.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON array of objects with the following fields, or an error if the request is unsuccessful. A single-date query returns an array of exactly one object.
pairThe requested currency pair.
dateDate of the rate, in
YYYY-MM-DDformat.rateThe exchange rate for the given currency pair on the given date.
Sample Historical Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/exchangeratehistorical?pair=USD_EUR&date=2020-03-15Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/exchangeratehistorical?pair=USD_EUR&date=2020-03-15" \
-H "X-Api-Key: YOUR_API_KEY"Currency Volatility
Premium subscribers can measure how much a currency pair fluctuates — its FX (historical) volatility — with realized volatility, EWMA (RiskMetrics, λ=0.94) and GARCH(1,1) forecasts, volatility cones, and HV-rank / percentile context. Available for the same 150+ currency pairs (excluding ZWG, BTC, XAG).
Premium only
https://api.api-ninjas.com/v1/currencyvolatility
Returns the latest realized (or EWMA) volatility for a currency pair over a lookback window, together with a volatility cone across standard window lengths and HV rank / percentile context.
Parameters
pairrequiredCurrency pair to query, in the form
currency1_currency2(e.g.EUR_USD).windowoptionalLookback window for the headline realized volatility, in trading days. Defaults to
30. Must be between 2 and 1000.methodoptionalVolatility method:
close_to_close(default) orewma.day_countoptionalAnnualization factor:
252trading days (default) or365calendar days.annualizedoptionalWhether to treat the annualized figure as the headline value. Defaults to
true.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
pairThe queried currency pair.
as_of_dateDate of the most recent return used (YYYY-MM-DD).
annualized_volatilityAnnualized volatility as a decimal (e.g.
0.0785= 7.85%).annualized_volatility_pctgives the same value as a percentage.daily_volatilityDaily volatility as a decimal.
daily_volatility_pctgives the percentage form.n_observationsNumber of returns used for the headline figure.
outliers_filteredNumber of extreme returns (over 30%) excluded as data artifacts or regime breaks.
percentile_contextObject with the HV rank and percentile of the current volatility within its trailing one-year distribution (
current_percentile,hv_rank,min,median,max,lookback_years).coneVolatility cone: an array with one entry per window length (10, 21, 63, 126, 252 trading days), each giving the historical
min,p25,median,p75,maxof rolling realized volatility plus thecurrentreading and itscurrent_percentile.method,window_days,day_count,annualizedEcho of the request configuration.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/currencyvolatility?pair=EUR_USD&window=30Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/currencyvolatility?pair=EUR_USD&window=30" \
-H "X-Api-Key: YOUR_API_KEY"Premium only
https://api.api-ninjas.com/v1/currencyvolatilityhistorical
Returns a daily time series of trailing rolling volatility for a currency pair over a date range, with each point tagged by its percentile rank, plus a volatility cone snapshot as of the end date.
Parameters
pairrequiredCurrency pair to query, in the form
currency1_currency2(e.g.EUR_USD).windowoptionalRolling window for volatility, in trading days. Defaults to
30.methodoptionalVolatility method:
close_to_close(default) orewma.daysoptionalLength of the trailing date range in calendar days, ending today. Defaults to
90. Maximum 1825. Mutually exclusive withstart_date/end_date.start_date,end_dateoptionalExplicit date range in
YYYY-MM-DDform. Provide both together instead ofdays. The range cannot exceed 1825 days.day_count,annualizedoptionalAnnualization factor (
252default or365) and headline-value toggle, as in the/v1/currencyvolatilityendpoint.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
seriesArray of daily points, each with a
date,annualized_volatility,daily_volatility, andpercentile(rank of that day's volatility within its trailing one-year distribution).coneVolatility cone as of the end date — same structure as in the
/v1/currencyvolatilityendpoint.n_points,outliers_filteredNumber of series points returned and the count of extreme returns excluded.
pair,method,window_days,day_count,annualized,start_date,end_dateEcho of the request configuration and resolved date range.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/currencyvolatilityhistorical?pair=EUR_USD&window=30&days=90Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/currencyvolatilityhistorical?pair=EUR_USD&window=30&days=90" \
-H "X-Api-Key: YOUR_API_KEY"Premium only
https://api.api-ninjas.com/v1/currencyvolatilityforecast
Returns forward-looking volatility estimates for a currency pair using EWMA (RiskMetrics) or GARCH(1,1). GARCH adds mean reversion toward a long-run volatility level; if the GARCH fit does not converge the response falls back to EWMA. These are model-based estimates, not predictions.
Parameters
pairrequiredCurrency pair to query, in the form
currency1_currency2(e.g.GBP_JPY).methodoptionalForecast method:
garch_11(default) orewma.lambdaoptionalEWMA decay factor, used only when
method=ewma. Defaults to0.94(RiskMetrics). Must be between 0.80 and 0.99.horizonoptionalComma-separated list of forecast horizons in trading days (e.g.
1,5,21,63). Defaults to1,5,21,63.day_countoptionalAnnualization factor:
252trading days (default) or365calendar days.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
current_conditional_vol_annualizedThe model's current one-step-ahead annualized volatility.
forecastArray of forecasts, each with a
horizon_days,vol_annualized, andvol_daily.parametersFitted model parameters. For
garch_11:omega,alpha,beta,persistence,long_run_var,long_run_vol_annualized, andfitted_on. Forewma:lambdaandfitted_on.fallbacktruewhen a requested GARCH fit did not converge and an EWMA estimate was returned instead.pair,as_of_date,method,day_count,outliers_filteredEcho of the request and the date of the most recent return used.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/currencyvolatilityforecast?pair=GBP_JPY&method=garch_11&horizon=1%2C5%2C21%2C63Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/currencyvolatilityforecast?pair=GBP_JPY&method=garch_11" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Examples above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Exchange Rate API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Exchange Rate API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Exchange Rate API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Exchange Rate API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.How do I look up the current exchange rate for a currency pair?
Send a GET request to the/v1/exchangerateendpoint with the requiredpairparameter formatted ascurrency1_currency2(for exampleGBP_AUDorUSD_EUR), and the response returns aratevalue along with atimestamp. You can browse all available endpoints and supported currencies on this page.Does the Exchange Rate API provide historical exchange rates?
Yes, the premium-only/v1/exchangeratehistoricalendpoint returns daily historical rates back to January 1, 1999 for most pairs; query a single day with thedateparameter or a span usingstart_dateandend_date(inYYYY-MM-DDformat, with a range no longer than 180 days). Historical access requires a paid plan, which you can review on the pricing page.How fresh are the exchange rates and how many currencies are covered?
The API covers hundreds of currency pairs across global currencies, and all currencies are available on the free tier with once-daily rates; premium plans add real-time rates and daily historical exchange rates. Each response includes atimestampfor the rate. For deriving converted amounts you can pair this with the Convert Currency API.What are some use cases for the Exchange Rate API?
Use it to display live FX quotes, build pricing or checkout flows in multiple currencies, or backtest strategies using the daily history from the/v1/exchangeratehistoricalendpoint. For related financial analysis you may also find the Currency Volatility and Interest Rate APIs useful.What are some use cases for the Currency Volatility API?
It is built for FX risk and trading analytics: sizing positions and setting stops by realized volatility, gauging whether current volatility is high or low via theconeandhv_rank, and producing forward-looking risk estimates with EWMA or GARCH(1,1) forecasts. It pairs naturally with the Exchange Rate API for live rates and the Convert Currency API for conversions.What currency pairs are supported and how is the volatility calculated?
Volatility is available for over 150 fiat currency pairs (the same set as the Convert Currency API, excludingZWG,BTC, andXAG), specified with thepairparameter incurrency1_currency2form such asEUR_USD. It is computed as the sample standard deviation of daily logarithmic returns from closing rates, annualized by the square root of 252 trading days; see the full API docs for details.What is the difference between the three endpoints?
/v1/currencyvolatilityreturns the latest realized (or EWMA) volatility over awindowplus a volatilityconeand percentile context;/v1/currencyvolatilityhistoricalreturns a dailyseriesof trailing rolling volatility over adaysrange (max 1825); and/v1/currencyvolatilityforecastreturns forward-looking EWMA orgarch_11estimates across thehorizondays you request. All three are premium endpoints, listed on the pricing page.How do I get a volatility forecast, and what does the response include?
Call/v1/currencyvolatilityforecastwith apairand choosemethod=garch_11(default, with mean reversion) ormethod=ewma; the response includescurrent_conditional_vol_annualized, aforecastarray (each withhorizon_days,vol_annualized,vol_daily), fittedparameters, and afallbackflag set totruewhen a GARCH fit fails to converge and EWMA is returned instead. These are model-based estimates rather than predictions; unsuccessful requests return an error.Is this realized (historical) volatility or implied volatility?
It is realized volatility, also called historical volatility (HV): it is measured from actual past exchange-rate movements, not implied volatility derived from options prices. The/v1/currencyvolatilityendpoint returns anhv_rankand percentile showing whether current FX volatility is high or low versus its trailing-year range, and the forecast endpoint adds forward-looking EWMA and GARCH(1,1) estimates.