https://api.forexrateapi.com/v1/latest?api_key=[API_KEY]
ForexRateAPI provides a simple to use JSON-based REST API for live and historical foreign exchange (forex) rates in 150+ world currencies. We provide affordable pricing, which makes our API perfect for businesses of any size including startups, online businesses, to large companies in need of live and/or historical financial data.
Our API can be deployed to power financial departments, mobile applications, and back-office systems around the world just to name a few use cases.
Definition | Description |
---|---|
API Key | Uniquely assigned key to each API account to authenticate interactions with the API. |
Symbol | Three-letter currency code of a given currency. |
Base Currency | The currency to which exchange rates are relative to. |
Quote Currency | The currency an amount is converted to. |
Live exchange rate data is delayed based on your subscription plan.
Subscription Plan | Delay |
---|---|
Free | Daily |
Essential | 30 minutes |
Basic | 10 minutes |
Basic Plus | 5 minutes |
Professional | 60 seconds |
Business | 30 seconds |
The ForexRateAPI uses API keys to authenticate requests. You can view and manage your API key in the dashboard.
Please ensure to keep your API Key private as each request made with your API Key counts towards your account's plan limit.
To make an successful request, you must pass in your API Key into every request
We provide two ways to pass in your API Key for every request. Method one is to append your API Key to the request url. Method two is to pass in the API Key via the request header.
Query Parameter:https://api.forexrateapi.com/v1/latest?api_key=API_KEY
Request Headers:
curl https://api.forexrateapi.com/v1/latest \
-H 'X-API-KEY: YOUR_API_KEY' \
-H 'Content-Type: application/json'
Monitor your API usage through response headers included with each API request. These headers provide real-time information about your quota consumption and limits.
Response Headers
Key | Description |
---|---|
X-API-CURRENT |
Number of requests consumed for the month. |
X-API-QUOTA |
API quota limit for the month based on your account plan. |
We offer 6 customizable endpoints, all which provides you access to different kinds of data. Below you will find a short summary of all available endpoints. Detailed explaination of any of the endpoints below will be provided in API Features.
// "symbols" - get list of all supported currencies
https://api.forexrateapi.com/v1/symbols
// "latest" - get real-time exchange rate data for all available/specific currencies
https://api.forexrateapi.com/v1/latest
// "historical" - get historical rates for a specific day
https://api.forexrateapi.com/v1/YYYY-MM-DD
// "convert" - convert one currency to another based on real-time or historic exchange rate data
https://api.forexrateapi.com/v1/convert?from=USD&to=EUR&amount=100
// "timeframe" - request exchange rates for a specific period of time
https://api.forexrateapi.com/v1/timeframe?start_date=2021-01-01&end_date=2021-05-01
// "change" - request any currency change parameters (margin, percentage)
https://api.forexrateapi.com/v1/change?base=EUR&start_date=2021-01-01&end_date=2021-05-01
If your query fails, the API will return a 3-digit error-code and a plain text "info" property.
Example Error
{
"success": false,
"error": {
"code": 104,
"info": "Your monthly usage limit has been reached. Please upgrade your subscription plan."
}
}
Common API Errors
Error Code | Description |
---|---|
404 |
User requested a non-existent API function |
101 |
User did not supply an API Key |
102 |
User did not supply an access key or supplied an invalid access key |
103 |
The user's account is not active. User will be prompted to get in touch with Customer Support |
104 |
Too Many Requests |
105 |
User has reached or exceeded his subscription plan's monthly API request allowance |
201 |
User entered an invalid Base Currency [ latest , historical , timeframe , change ] |
202 |
User entered an invalid from Currency [ convert ] |
203 |
User entered invalid to currency [ convert ] |
204 |
User entered invalid amount [ convert ] |
205 |
User entered invalid date [ historical , convert , timeframe , change ] |
206 |
Invalid timeframe [ timeframe , change ] |
207 |
Timeframe exceeded 365 days [ timeframe ] |
300 |
The user's query did not return any results [ latest , historical , convert , timeframe , change ] |
ForexRateAPI supports Access-Control (CORS) headers. This means you will be able to use our API via Cross-Origin HTTPS Requests. Learn more.
ForexRateAPI Postman API Project | See more |
---|
This endpoint is used to get the list of the most up-to-date supported symbols. Learn more here.
Example API Request
https://api.forexrateapi.com/v1/symbols
?api_key=[API_KEY]
Request Parameters
Parameter | Description |
---|---|
api_key |
[Required] Your API Key. More details. |
Example API Response
{
"success": true,
"symbols": {
"AED": "UAE Dirham",
"AFN": "Afghan Afghani",
"ALL": "Albanian Lek",
...
}
}
Response Attributes
Attribute | Description |
---|---|
success |
Returns true or false depending if the API Request succeeded. If false, refer to API Errors. |
symbols |
Key is supported currency, value is description of currency. |
This endpoint will return real-time exchange rate data (delayed) depending on your subscription plan.
Example API Request
https://api.forexrateapi.com/v1/latest
?api_key=[API_KEY]
&base=USD
¤cies=EUR,JPY,INR
Request Parameters
Parameter | Description |
---|---|
api_key |
[Required] Your API Key. More details. |
base |
[optional] Specify a base currency. Base Currency will default to USD if this parameter is not defined. |
currencies |
[optional] Specify a comma-separated list of currency codes to limit API responses to specified currencies. If this parameter is not defined, the API will return all supported currencies. |
Example API Response
{
"success": true,
"base": "USD",
"timestamp": 1672259320,
"rates": {
"EUR": 0.94215187,
"INR": 82.86,
"JPY": 134.413
}
}
In the example API response, that means:
1 USD (Base) = 0.94215187 EUR (Quote)
1 USD (Base) = 82.86 INR (Quote)
1 USD (Base) = 134.413 JPY (Quote)
You can also express the reciprocal:
1/0.94215187 EUR = 1.06 USD (Base) <=> €1 = $1.06
1/82.86 INR = 0.012 USD (Base) <=> ₹1 = $0.012
1/134.413 JPY = 0.007 USD (Base) <=> ¥1 = $0.007
Response Attributes
Attribute | Description |
---|---|
success |
Returns true or false depending if the API Request succeeded. If false, refer to API Errors. |
base |
Returns base currency used for the request. |
timestamp |
Returns the UNIX timestamp the given exchange rates were collected. |
rates |
Returns exchange rate data for the currencies requested. |
This endpoint will return historical exchange rate data. The previous day's historical rates become available each day at 00:05 AM GMT. Use format YYYY-MM-DD
or yesterday
for the base url.
[Year-Month-Day]
Example API Request
https://api.forexrateapi.com/v1/2021-03-24
?api_key=[API_KEY]
&base=USD
¤cies=EUR,JPY,INR
https://api.forexrateapi.com/v1/yesterday
?api_key=[API_KEY]
&base=USD
¤cies=EUR,JPY,INR
Request Parameters
Parameter | Description |
---|---|
api_key |
[Required] Your API Key. More details. |
base |
[optional] Specify a base currency. Base Currency will default to USD if this parameter is not defined. |
currencies |
[optional] Specify a comma-separated list of currency codes to limit API responses to specified currencies. If this parameter is not defined, the API will return all supported currencies. |
Example API Response
{
"success": true,
"base": "USD",
"timestamp": 1616543999,
"rates": {
"EUR": 0.84654595,
"INR": 72.62723433,
"JPY": 108.78333233
}
}
In the example API response, that means:
1 USD (Base) = 0.84654595 EUR (Quote)
1 USD (Base) = 72.62723433 INR (Quote)
1 USD (Base) = 108.78333233 JPY (Quote)
You can also express the reciprocal:
1/0.84654595 EUR = 1.18 USD (Base) <=> €1 = $1.18
1/72.62723433 INR = 0.0137 USD (Base) <=> ₹1 = $0.0137
1/108.78333233 JPY = 0.009 USD (Base) <=> ¥1 = $0.009
Response Attributes
Attribute | Description |
---|---|
success |
Returns true or false depending if the API Request succeeded. If false, refer to API Errors. |
base |
Returns base currency used for the request. |
timestamp |
Returns the UNIX timestamp the given exchange rates were collected. |
rates |
Returns exchange rate data for the currencies requested. |
This endpoint is used to convert any amount from one currency to another.
Example API Request
https://api.forexrateapi.com/v1/convert
?api_key=[API_KEY]
&from=USD
&to=EUR
&amount=100
&date=2021-04-23
Request Parameters
Parameter | Description |
---|---|
api_key |
[Required] Your API Key. More details. |
from |
[optional] Specify currency you would like to convert from. Base Currency will default to USD if this parameter is not defined. |
to |
[Required] Specify currency you would like to convert to. |
amount |
[Required] The amount to convert. |
date |
[optional] Specify date to use historical midpoint value for conversion. Otherwise, it will use live exchange rate date with delay specified based on your subscription plan. |
Example API Response
{
"success": true,
"query": {
"from": "USD",
"to": "EUR",
"amount": 100
},
"info": {
"quote": 0.82657397,
"timestamp": 1619135999
},
"result": 82.65739676
}
Response Attributes
Attribute | Description |
---|---|
success |
Returns true or false depending if the API Request succeeded. If false, refer to API Errors. |
query -> from |
Returns currency converted from used for the request. |
query -> to |
Returns currency converted to used for the request. |
query -> amount |
Returns amount to convert. |
info -> quote |
Returns the exchange rate used for the conversion. |
info -> timestamp |
Returns the UNIX timestamp the given exchange rates were collected. |
result |
Returns conversion result. |
This endpoint is used to get historical rates for a specified time period (max range: 365 days).
Example API Request
https://api.forexrateapi.com/v1/timeframe
?api_key=[API_KEY]
&start_date=2021-04-22
&end_date=2021-04-23
&base=USD
¤cies=EUR,JPY,INR
Request Parameters
Parameter | Description |
---|---|
api_key |
[Required] Your API Key. More details. |
start_date |
[Required] Specify the start date of your timeframe. |
end_date |
[Required] Specify the end date of your timeframe. |
base |
[optional] Specify a base currency. Base Currency will default to USD if this parameter is not defined. |
currencies |
[optional] Specify a comma-separated list of currency codes to limit API responses to specified currencies. If this parameter is not defined, the API will return all supported currencies. |
Example API Response
{
"success": true,
"base": "USD",
"start_date": "2021-04-22",
"end_date": "2021-04-23",
"rates": {
"2021-04-22": {
"EUR": 0.83233837,
"INR": 75.09793267,
"JPY": 107.97997033
},
"2021-04-23": {
"EUR": 0.82657397,
"INR": 75.00244667,
"JPY": 107.88867591
},
}
Response Attributes
Attribute | Description |
---|---|
success |
Returns true or false depending if the API Request succeeded. If false, refer to API Errors. |
base |
Returns base currency used for the request. |
start_date |
Returns start date of your timeframe for the request. |
end_date |
Returns end date of your timeframe for the request. |
rates |
Returns exchange rate data for the currencies requested. |
This endpoint is used to request the change (percentage) of one of more currencies, relative to a base
currency with a specific time-frame (optional).
The API will return change
values of the specified start_date
and end_date
.
Example API Request
https://api.forexrateapi.com/v1/change
?api_key=[API_KEY]
&start_date=2021-04-22
&end_date=2021-04-23
&base=USD
¤cies=EUR
Request Parameters
Parameter | Description |
---|---|
api_key |
[Required] Your API Key. More details. |
start_date |
[Required] Specify the start date of your timeframe. |
end_date |
[Required] Specify the end date of your timeframe. |
base |
[optional] Specify a base currency. Base Currency will default to USD if this parameter is not defined. |
currencies |
[optional] Specify a comma-separated list of currency codes to limit API responses to specified currencies. If this parameter is not defined, the API will return all supported currencies. |
date_type |
[optional] Specify "yesterday", "week", "month", or "year" to retrieve the rate change for the corresponding time period. If provided, this parameter overrides "start_date" and "end_date". |
Example API Response
{
"success": true,
"base": "USD",
"start_date": "2021-04-20",
"end_date": "2021-04-21",
"rates": {
"EUR": {
"start_rate": 0.83233837,
"end_rate": 0.82657397,
"change": -0.0057644,
"change_pct": -0.6926
}
}
Response Attributes
Attribute | Description |
---|---|
success |
Returns true or false depending if the API Request succeeded. If false, refer to API Errors. |
base |
Returns base currency used for the request. |
start_date |
Returns start date of your timeframe for the request. |
end_date |
Returns end date of your timeframe for the request. |
rates -> start_rate |
Returns exchange rate for the start date. |
rates -> end_rate |
Returns exchange rate for the end date. |
rates -> change |
Returns change (decimal number) of the given currency rate between the start and end date. |
rates -> change_pct |
Returns percent change of the given currency rate between your start and end date. Formula used is ((end_rate - start_rate) / start_rate) * 100 |