This is the currency exchange rates API by QWeb Ltd. Use this API to get up-to-date exchange rate information for over 160 currencies.
We originally built this API for our Egg Basket ecommerce framework, because we needed a stable, centralised system for all of our ecommerce websites to talk to and obtain foreign exchange rates between any two currencies. Other services offering this data kept dropping offline, moving, or changing the format that they responded with so we built this as a wrapper that could be quickly modified to account for such changes, and that could remain online even if the sources it feeds from go down.
This API now supports over 160 currencies, offering exchange rates that are updated daily with an accuracy of up to 12 decimal places, and can be used to receive exchange rate information either for one-to-one or one-to-many conversion with a single request. We also implement complex, proprietary server-side cache mechanics making this perhaps the fastest currency exchange rates API available!
Supported currencies: AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLF, CLP, CNH, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GGP, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, IMP, INR, IQD, IRR, ISK, JEP, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW
To use this API, first create a free API Console account and then log in to the API Console to generate an access key.
Once you have an access key, simply send a GET request to https://apis.qweb.co.uk/currency-exchange-rates/ACCESS_KEY/CURRENCY_FROM/CURRENCY_TO.json and a JSON formatted response will be returned. CURRENCY_TO can be a single currency code, or a comma separated list.
The returned data will be a JSON object containing an answer property, which will either be success if the API key is valid and the currencies are recognised, or an error message on fail. Additionally, if the return is successful, the JSON object will contain from, to, and exchange properties if only one exchange rate was requested, or a from property if multiple exchange rates were requested, and a rates object containing currency and exchange property pairs for each.
For example, https://apis.qweb.co.uk/currency-exchange-rates/ACCESS_KEY/gbp/usd.json will return the following JSON (inaccurate example rate):
{
"from":"GBP",
"to":"USD",
"exchange":"1.271310000000",
"answer":"success"
}
While https://apis.qweb.co.uk/currency-exchange-rates/ACCESS_KEY/gbp/cad,eur,usd.json will return the following JSON (inaccurate example rate):
{
"from":"GBP",
"rates":[
{
"currency":"CAD",
"exchange":"1.719870000000"
},
{
"currency":"EUR",
"exchange":"1.171292099166"
},
{
"currency":"USD",
"exchange":"1.271310000000"
}
],
"answer":"success"
}
Being a REST API, you can access this data from any device with a working Internet connection, using any programming language or development framework that has the ability to request HTTP URIs. The following example is a PHP script using Curl to request and display a conversion from 10 GBP into USD.
$api = curl_init();
$accessKey = 'YOUR_ACCESS_KEY';
$from = 'gbp';
$to = 'usd';
$amount = 10;
curl_setopt($api, CURLOPT_URL, 'https://apis.qweb.co.uk/currency-exchange-rates/'.$accessKey.'/'.$from.'/'.$to.'.json');
curl_setopt($api, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($api);
curl_close($api);
$data = json_decode($response);
if($data->answer == 'success')
echo number_format($amount, 2).' '.$from.' is '.number_format($amount * $data->exchange, 2).' '.$to;
This currency conversion API has a built-in cache mechanic and is super quick to respond, and we of course aim to keep our servers up at all times, but in case of network issues and for the best possible performance, we recommend building your application to periodically request updated rates from our system to store locally for live use. Our currency exchange rates are updated daily, so keeping your own cache for a few hours won't affect accuracy.
Copyright © 2023 - 2024 QWeb Ltd. All rights reserved. Company number 11693058. Privacy Policy