Retrieves the latest currency conversion rates for today.
https://api.upcdatabase.org/currency/latest/?base=XXX
Parameter | Type | Description |
---|---|---|
base | string | Requested exchange rates base asset identifier. (USD, EUR, etc) (required) |
target | string | Requested exchange rates target identifier. (USD, EUR, etc) (optional) |
format | string | Can be json (default) or text (optional). Required when target is set. |
<?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'https://api.upcdatabase.org/currency/latest/?base=GBP', 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", "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' \ --header 'Authorization: Bearer THISISALIVEDEMOAPIKEY19651D54X47'
The response contains an array of all the currently supported currencies in JSON format.
{ "success": true, "date": "2022-08-28", "timestamp": 1661699736, "base": "USD", "rates": { "AUD": 1.451, "CAD": 1.304, "CHF": 0.965, "EUR": 1.004, "GBP": 0.851, "HKD": 7.847, "INR": 79.972, "JPY": 137.565, "KRW": 1342.18, "MXN": 20.023, "NZD": 1.63, "RUB": 60.304, "SEK": 10.683, "SGD": 1.393, "USD": 1, "ZAR": 16.887 } }
0.851