Get the latest exchange rates available from the Open Exchange Rates API.

The most simple route in our API, latest.json provides a standard response object containing all the conversion rates for all of the currently available symbols/currencies, labeled by their international-standard 3-letter ISO currency codes.

The latest rates will always be the most up-to-date data available on your plan.

The base property provides the 3-letter currency code to which all the delivered exchange rates are relative. This base currency is also given in the rates object by default (e.g. "USD": 1).

The rates property is an object (hash/dictionary/associative array) containing all the conversion or exchange rates for all of the available (or requested) currencies, labeled by their international-standard 3-letter currency codes. All the values are relative to 1 unit of the requested base currency.

The timestamp property indicates the time (UNIX) that the rates were published. (If you’re using the timestamp value in JavaScript, remember to multiply it by 1000, because JavaScript uses time in milliseconds instead of seconds.)

📘

Additional Parameters

Choosing specific symbols and fetching extra rates with show_alternative are available for all plans, including free. Changing the base currency is available for all clients of paid plans.

Basic Code Samples

$.get('https://openexchangerates.org/api/latest.json', {app_id: 'YOUR_APP_ID'}, function(data) {
    console.log("1 US Dollar equals " + data.rates.GBP + " British Pounds");
});
<?php
$app_id = 'YOUR_APP_ID';
$oxr_url = "https://openexchangerates.org/api/latest.json?app_id=" . $app_id;

// Open CURL session:
$ch = curl_init($oxr_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Get the data:
$json = curl_exec($ch);
curl_close($ch);

// Decode JSON response:
$oxr_latest = json_decode($json);

// You can now access the rates inside the parsed object, like so:
printf(
    "1 %s equals %s GBP at %s",
    $oxr_latest->base,
    $oxr_latest->rates->GBP,
    date('H:i jS F, Y', $oxr_latest->timestamp)
);
// -> eg. "1 USD equals: 0.656741 GBP at 11:11, 11th December 2015"
?>
# Required ruby gems:
require 'json'
require 'net/http'

# Assign app ID and base currency:
your_app_id = "YOUR_APP_ID"
base = "USD"

# Build URI with your app ID and base currency:
uri = URI("https://openexchangerates.org/api/latest.json?app_id=#{your_app_id}&base=#{base}")

# Submit get request with your URI and parse results as JSON:
rates = JSON.parse(Net::HTTP.get(uri))

# rates is a hash where exchange rates can be accessed like so:
# rates["rates"]["GBP"]
More code samples are on their way! Please get in touch if you'd like to submit a new/improved code sample in your languague or framework.

To request rates for a different base currency, please see Changing Base Currency.

Errors

Please see API Error Messages for a list of possible errors.

Language
Click Try It! to start a request and see the response here!