CurrencyFreaks API
CurrencyFreaks API provides exchange rates of 350 currencies worldwide. This documentation provides complete details of the features and options available in this API.
Authorization
In order to use the API, you need to sign up. It does not require a credit card. The availability of endpoints and features depends on the subscription plan you have.
Once you've created your account successfully, you need to get your API key from our API dashboard. You can use this dashboard to upgrade or downgrade your plan and monitor your API usage. We strongly discourage the use of API key in client-side JavaScript, as it will expose your API key to the public.
JSON and XML Response Formats
All the endpoints of CurrencyFreaks API can respond in JSON and XML formats, JSON is the default response format.
XML Format
You can get API response in XML format by following way:
- Pass format=xml as a URL parameter.
Here is an examples of XML response:
$ curl 'https://api.currencyfreaks.com/latest?apikey=YOUR_APIKEY&format=xml'
<CurrencyFreaks>
<response>
<date>2020-08-11 11:44:00+00</date>
<base>USD</base>
<rates>
<FJD>2.13402</FJD>
<MXN>22.3225</MXN>
<CDF>1947.72</CDF>
<GTQ>7.7</GTQ>
<CLP>805.98</CLP>
<HNL>24.6815</HNL>
<UGX>3667.81</UGX>
</rates>
</response>
</CurrencyFreaks>
If you don't set format in the URL parameter the API will respond in JSON format.
Security / SSL
We take security seriously and serve all of our API endpoints over a secure HTTPS connection for all users, even if you are on the free plan.
Rate & Requests Limits
We have hard limits on the number of requests for all paid and free plans. Once you reach the quota of the subscribed plan, we'll stop serving your requests. For free plan, we send one email notification when you reach your quota. For paid plans, we send three notification emails on 80%, 90% and 100% usage, respectively. Other than the above mentioned hard limit, we don't have any daily or hourly rate limits on any of our plans. You can consume all of your monthly/yearly quota in a single day. Please visit our pricing page for allowed requests limit in each plan.
Supported Currencies
This endpoint returns the complete information of all supported currencies by CurrencyFreaks APi such as currency code, currency full name, currency icon. country code & country name. It doesn't require an apikey.
Note: If currency type is crypto and metal, its countryCode value will be "Crypto" and "Metal", respectively, and countryName value will be "Global".
This endpoint is accessible on all subscription plans
The URL for this endpoint is https://api.currencyfreaks.com/supported-currencies and its curl example with JSON response is below:
$ curl 'https://api.currencyfreaks.com/supported-currencies'
[
{
"currencyCode": "XAG",
"currencyName": "Silver (troy ounce)",
"icon": "https://currencyfreaks.com/photos/flags/xag.png",
"status": "available",
"available_in_historical_data_from": "2020-04-20",
"available_in_historical_data_till": "current_date",
"countryCode": "Metal",
"countryName": "Global"
},
{
"currencyCode": "BTC",
"currencyName": "Bitcoin",
"icon": "https://currencyfreaks.com/photos/flags/btc.png",
"status": "available",
"available_in_historical_data_from": "2013-01-07",
"available_in_historical_data_till": "current_date",
"countryCode": "Crypto",
"countryName": "Global"
},
{
"currencyCode": "PKR",
"currencyName": "Pakistan Rupee",
"icon": "https://currencyfreaks.com/photos/flags/pkr.png",
"status": "available",
"available_in_historical_data_from": "1985-10-02",
"available_in_historical_data_till": "current_date",
"countryCode": "PK",
"countryName": "Pakistan"
},
{
"currencyCode": "ZMK",
"currencyName": "Zambian Kwacha",
"icon": "https://currencyfreaks.com/photos/flags/zmk.png",
"status": "not_available",
"available_in_historical_data_from": "1989-08-18",
"available_in_historical_data_till": "2021-03-03",
"countryCode": "ZM",
"countryName": "Zambia"
},
[...]
]
Supported Currency Symbols
This endpoint returns the currency symbols (codes) and full names of all available currencies. It doesn't require an apikey.
This endpoint is accessible on all subscription plans.
The URL for this endpoint is https://api.currencyfreaks.com/currency-symbols and its curl example with JSON response is below:
$ curl 'https://api.currencyfreaks.com/currency-symbols'
{
"AED": "UAE Dirham",
"AFN": "Afghani",
"ALL": "Lek",
"AMD": "Armenian Dram",
"ANG": "Netherlands Antillean Guilder",
"AOA": "Angolan Kwanza",
"ARS": "Argentine Peso",
"AUD": "Australian Dollar",
"AWG": "Aruban Florin",
"AZN": "Azerbaijan Manat",
"BAM": "Bosnia and Herzegovina Convertible Mark",
"BBD": "Barbados Dollar",
"BCH": "Bitcoin Cash",
"BDT": "Bangladeshi Taka",
"BGN": "Bulgarian Lev",
[...]
}
Historical Data Limits
This endpoint returns the information of historical forex & crypto currencies data such as the date since the currency rate is available for a particular currency in CurrencyFreaks database.
This endpoint is accessible on all subscription plans.
This endpoint doesn't require an apikey. The URL for this endpoint is https://api.currencyfreaks.com/historical-data-limits and its curl example with JSON response is below:
$ curl 'https://api.currencyfreaks.com/historical-data-limits'
{
"AUD": "1984-11-28 to 2021-03-30",
"AZN": "2011-07-15 to 2021-03-30",
"ZMK": "1989-08-18 to 2021-03-03",
"BCH": "2017-07-31 to 2021-03-30",
"BRL": "1996-04-01 to 2021-03-30",
"BSD": "1989-08-18 to 2021-03-30",
"BTC": "2013-01-07 to 2021-03-30",
"LTL": "1998-09-30 to 2021-03-03"
"CAD": "1984-11-28 to 2021-03-30",
"CNY": "1985-10-02 to 2021-03-30",
"COP": "1984-11-29 to 2021-03-30",
"EOS": "2017-06-26 to 2021-03-30",
"ERN": "2011-09-12 to 2021-03-30",
"ETB": "1989-08-18 to 2021-03-30",
"ETC": "2016-07-25 to 2021-03-30",
"LVL": "1998-07-31 to 2021-03-03",
[...]
}
API Endpoints:
Latest Currency Exchange Rates
This endpoint returns the latest exchange rates of all available currencies with USD as default base currency.
This endpoint is accessible on all subscription plans.
The URL for this endpoint is https://api.currencyfreaks.com/latest and its curl example with JSON response is below:
$ curl 'https://api.currencyfreaks.com/latest?apikey=YOUR_APIKEY'
{
"date": "2020-07-02 10:39:00+00",
"base": "USD",
"rates": {
"FJD": 2.1692,
"MXN": 22.602,
"STD": 22000.6197,
"SCR": 17.6,
"LVL": 0.6563,
"CDF": 1907.87,
"BBD": 2.0,
"GTQ": 7.7,
"CLP": 808.6,
"UGX": 3721.0,
"HNL": 24.7553,
"ZAR": 16.9326,
"TND": 2.8445,
"CUC": 1.0,
"SLL": 9778.35,
"BSD": 1.0,
[...]
}
}
Get Rates of Desired Currencies Only
You can filter the API response by specifying the currency codes for which you want to retrieve the exchange rates instead of getting the full response.
This will improve the API response time, as the lesser data is being pulled from the server.
You can pass the required currency codes as comma-separated values of the query parameter “symbols” in the request.
This endpoint is accessible on all subscription plans.
Here is a curl example to get rates of specific currency codes only:
$ curl 'https://api.currencyfreaks.com/latest?apikey=YOUR_APIKEY&symbols=PKR,GBP,EUR,USD'
{
"date": "2020-07-02 10:57:00+00",
"base": "USD",
"rates": {
"PKR": 167.0,
"GBP": 0.7994,
"EUR": 0.8863,
"USD": 1.0
}
}
Get Currency Rates By Changing Base Currency
You can change the base currency of any provided endpoint by passing the value of query parameter "base". It can be any currency code which you want to use as a base currency.
This feature is available on all paid subscription plans only.
Here is a curl example to get rates of specific currency codes by EUR as a base currency:$ curl 'https://api.currencyfreaks.com/latest?apikey=YOUR_APIKEY&symbols=PKR,GBP,EUR,INR&base=EUR'
{
"date": "2020-07-02 10:55:00+00",
"base": "EUR",
"rates": {
"PKR": 188.4876,
"GBP": 0.9022,
"EUR": 1.0,
"INR": 84.4496
}
}
Get latest rates of all currencies by a specific base
Here is a curl example which give rates of available currencies by custom base currency:
$ curl 'https://api.currencyfreaks.com/latest?apikey=YOUR_APIKEY&base=EUR'
Parameter | Description |
---|---|
apikey [required] | A unique key assigned to each account which used to authenticate with the API. |
base [optional] | Currency code to be set as base currency. |
symbols [optional] | Currency codes of the desired currencies. Leaving it blank will pull rates for all of the currencies. |
Example Codes for the Latest Currency Exchange Rates endpoint
$ curl --location --request GET 'https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR'
🗗 Copy
var unirest = require('unirest');
var req = unirest('GET', 'https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR')
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
🗗 Copy
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR")
.asString();
🗗 Copy
import http.client
import mimetypes
conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/latest?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
🗗 Copy
setUrl('https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
🗗 Copy
require "uri"
require "net/http"
url = URI("https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
🗗 Copy
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR");
xhr.send();
🗗 Copy
var client = new RestClient("https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
🗗 Copy
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
🗗 Copy
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
🗗 Copy
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/latest
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
🗗 Copy
Latest Rates Conversion Endpoint
This endpoint can convert any amount from one currency to another. To use this endpoint, provide the “from” and “to” currencies as query parameters.
This endpoint is accessible on all paid subscription plans only.
The URL for this endpoint https://api.currencyfreaks.com/latest/convert and here is a curl example to use conversion endpoint::$ curl 'https://api.currencyfreaks.com/latest/convert?apikey=YOUR_APIKEY&from=USD&to=PKR&amount=500'
{
"date": "2020-07-02 10:50:00+00",
"current_rates": {
"USD": 1.0,
"PKR": 167.0
},
"converted_amount": 83500.0,
"query": {
"given_amount": 500.0,
"from": "USD",
"to": "PKR"
}
}
Parameter | Description |
---|---|
apikey [required] | A unique key assigned to each account used to authenticate with the API. |
from [required] | Currency code of the currency you would like to convert from. |
to [required] | Currency code of the currency you would like to convert to |
amount [required] | The amount to be converted. |
Calling currency conversion endpoint
$ curl --location --request GET 'https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500'
🗗 Copy
var unirest = require('unirest');
var req = unirest('GET', 'https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500')
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
🗗 Copy
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500")
.asString();
🗗 Copy
import http.client
import mimetypes
conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/latest/convert
?apikey=YOUR_APIKEY
&from=USD&to=PKR
&amount=500", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
🗗 Copy
setUrl('https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD&to=PKR
&amount=500');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
🗗 Copy
require "uri"
require "net/http"
url = URI("https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD
&to=PKR&amount=500")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
🗗 Copy
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD&to=PKR
&amount=500");
xhr.send();
🗗 Copy
var client = new RestClient("https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD
&to=PKR&amount=500");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
🗗 Copy
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD
&to=PKR&amount=500"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
🗗 Copy
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
🗗 Copy
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/latest/convert
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
🗗 Copy
Historical Exchange Rates Endpoint
Historical rates are available for most of the currencies since 1984-11-28. You can query the CurrencyFreaks API for historical rates by appending a date (format YYYY-MM-DD) to the base URL.
This endpoint is accessible on all paid subscription plans only.
The URL for this endpoint is https://api.currencyfreaks.com/historical/2020-06-26 and here is a curl example to use historical endpoint:
$ curl 'https://api.currencyfreaks.com/historical/2020-06-20?apikey=YOUR_APIKEY'
{
"date": "2020-06-20",
"base": "EUR",
"rates": {
"FJD": 2.4361,
"MXN": 25.3099,
"STD": 24654.971,
"LVL": 0.7338,
"SCR": 19.668,
"CDF": 2115.2905,
"BBD": 2.2363,
"GTQ": 8.6152,
"CLP": 913.8481,
"HNL": 27.7003,
"UGX": 4163.3589,
[...]
}
}
Parameter | Description |
---|---|
apikey [required] | A unique key assigned to each account used to authenticate with the API. |
YYYY-MM-DD [required] | A date in the past for which historical rates are required. |
base [optional] | The Currency code of the base currency. |
symbols [optional] | List of comma-separated currency codes. |
Example Codes for the Historical Currency Exchange Rates
$ curl --location --request GET 'https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR'
🗗 Copy
var unirest = require('unirest');
var req = unirest('GET', 'https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR')
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
🗗 Copy
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR")
.asString();
🗗 Copy
import http.client
import mimetypes
conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
🗗 Copy
setUrl('https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
🗗 Copy
require "uri"
require "net/http"
url = URI("https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
🗗 Copy
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR");
xhr.send();
🗗 Copy
var client = new RestClient("https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
🗗 Copy
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
🗗 Copy
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
🗗 Copy
var client = new RestClient("https://api.currencyfreaks.com/historical/2020-06-20
?apikey=YOUR_APIKEY
&base=GBP
&symbols=EUR,USD,PKR,INR");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
🗗 Copy
Time Series Endpoint
CurrencyFreaks API's time series endpoint lets you query the API for daily historical rates between two dates of your choice.
This endpoint is accessible on Professional plan and onwards.
The URL for this endpoint https://api.currencyfreaks.com/timeseries and here is a curl example to use time series endpoint:
$ curl 'https://api.currencyfreaks.com/timeseries?apikey=YOUR_APIKEY&start_date=2020-06-01&end_date=2020-06-29&base=EUR&symbols=PKR,USD'
{
"start_date": "2020-06-24",
"end_date": "2020-06-29",
"base": "EUR",
"rates": {
"2020-06-24 00:00:00+00": {
"PKR": 189.7518,
"USD": 1.1312
},
"2020-06-25 00:00:00+00": {
"PKR": 188.277,
"USD": 1.1251
},
"2020-06-26 00:00:00+00": {
"PKR": 187.0548,
"USD": 1.1218
},
"2020-06-27 00:00:00+00": {
"PKR": 187.8717,
"USD": 1.122
},
"2020-06-28 00:00:00+00": {
"PKR": 187.8717,
"USD": 1.122
},
"2020-06-29 00:00:00+00": {
"PKR": 189.1679,
"USD": 1.1284
}
}
}
Parameter | Description |
---|---|
apikey [required] | A unique key assigned to each API account used to authenticate with the API. |
start_date [required] | The start date of your preferred time frame. |
end_date [required] | The end date of your preferred time frame. |
base [optional] | the three letter currency code which can set as base currency. |
symbols [optional] | List of comma-separated currency codes. |
Example Codes for the Time Series Currency Exchange Rates
$ curl --location --request GET 'https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR'
🗗 Copy
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR',
'headers': {
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
🗗 Copy
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR")
.asString();
🗗 Copy
import http.client
import mimetypes
conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
🗗 Copy
setUrl('https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
🗗 Copy
require "uri"
require "net/http"
url = URI("https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
🗗 Copy
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR");
xhr.send();
🗗 Copy
var client = new RestClient("https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
🗗 Copy
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
🗗 Copy
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
🗗 Copy
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/timeseries
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
🗗 Copy
Fluctuation Endpoint
This endpoint provides information about how currencies fluctuate on a day-to-day basis. To use this feature, provide a “start_date” and “end_date” as the query parameter and choose which currencies (symbols) you would like to query.
This endpoint is accessible on Professional plan and onwards.
The URL for this endpoint https://api.currencyfreaks.com/fluctuation and here is a curl example to use fluctuation endpoint:
$ curl 'https://api.currencyfreaks.com/fluctuation?apikey=YOUR_APIKEY&start_date=2015-10-01&end_date=2015-10-02&symbols=PKR&base=GBP'
{
"start_date": "2015-10-01",
"end_date": "2015-10-02",
"base": "GBP",
"rates": {
"PKR": {
"start_rate": 158.01844342569163,
"end_rate": 158.115389272309,
"change": 0.097,
"change_per": 0.0614
}
}
}
Parameter | Description |
---|---|
apikey [required] | A unique key assigned to each API account used to authenticate with the API. |
start_date [required] | The start date of your preferred time frame. |
end_date [required] | The end date of your preferred time frame. |
base [optional] | the three letter currency code which can set as base currency. |
symbols [optional] | List of comma-separated currency codes. |
Example Codes for the Fluctuation Endpoint
$ curl --location --request GET 'https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR'
🗗 Copy
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR',
'headers': {
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
🗗 Copy
Unirest.setTimeouts(0, 0);
HttpResponse response = Unirest.get("https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&base=GBP
&symbols=EUR,USD,PKR,INR")
.asString();
🗗 Copy
import http.client
import mimetypes
conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/fluctuation?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
🗗 Copy
setUrl('https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
🗗 Copy
require "uri"
require "net/http"
url = URI("https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
🗗 Copy
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR");
xhr.send();
🗗 Copy
var client = new RestClient("https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
🗗 Copy
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
🗗 Copy
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
🗗 Copy
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/fluctuation
?apikey=YOUR_APIKEY
&start_date=2015-10-01
&end_date=2015-10-02
&symbols=PKR,USD,GBP,INR
&base=EUR")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
🗗 Copy
Historical Currency Rates Conversion
This endpoint can convert amount according to past currency rates. In order to convert currencies based on historical rates, use the API’s historical conversion endpoint, add date & append the “from” and “to” currency symbols as query parameters.
This endpoint is accessible on all paid subscription plans.
The URL for this endpoint https://api.currencyfreaks.com/convert and here is a curl example to use historical rates conversion endpoint:$ curl 'https://api.currencyfreaks.com/convert/2020-01-06?apikey=YOUR_APIKEY&from=USD&to=PKR&amount=500'
Parameter | Description |
---|---|
apikey [required] | A unique key assigned to each API account used to authenticate with the API. |
YYYY-MM-DD [required] | A date in the past for which historical rates are requested. |
from [required] | The Currency code of the currency you would like to convert from. |
to [required] | The Currency code of the currency you would like to convert to |
amount [required] | The amount to be converted. |
Example Codes for the Historical Currency Conversion
$ curl --location --request GET 'https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500'
🗗 Copy
var unirest = require('unirest');
var req = unirest('GET', 'https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500')
.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.raw_body);
});
🗗 Copy
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500")
.asString();
🗗 Copy
import http.client
import mimetypes
conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD&to=PKR
&amount=500", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
🗗 Copy
setUrl('https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD&to=PKR
&amount=500');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
🗗 Copy
require "uri"
require "net/http"
url = URI("https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD
&to=PKR&amount=500")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
🗗 Copy
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD&to=PKR
&amount=500");
xhr.send();
🗗 Copy
var client = new RestClient("https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD
&to=PKR&amount=500");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
🗗 Copy
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
🗗 Copy
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
🗗 Copy
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/convert/2020-01-05
?apikey=YOUR_APIKEY
&from=USD
&to=PKR
&amount=500")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
🗗 Copy
IP To Currency Conversion Endpoint
This endpoint provides you the local currency exchange rates by IP address location or client (visitor) location. The client currency is retireved from their IP address which is done automatically by our service. This endpoint is quite useful for displaying localized currency rates to website visitors without asking for their location. Both IPv4 and IPv6 addresses are supported.
This endpoint is accessible on Growth plan and onwards.
The URL for this endpoint https://api.currencyfreaks.com/iptocurrency and here is a curl example to use IP to currency endpoint:
$ curl 'https://api.currencyfreaks.com/iptocurrency?apikey=YOUR_APIKEY&from=GBP&ip=182.186.18.91&amount=500'
{
"date": "2020-07-02 15:15:00+00",
"current_rates": {
"GBP": 1,
"PKR": 208.027
},
"converted_amount": 104013.4613,
"query": {
"given_amount": 500.0,
"from": "GBP",
"to": "PKR"
}
}
Parameter | Description |
---|---|
apikey [required] | A unique key assigned to each API account used to authenticate with the API. |
from [required] | The three-letter currency code of the currency you would like to convert from. |
ip [optional] | An IPv4 or IPv6 IP address, conversion will be according to country location of provided IP address. If IP is not provided, the client IP address will be used. |
amount [required] | The amount to be converted. |
Example Codes for the IP To Currency Endpoint
$ curl --location --request GET 'https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500'
🗗 Copy
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500',
'headers': {
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
🗗 Copy
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.get("https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500")
.asString();
🗗 Copy
import http.client
import mimetypes
conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
🗗 Copy
setUrl('https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
🗗 Copy
require "uri"
require "net/http"
url = URI("https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
response = https.request(request)
puts response.read_body
🗗 Copy
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500");
xhr.send();
🗗 Copy
var client = new RestClient("https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
🗗 Copy
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
}
res, err := client.Do(req)
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
🗗 Copy
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
🗗 Copy
import Foundation
var semaphore = DispatchSemaphore (value: 0)
var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/iptocurrency
?apikey=YOUR_APIKEY
&from=EUR
&to=182.186.47.12
&amount=500")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
🗗 Copy
HTTP Error Codes
CurrencyFreaks API returns 200 HTTP status in case of a successful request.
For error scenarios, CurrencyFreaks API returns 4xx HTTP code alongs with the error message .
Here is the complete description of each error code with message:
HTTP Code | Error Message |
---|---|
400 | Please provide an apikey to use CurrencyFreaks API. To get an apikey for free signup here https://currencyfreaks.com/signup.html. |
400 | URL parameter values are invalid! Contact tech. support for assistance at support@currencyfreaks.com. |
400 | Provided Date {DATE} format is invalid. It should be like YYYY-MM-DD. |
404 | Rates of provided symbol {PROVIDED_SYMBOL} are available from {DATE} in our database! |
404 | Rates of provided date {DATE} are not available for this time! |
404 | You have not supplied a valid apikey. Contact tech. support for assistance at support@currencyfreaks.com. |
406 | Provided API Key is inactive. Contact tech. support for assistance at support@currencyfreaks.com. |
412 | You have exceeded the limit of {TOTAL_ALLOWED_LIMIT} requests for your subscribed plan {SUBSCRIBED_PLAN_NAME}. Please upgrade your plan to continue using our API without interruption. |
414 | This feature is available on {SUPPORTED_PLAN_NAME} plan and onwards!. |
423 | Provided IP address {IP_ADDRESS} is not valid. |