Documentation for the Premium Version

** For the free version, you don't need to specify an API Key and you have to use the url free.currencyconverterapi.com/api/ ..

** Current API version: v6

Ultra compact, multiple queries.

https://api.currencyconverterapi.com/api/v6/convert?q=USD_PHP,PHP_USD&compact=ultra&apiKey=[YOUR_API_KEY]

Sample output:

{
  "USD_PHP": 46.211,
  "PHP_USD": 0.02163987
}

JSONP Support

https://api.currencyconverterapi.com/api/v6/convert?q=USD_PHP,PHP_USD&compact=ultra&callback=sampleCallback&apiKey=[YOUR_API_KEY]

List of currencies

https://api.currencyconverterapi.com/api/v6/currencies?apiKey=[YOUR_API_KEY]

List of countries

https://api.currencyconverterapi.com/api/v6/countries?apiKey=[YOUR_API_KEY]

Historical Data (Experimental, Single Date)

https://api.currencyconverterapi.com/api/v6/convert?q=USD_PHP,PHP_USD&compact=ultra&date=[yyyy-mm-dd]&apiKey=[YOUR_API_KEY]

Historical Data (Experimental, Date Range)

Maximum of 365 days

https://api.currencyconverterapi.com/api/v6/convert?q=USD_PHP,PHP_USD&compact=ultra&date=[yyyy-mm-dd]&endDate=[yyyy-mm-dd]&apiKey=[YOUR_API_KEY]

Usage

Returns your current API usage

https://api.currencyconverterapi.com/others/usage?apiKey=[YOUR_API_KEY]

Sample Codes

PHP

<?php
function convertCurrency($amount,$from_currency,$to_currency){
  $apikey = 'your-api-key-here';

  $from_Currency = urlencode($from_currency);
  $to_Currency = urlencode($to_currency);
  $query =  "{$from_Currency}_{$to_Currency}";

  $json = file_get_contents("https://api.currencyconverterapi.com/api/v6/convert?q={$query}&compact=ultra&apiKey={$apikey}");
  $obj = json_decode($json, true);

  $val = floatval($obj["$query"]);


  $total = $val * $amount;
  return number_format($total, 2, '.', '');
}

//uncomment to test
//echo convertCurrency(10, 'USD', 'PHP');
?>

Node JS / Javascript

var https = require('https');

function convertCurrency(amount, fromCurrency, toCurrency, cb) {
  var apiKey = 'your-api-key-here';

  fromCurrency = encodeURIComponent(fromCurrency);
  toCurrency = encodeURIComponent(toCurrency);
  var query = fromCurrency + '_' + toCurrency;

  var url = 'https://api.currencyconverterapi.com/api/v6/convert?q='
            + query + '&compact=ultra&apiKey=' + apiKey;

  https.get(url, function(res){
      var body = '';

      res.on('data', function(chunk){
          body += chunk;
      });

      res.on('end', function(){
          try {
            var jsonObj = JSON.parse(body);

            var val = jsonObj[query];
            if (val) {
              var total = val * amount;
              cb(null, Math.round(total * 100) / 100);
            } else {
              var err = new Error("Value not found for " + query);
              console.log(err);
              cb(err);
            }
          } catch(e) {
            console.log("Parse error: ", e);
            cb(e);
          }
      });
  }).on('error', function(e){
        console.log("Got an error: ", e);
        cb(e);
  });
}

//uncomment to test
/*
convertCurrency(10, 'USD', 'PHP', function(err, amount) {
  console.log(amount);
});
*/

Please note that the services here are provided as is and without warranty (See Terms of Service). You only pay for the cost of the server. But I will try to help to the best of my ability if you need any support.

If you have inquiries, please feel free to contact me.