Retrieves the currency conversion rates for a specific date.
https://api.upcdatabase.org/currency/history?base={XXX}&date=YYYY-MM-DD
Parameter | Type | Description |
---|---|---|
base | string | Requested exchange rates base asset identifier. (USD, EUR, etc) (required) |
date | string | In format: YYYY-MM-DD (required) |
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.upcdatabase.org/currency/latest/?base=GBP&date=2020-04-24', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_HTTPHEADER => array( 'Authorization: Bearer THISISALIVEDEMOAPIKEY19651D54X47' ), )); $response = curl_exec($curl); curl_close($curl); echo $response;
var settings = { "url": "https://api.upcdatabase.org/currency/latest/?base=GBP&date=2020-04-24", "method": "GET", "timeout": 0, "headers": { "Authorization": "Bearer THISISALIVEDEMOAPIKEY19651D54X47" }, }; $.ajax(settings).done(function (response) { console.log(response); });
curl --location --request GET 'https://api.upcdatabase.org/currency/latest/?base=GBP&date=2020-04-24' \ --header 'Authorization: Bearer THISISALIVEDEMOAPIKEY19651D54X47'
The response contains an array of all the currently supported currencies in JSON format.
{ "success": true, "date": "2022-05-20", "timestamp": 1661699869, "base": "USD", "rates": { "AUD": 1.421, "CAD": 1.284, "CHF": 0.975, "EUR": 0.947, "GBP": 0.801, "HKD": 7.848, "INR": 77.819, "JPY": 127.935, "KRW": 1273.745, "MXN": 19.858, "NZD": 1.565, "RUB": 62, "SEK": 9.943, "SGD": 1.38, "USD": 1, "ZAR": 15.768 } }