Dev Center

FXR-API: Foreign Exchange Rates API

Twitter · Facebook
Free foreign exchange rates and currency conversion APIFree 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)
namestringNoName of currency (in English)
ratesarrayNoArray of quotation instances

Quotation object

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

Comments

  1. Robert YinRobert Yin
    Feb 4, 2020 15:16 GMT

    hi Kwayisi,

    Great job and really happy to find this awesome stock api,search alot for this in my upcoming project and i think nothing makes me happy than this,works perfect....

    thankx Boss

  2. ArxhieArxhie
    Apr 23, 2018 18:08 GMT

    Hi, Great site you have here. It's really saved me however i have a little request. Is there a way i can request for a set of currency such that i just make ine request and not X requests for X set of currencies I want to retrieve

    1. Michael KwayisiMichael Kwayisi
      Apr 23, 2018 22:54 GMT

      Unfortunately no. I thought it better to make requests as atomic as possible to ensure consistent expected correctness. Imagine what would happen if multiple currency pairs are specified and some of them are invalid in some way; the API should then communicate back to the client which pairs are such. That's how you end up with API responses with “error” properties in the body as opposed to the HTTP status line. This, in my opinion, is terrible design that undermines the very fabric of the HTTP architecture: the status line (code + reason) is supposed to tell you the outcome of the request; and if it's not what you expected, you don't have to read the body. Hence, advertising a “200 OK” status response but then saying in the body that the request was not fulfilled is just plain wrong (and even somewhat disconcerting). So that's basically the philosophy behind the current design: allowing batch requests would be helpful, but technically incorrect.

  3. AminAmin
    Mar 30, 2018 04:47 GMT

    Hello, thanks for this great api, but I was wondering when do you plan to expose the support for other currencies?

    1. Michael KwayisiMichael Kwayisi
      Mar 30, 2018 09:57 GMT

      I'm not sure but if you're referring to my earlier comment about increasing the number of currencies, then that feature has gone live since July last year. You can see the full list of supported currencies here: dev.kwayisi.org/apis/forex/list.txt

  4. atsuatsu
    Mar 25, 2018 09:44 GMT

    Charley, thanks so much for this API. Everywhere else, I have to pay large sums to access this info. I will be making a request every 20 minutes. is that okay with you?

    1. Michael KwayisiMichael Kwayisi
      Mar 25, 2018 21:12 GMT

      Yes, 20-minute intervals is fine. Good luck with your project!

  5. BootLoaderBootLoader
    Feb 6, 2018 06:20 GMT

    Great website you have here. Its a life saver. my problem is whether your website will be available ( live ) always as I would like to include the api in my app. The exchange api is really needed and therefore any downtime of the site can cause huge financial lose

    1. Michael KwayisiMichael Kwayisi
      Feb 6, 2018 10:16 GMT

      This website hasn't gone down in 14+ months except during planned maintenance periods which never lasted for more than a couple of minutes. However, you should not rely on the uptime of this API for your app to function properly, i.e., don't consume the API directly from your app. Instead, set up an intermediary server that caches data from this API, and let your app talk to that server. Finally, if your app is mission critical and cannot afford any downtime, then I recommend you buy from a market data provider that can offer you such warranty.

  6. 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!

  7. 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.

  8. 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 :)

  • Showing 1 - 8 of 8
NOTE: You are replying to 's comment. [Cancel]