Currency API is a service for querying the currency exchange rates between many common currencies (38 including Bitcoin).

The API URL

https://apilayer.net/api/convert?from={from}&to={to}&amount={amount}
Variable Explanation
{from} Code of currency to convert from - e.g. USD
{to} Code of currency to convert to - e.g. EUR
{amount} the amount to be converted - e.g. 10

The Server Response

Property Type Explanation
success Boolean Whether the request was successful
from String(3) The currency (3-letter code) to be converted from
to String(3) The currency (3-letter code) to be converted to
amount Decimal The amount to be converted
timestamp timestamp The exact time the rates used for the conversion were collected
quote Decimal The exchange rate used for the conversion

Code Examples

// NOTE: Sample code uses jQuery to handle jsonp
	
    var access_key = 'YOUR_ACCESS_KEY';
    var from = 'USD';
    var to = 'EUR';
    var amount = '1';

$.ajax({

	url: 'https://apilayer.net/api/convert?access_key='+access_key+'&from='+from+'&to='+to+'&amount='+amount,
	dataType: "jsonp",
	success: function(response) {

		if (response.success) {

			alert('1 USD is worth ' + parseFloat(response.rate).toFixed(2) + ' EUR');
		}
	}
});
					
$access_key = 'YOUR_ACCESS_KEY';
$from = 'USD';
$to = 'EUR';
$amount = 1;
                    
$url = 'https://apilayer.net/api/convert?access_key='.$access_key.'&from='.$from.'&to='.$to.'&amount='.$amount;

$result = file_get_contents($url);
$result = json_decode($result);

if ($result->success) {

	echo "1 USD is ".$from." $result->rate ".$to;
}
					
import urllib
import json

url = "https://apilayer.net/api/convert?access_key=YOUR_ACCESS_KEY&from=USD&to=EUR&amount=1"

url = urllib.urlopen(url)

result = url.read()

url.close()

result = json.loads(result)

if result.success:
	print "1 USD is worth %.2f EUR" % (result.result)
					
Get Your Free API Access Key