Search code examples
currencyforexcurrency-exchange-rates

How can I get foreign exchange rates thru an API?


I need an API that provides latest currency exchange rates for my money transfer website


Solution

  • Try by using CurrencyFreaks API. Its key features are:

    • Reliable data as they source their data from various trusted Forex exchanges and
      Banks.

    • You can get updates every 60 sec.

    • You can change the ‘Base’ currency.

    • It provides currency exchange rates for 179 currencies worldwide including currencies, metals, and cryptocurrencies.

    • Supported codes for the endpoints are Shell, Node.js, Java, Python,
      PHP, Ruby, JS, C#, Go, C, Swift.

    Here is the latest exchange rates endpoint:

    $ curl 'https://api.currencyfreaks.com/latest?apikey=YOUR_APIKEY'
    

    The JSON response will be as follows:

    {
        "date": "2020-07-02 10:39:00+00",
        "base": "USD",
        "rates": {
            "FJD": 2.1692,
            "MXN": 22.602,
            "STD": 22000.6197,
            "SCR": 17.6,
            "LVL": 0.6563,
            "CDF": 1907.87,
            "BBD": 2.0,
            "GTQ": 7.7,
            "CLP": 808.6,
            "UGX": 3721.0,
            "HNL": 24.7553,
            "ZAR": 16.9326,
            "TND": 2.8445,
            "CUC": 1.0,
            "SLL": 9778.35,
            "BSD": 1.0,
          [...]
        } }
    

    You can also get live currency exchange rates from here: https://currencyfreaks.com/exchange-rates

    Hope it will help you.