CurrencyFreaks API

CurrencyFreaks API provides 179 currency exchange rates world wide. This documentation provides complete details of features and available options in this API.

Authorization

In order to use the API, you need to sign up. It does not require credit card required. The availability of endpoints and features depend 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>
             <STD>21292.767074</STD>
             <SCR>17.83</SCR>
             <LVL>0.656261</LVL>
             <CDF>1947.72</CDF>
             <GTQ>7.7</GTQ>
             <BBD>2.0</BBD>
             <CLP>805.98</CLP>
             <HNL>24.6815</HNL>
             <UGX>3667.81</UGX>
           </rates>
    </response>
</CurrencyFreaks>
       

If you don't set format URL parameter the API will respond in JSON format.

Security / SSL

We take security seriously and all of our API endpoints are served over a secure HTTPS connection for all users, even if you are on the free plan.

Rate & Requests Limits

We have a hard limit of 1000 requests per month on our Free plan. However, we don't have any daily, hourly rate limit on any of our plans, it depends on the allowed requests limit of your plan. Please visit our pricing page for allowed requests limit in each plan.

Available Endpoints

CurrencyFreaks API has following endpoints

Get Latest Currency Rates

This endpoint returns the latest rates of all available currencies with timestamp by USD as default base currency. 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 the Rates of Required Currencies Only

You can filter the API response by specifying the currency codes which you want to know their rates instead of getting the full response. Codes of the required currencies must be passed as values separated by comma of the query parameter "symbols" in the request. 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. 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
    }
}

Note: Changing base currencies is available for the paid plans only.

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 API account used to authenticate with the API.
base [optional] The three-letter currency code of the currency which want to set as base currency.
symbols [optional] The three-letter currency codes which you want get their rates its value can be one or more than one currencies separated by comma

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

Conversion Endpoint

This endpoint can be used to convert any amount from one currency to another. To use this endpoint, provide the from and to currencies as query parameters. 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"
    }
}

Note: This feature is available on paid plans only.

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.
to [required] The three-letter 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 currencies all the way back to the year of 2015. You can query the CurrencyFreaks API for historical rates by appending a date (format YYYY-MM-DD) to the base URL. 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,
      [...]
    }
}
           
       

Note: This feature is available on paid plans only.

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.
base [optional] The three-letter currency code of the 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 timeseries endpoint lets you query the API for daily historical rates between two dates of your choice. 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
        }
    }
}
           
       

Note: This feature is available on paid users starting from Professional plan only.

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. 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
        }
    }
}
       

Note: This feature is available for paid users of the Professional plan only.

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 be used to convert amount according to past currency rates. In order to convert historical currencies rates, use the API's historical conversion endpoint, add date & append the from and to currency symbols as query parameters. 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'

Note: This feature is available for paid users starting from Growth plans only.

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 three-letter currency code of the currency you would like to convert from.
to [required] The three-letter 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. Both of IPv4 and IPv6 addresses are supported. 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.

Note: This endpoint is available for paid users starting from Growth plans only.

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.

While, in case of an illegal request, CurrencyFreaks API returns 4xx HTTP code alongs with a descriptive message as why the error occured.

Here is the description of why a specific HTTP code is returned:

HTTP Code Description
401 When did not provided API key parameter with the request.
400 When did not provided an APIkey parameter's value with the request.
412 When exceeded the requests limit of apikey.
406 When provided API key is inactive.
404 When provided API key is invalid.
414 When you call an endpoint which is not available in your subscription.
423 Throws on IP to currency endpoint only when provided IP address is private or bogon.