Dev CenterΞ

FXR-API: Foreign Exchange Rates API

Twitter · Facebook
A reliable platform to receive live (near real-time) and historical exchange rates for 160+ world currencies. Having been integrated into many diverse software applications running in varied environments, FXR-API has proven to be robust with high-delivery availability.Free foreign exchange rates and currency conversion API

The Foreign eXchange Rates API (FXR-API) is a free web-based foreign exchange rates API that provides accurate high precision exchange rates for 160+ currencies across the world. Rates are gathered from multiple reliable international financial centers and subsequently normalized to ensure a true reflection of global market rates. Historical mid-market end-of-day rates are available since January 1, 2000 where applicable.

FXR-API has seen successful integration into many diverse applications such as web-based multi-currency e-commerce platforms to display product prices in any preferred currency, desktop-based accounting software to make currency conversions fully automatic and less error prone, personal finance mobile apps to track exchange rates, and (soon) even embedded devices! Use of FXR-API is completely free, without any signup requirements. See the full list of supported currencies.

Below are the various API resources that are currently available:

GET /{currency}

This API resource returns a currency object representing basic currency information and latest foreign exchange rates for {currency} against a selected list of currencies, namely, USD, EUR, GBP, JPY, and CHF. If the exchange rate of the specified currency against one of the selected currencies is less than 1.0, the pairing is reversed with the specified currency becoming the counter currency instead. You may, however, disable this behavior by appending the query string parameter fixed to the request. If the specified currency is not found, an HTTP 404 status response is triggered.

Example request:

https://dev.kwayisi.org/apis/forex/ghs

Example response:

{
   "code": "GHS",
   "name": "Ghana Cedi",
   "rates": [
       {
           "date": "2017-04-05",
           "pair": "USD/GHS",
           "rate": 4.25
       },
       {
           "date": "2017-04-05",
           "pair": "EUR/GHS",
           "rate": 4.5339
       },
       {
           "date": "2017-04-05",
           "pair": "GBP/GHS",
           "rate": 5.3027
       },
       {
           "date": "2017-04-05",
           "pair": "GHS/JPY",
           "rate": 26.0929
       },
       {
           "date": "2017-04-05",
           "pair": "CHF/GHS",
           "rate": 4.2389
       }
   ]
}

GET /{base-currency}/{counter-currency}

This API resource returns a quotation object representing the relative active (live) value of {base-currency} against {counter-currency} on the foreign exchange market. Unlike GET /{currency}, the specified base currency is unconditionally made the fixed currency of the currency pair. If either of the specified currencies is not found, an HTTP 404 status response is triggered.

Example request:

https://dev.kwayisi.org/apis/forex/usd/ghs

Example response:

{
   "date": "2016-01-19",
   "pair": "USD/GHS",
   "rate": 3.8723
}

GET /{base-currency}/{counter-currency}/{date}

This API resource returns a quotation object representing the relative historical value of {base-currency} against {counter-currency} on the date {date} on the foreign exchange market. The date should be in the ISO 8601 format YYYY-MM-DD. If either of the specified currencies is not found, or no currency data exists for the specified date, an HTTP 404 status response is triggered.

Example request:

https://dev.kwayisi.org/apis/forex/usd/ghs/2016-01-01

Example response:

{
   "date": "2016-01-01",
   "pair": "USD/GHS",
   "rate": 3.8092
}

Currency object

PropertyTypeNullable?Description
codestringNoCurrency code (ISO 4217).
namestringNoOfficial name of currency.
ratesarrayNoArray of quotation instances.

Quotation object

PropertyTypeNullable?Description
datestringNoDate of rate (ISO 8601).
pairstringNoCurrency pair separated by slash (/).
ratefloatNoExchange rate for the pair.

Comments (6)

  1. BiikBiik
    Mar 30, 2016 08:51 GMT

    Hi Michael,
    Thanks for hosting these great public APIs!
    I've been able to request stock data through your GSE-API. Marvelous!

    Now I would love to also request forex data through your FXR-API, but Chrome is giving me this error message: 'XMLHttpRequest cannot load 'https://dev.kwayisi.org/apis/forex/ghs'. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:49458' is therefore not allowed access.'

    I'm a programming rookie, would be very thankful for your advice here.

    My jQuery is as follows:
    $(document).ready(function() {
         $.getJSON("https://dev.kwayisi.org/apis/forex/ghs", function(data) {
              console.log(data);
         });
    });

    1. Michael KwayisiMichael Kwayisi
      Mar 30, 2016 10:31 GMT

      Your web browser is preventing you from requesting resources not hosted on the same server as the one executing your JavaScript code. The solution to this is to append "?callback=?" to the URL so that it reads as such: "https://dev.kwayisi.org/apis/forex/ghs?callback=?". Yet another hack (called JSONP) in the JS world, I guess :)

  2. OgaOga
    Mar 1, 2017 20:28 GMT

    HI Mike

    Impressive stuff with your GSE and forex api's.
    Did a random google search on APIs in Ghana and i ended up here.
    Planning on building an iOS app with them as a side project.

    Quick question, whats the source of your forex data ?

    1. Michael KwayisiMichael Kwayisi
      Mar 1, 2017 20:54 GMT

      They are actually gathered from several sources with precedence given to particular ones, most remarkable among them XE.com.

  3. MaxwellMaxwell
    Apr 12, 2017 09:59 GMT

    Nice work. Have you been able to add any new countries yet?

    1. Michael KwayisiMichael Kwayisi
      Apr 14, 2017 00:03 GMT

      Actually, yes - but not live yet :) And not just a few currencies but ALL the active currencies in the world with ISO-assigned codes (157 in total). I'm currently reworking the backend to accommodate the new changes, verifying the data feed sources for improved accuracy, and expanding the historical exchange rates to at least 10 years back where applicable. They'll be live as soon as I'm done. Thanks!

NOTE: You are replying to 's comment. [Cancel]