Exchange Rate API - Historical & Live Forex Rates

Access historical exchange rates and live forex rates with our Exchange Rate API. The Live Forex Rates API provides real-time forex rates for all world currencies, cryptocurrencies, and precious metals, with USD as the base currency. The Historical Exchange Rate API offers historical exchange rates for specific dates, ensuring you have the data you need for accurate financial analysis and decision-making.

With live exchange rates, you have the choice to get currency data with update frequencies of 1day, 1hour, 10 minutes and 1 minute. You can retrieve exchange rates of all currencies or currencies of your choice in a single request by specifying the currency codes. This saves you from additional overhead and allows you to receive targeted exchange rates data, real-time or historical. You can perform calculations using any base currency along with USD as default.

10K Free Credits, No Credit Card Required

Features

Live Forex Rates

Get real-time forex rates for a wide range of currencies. Whether you're making quick decisions or tracking market movements, our API ensures you have the latest data.

Historical Exchange Rates

Access historical exchange rates for any date, allowing you to analyze trends and make informed decisions. Perfect for financial analysis, forecasting, and historical comparisons.

Customizable Base Currency

Tailor your exchange rate calculations by changing the base currency. Convert between different currencies seamlessly, giving you the flexibility to work with the currency of your choice.

Filtered Currency Rates

Retrieve exchange rates only for the currencies you need. Our api allows you to get targeted data, reducing unnecessary information so you can focus on what matters most to you.

Documentation

API Endpoint

Latest Currencies Exchange Rates

GET

https://api.apifreaks.com/v1.0/currency/rates/latest

Test
LANGUAGE
Python
PHP
Java
Node
Ruby

Historical Currencies Exchange Rates

GET

https://api.apifreaks.com/v1.0/currency/rates/historical

Test
LANGUAGE
Python
PHP
Java
Node
Ruby

API Request

ParameterRequiredTypeDefaultDescription
baseNoStringUSDBase currency
symbolsNoArray-Comma separated list of desired currencies/ commodities symbols

For latest rates converter endpoint, you must also pass the updates parameter to get the exchange rate data that updates at the specified rate in our database.

ParameterRequiredTypeDefaultDescription
updatesYesString-exchange rates update period. Possible values are: (1) 1d - daily update (2) 1h - hourly update (3) 10m - 10 minute update (4) 1m - 1 minute update

For historical Currencies Exchange Rates endpoint, you must provide the date parameter to get the exchange rate for that date.

ParameterRequiredTypeDefaultDescription
dateYesString-specific date (format YYYY-MM-DD) of which exchange rates required.

API Response

FieldTypeRequirementDescription
dateStringMandatory
For the latest currencies exchange rates endpoint, it is the date and time with timezone included in it (UTC). It represents the exact time at which these rates were recorded in our database. For historical currencies exchange rates endpoint, it is the specific date (format YYYY-MM-DD) of which exchange rates are required.
baseStringMandatory
It is the base currency with respect to which all rates will be calculated. It can be provided via input parameter.
ratesMapMandatory
A map of all rates of currencies w.r.t base currency.

HTTP Error Codes

Latest Currencies Exchange Rates

HTTP StatusReasons
404
Rates of provided currency [CURRENCY_CODE] are not available in our database!
404
Rates of provided symbols are not available in our database!

Historical Currencies Exchange Rates

HTTP StatusReasons
400
Provided Date [DATE] is in invalid format. It should be like YYYY-MM-DD!
404
Rates of provided currency [CURRENCY_CODE] are not available in our database!
404
Rates of provided symbols are not available in our database!
404
Rates of provided date [DATE] are not available in our database.
404
Rates of provided currency [CURRENCYCODE] are available from [AVAILABLEFROMDATE] to [AVAILABLEUNTIL_DATE] in our database!

How-To-Guides

Live Forex Rates

To get the latest exchange rates, call the endpoint with the api key. The response will be exchange rates of all the currencies.

$ curl 'https://api.apifreaks.com/v1.0/currency/rates/latest?apikey=API-KEY&updates=1h'
# Response { "date": "2023-03-21 12:43:00+00", "base": "USD", "rates": { "AGLD": "2.3263929277654998", "FJD": "2.21592", "MXN": "18.670707655673546", "LVL": "0.651918", "SCR": "13.21713243157135", "CDF": "2068.490771", "BBD": "2.0", "HNL": "24.57644632001569", . . . } }

Live Forex Rates by Specifying Update Period

For latest currency rates endpoint, pass the updates query parameter to get the exchange rates that are updated after a specific period. The possible values are 1d, 1h, 10m, and 1m, which will return exchange rates updated every 1 day, 1 hour, 10 minutes and 1 minute in our database.

# Get exchange rates that get updated every 10 minutes.
$ curl 'https://api.apifreaks.com/v1.0/currency/rates/latest?apikey=API-KEY&updates=10m'

Live Forex Rates of Desired Currencies

Pass the symbols query parameter that is comma separated list of currency codes whose exchange rates are required. The response will be the exchange rates of the desired currencies.

$ curl 'https://api.apifreaks.com/v1.0/currency/rates/latest?apikey=API-KEY&symbols=PKR,GBP,EUR,USD&updates=10m'
# Response { "date": "2023-03-21 13:26:00+00", "base": "USD", "rates": { "EUR": "0.9278605451274349", "GBP": "0.8172754173817152", "PKR": "281.6212943333344", "USD": "1.0" } }

Change Base Currency

Pass the base query parameter to change the base currency for the exchange rates calculation.

$ curl 'https://api.apifreaks.com/v1.0/currency/rates/latest?apikey=API-KEY&symbols=PKR,GBP,EUR,INR&base=EUR&updates=1h
# Response { "date": "2023-03-21 13:29:00+00", "base": "EUR", "rates": { "EUR": "1.0", "GBP": "0.8810222794437683", "PKR": "303.60317616075287", "USD": "1.0780547579946744" } }

Historical Exchange Rate

Use the historical exchange rates endpoint https://api.apifreaks.com/v1.0/currency/rates/historical and pass the date query parameter in the format 'YYYY-MM-DD' to get the exchange rates for any date.

$ curl 'https://api.apifreaks.com/v1.0/currency/rates/historical?apikey=API-KEY&date=2024-03-20'
# Response { "date": "2024-03-20", "base": "USD", "rates": { "FJD": "2.1176", "MATIC": "0.6832001093120175", "MXN": "20.385892", "STD": "21382.190504", "SCR": "14.408136", "CDF": "2005.74861", "BBD": "2.0", "HNL": "24.411536", "UGX": "3583.338449", "ZAR": "14.9602", "STN": "22.425165", . . . } }

Pricing

To use the Currency Rates APIs, API credits are required. Charges are applied only for successful queries, indicated by a 2xx status code. If a request results in a 4xx or 5xx status code, no credits will be deducted, and any credits already charged will be promptly refunded.

ServiceCredits
Daily Rates Updates1 credit
Hourly Rates Updates 2 credits
10-Minute Rates Updates3 credits
1-Minute Rates Updates4 credits
Historical Currency Rates 2 credits
Non-USD Base Currency1 additional credit

Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, ensuring you stay informed about your remaining balance and can optimize your resource allocation effectively.

Price Estimation Calculator