Trusted By

Equiti - Trading App Epixil - Business automation software Exigo - Global incentive manager HP - Laptops, PCs and more Oodles - Innovate with AI Savart - Wealth management platform Sim Code - World Economic data analyzer Timify - Appointment scheduling software UGA - University of Georgia Equiti - Trading App Epixil - Business automation software Exigo - Global incentive manager HP - Laptops, PCs and more Oodles - Innovate with AI Savart - Wealth management platform Sim Code - World Economic data analyzer Timify - Appointment scheduling software UGA - University of Georgia



Features

World Currencies

We provide real time exchange rate data for world currencies including fiat currencies, metals and crypto currencies updated in every minute.

Trusted Data

CurrencyFreaks sources data from trusted forex exchanges, crypto currency exchanges and various national banks.

Security

We take security seriously that is why every request to our server is SSL encrypted even in our free plan.

Speed

Speed matters a lot to us that is why we are using geolocation based routing for all of our customers which provides 20-40 ms average latency worldwide. Check our status page for more information.

Priority Customer Support

Got a question or need any technical help in integration? Just let us know through our contact us form or support@currencyfreaks.com. We’ll get back to you instantly.

Documentation

Our detailed documentation walks you through our API features without any hassle. Each endpoint contains working examples of various languages including java, python, js, php, ruby, swift and many more. Check our documentation for more details.

Pricing Plans

Save big by paying annually! Plan Selection

Developer
Free /Month
  • 1000 API Calls/Month
  • 24 Hour Updates
  • USD as Base Currency
  • Limited Support
  • SSL Encryption
Sign Up for Free
Starter
US$9.99 /Month
  • 15K API Calls/Month
  • Hourly Updates
  • Historical Exchange Rates
  • All Base Currencies
  • Live Rates Conversion
  • Historical Rates Conversion
  • Basic Support
  • SSL Encryption
Sign Up for Free
Growth
US$49.99 /Month
  • 150K API Calls/Month
  • 10 Minute Updates
  • Historical Exchange Rates
  • All Base Currencies
  • Live Rates Conversion
  • Historical Rates Conversion
  • IP to Currency Endpoint
  • Premium Support
  • SSL Encryption
Sign Up for Free
Professional
US$99.99 /Month
  • 550K API Calls/Month
  • 60 Second Updates
  • Historical Exchange Rates
  • All Base Currencies
  • Live Rates Conversion
  • Historical Rates Conversion
  • IP to Currency Endpoint
  • Time Series Endpoint
  • Fluctuation Endpoint
  • Premium Support
  • SSL Encryption
Sign Up for Free
Enterprise
  • Volume API Calls/Month
  • 60 Second Updates
  • Historical Exchange Rates
  • All Base Currencies
  • Live Rates Conversion
  • Historical Rates Conversion
  • IP to Currency Endpoint
  • Time Series Endpoint
  • Fluctuation Endpoint
  • Premium Support
  • SSL Encryption
  • Custom Solutions
Contact Us
Developer
Free /Month
  • 1000 API Calls/Month
  • 24 Hour Updates
  • USD as Base Currency
  • Limited Support
  • SSL Encryption
Sign Up for Free
Starter
US$99.99 /Year
  • 180K API Calls/Year
  • Hourly updates
  • Historical Exchange Rates
  • All Base Currencies
  • Live Rates Conversion
  • Historical Rates Conversion
  • Basic Support
  • SSL Encryption
Sign Up for Free
Growth
US$499.99 /Year
  • 1.8M API Calls/Year
  • 10 Minute Updates
  • Historical Exchange Rates
  • All Base Currencies
  • Live Rates Conversion
  • Historical Rates Conversion
  • IP to Currency Endpoint
  • Premium Support
  • SSL Encryption
Sign Up for Free
Professional
US$999.99 /Year
  • 6.6M API Calls/Year
  • 60 second Updates
  • Historical Exchange Rates
  • All Base Currencies
  • Live Rates Conversion
  • Historical Rates Conversion
  • IP to Currency Endpoint
  • Time Series Endpoint
  • Fluctuation Endpoint
  • Premium Support
  • SSL Encryption
Sign Up for Free
Enterprise
  • Volume API Calls/Month
  • 60 Second Updates
  • Historical Exchange Rates
  • All Base Currencies
  • Live Rates Conversion
  • Historical Rates Conversion
  • IP to Currency Endpoint
  • Time Series Endpoint
  • Fluctuation Endpoint
  • Premium Support
  • SSL Encryption
  • Custom Solutions
Contact Us

* VAT is not included.

API Documentation

CurrencyFreaks API

CurrencyFreaks API provides exchange rates of 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.

Here is an example of JSON response:


$ curl 'https://api.currencyfreaks.com/v2.0/rates/latest?apikey=YOUR_APIKEY'

{
  "date": "2023-03-21 12:43:00+00",
  "base": "USD",
  "rates": {
    "AGLD": "2.3263929277654998",
    "FJD": "2.21592",
    "MXN": "18.670707655673546",
    "LVL": "0.651918",
    "SCR": "13.21713243157135",
    "CDF": "2068.490771",
    "BBD": "2.0",
    "HNL": "24.57644632001569",
    .
    .
    .
  }
}
       

XML Format

You can get API response in XML format by following way:

  • Pass format=xml as a URL parameter.

Here is an example of XML response:


$ curl 'https://api.currencyfreaks.com/v2.0/rates/latest?apikey=YOUR_APIKEY&format=xml'

<LatestRatesResponse>
    <date>2023-03-21 12:47:00+00</date>
    <base>USD</base>
    <rates>
        <AGLD>2.3150827642088205</AGLD>
        <FJD>2.2159199998194876</FJD>
        <MXN>18.668821666666666</MXN>
        <LVL>0.651985</LVL>
        <SCR>13.217309</SCR>
        <CDF>2068.359300493814</CDF>
        <BBD>2.0</BBD>
        <HNL>24.576748999999996</HNL>
        .
        <_1INCH>1.9102196752626552</_1INCH>
        .
        .
        .
    </rates>
</LatestRatesResponse>
       

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

Note: In XML response, tags containing currency codes starting with integers will be preceded by an underscore "_"

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 section 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/v2.0/supported-currencies and its curl example with JSON response is below:

$ curl 'https://api.currencyfreaks.com/v2.0/supported-currencies'

{
    "supportedCurrenciesMap": {
        "PKR": {
            "currencyCode": "PKR",
            "currencyName": "Pakistan Rupee",
            "countryCode": "PK",
            "countryName": "Pakistan",
            "status": "AVAILABLE",
            "availableFrom": "1985-10-02",
            "availableUntil": "{CURRENT_DATE}",
            "icon": "https://currencyfreaks.com/photos/flags/pkr.png?v=0.1"
        },
        "BTC": {
            "currencyCode": "BTC",
            "currencyName": "Bitcoin",
            "countryCode": "Crypto",
            "countryName": "Global",
            "status": "AVAILABLE",
            "availableFrom": "2013-01-07",
            "availableUntil": "{CURRENT_DATE}",
            "icon": "https://currencyfreaks.com/photos/flags/btc.png?v=0.1"
        },
        "XPT": {
            "currencyCode": "XPT",
            "currencyName": "Platinum",
            "countryCode": "Metal",
            "countryName": "Global",
            "status": "AVAILABLE",
            "availableFrom": "2020-09-02",
            "availableUntil": "{CURRENT_DATE}",
            "icon": "https://currencyfreaks.com/photos/flags/xpt.png?v=0.1"
        },
        "GBX": {
            "currencyCode": "GBX",
            "currencyName": "Penny Sterling",
            "countryCode": "UK",
            "countryName": "United Kingdom",
            "status": "DEPRECIATED",
            "availableFrom": "2021-04-05",
            "availableUntil": "2023-03-15",
            "icon": "https://currencyfreaks.com/photos/flags/gbx.png?v=0.1"
        },
        {...}
    }
}

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/v2.0/currency-symbols and its curl example with JSON response is below:

$ curl 'https://api.currencyfreaks.com/v2.0/currency-symbols'

{
    "currencySymbols": {
        "AGLD": "Adventure Gold",
        "FJD": "Fiji Dollar",
        "MXN": "Mexican Peso",
        "SCR": "Seychellois Rupee",
        "CDF": "Congolese Franc",
        "BBD": "Barbadian Dollar",
        "HNL": "Honduran Lempira",
        "UGX": "Uganda Shilling",
        "PKR": "Pakistani Rupee",
        "EUR": "Euro",
        "GBP": "Pound Sterling",
        "CAD": "Canadian Dollar",
        "USD": "US Dollar"
        "ETH": "Ethereum",
        .
        .
        .
    }
}

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/v2.0/historical-data-limits and its curl example with JSON response is below:

$ curl 'https://api.currencyfreaks.com/v2.0/historical-data-limits'

{
    "availabilityPeriod": {
        "AGLD": "2022-05-16 to 2023-03-21",
        "FJD": "1989-08-18 to 2023-03-21",
        "MXN": "1993-01-05 to 2023-03-21",
        "LVL": "2022-12-09 to 2023-03-21",
        "SCR": "1998-07-31 to 2023-03-21",
        "CDF": "2009-10-27 to 2023-03-21",
        "BBD": "1989-08-18 to 2023-03-21",
        "HNL": "1989-08-18 to 2023-03-21",
        "UGX": "1989-08-18 to 2023-03-21",
        "GLM": "2022-05-16 to 2023-03-21",
        "NEAR": "2022-08-31 to 2023-03-21",
        "AIOZ": "2022-05-16 to 2023-03-21",
        "AUDIO": "2023-01-25 to 2023-03-21",
        "FARM": "2022-05-16 to 2023-03-21",
        .
        .
        .
    }
}

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/v2.0/rates/latest?apikey=YOUR_APIKEY and its curl example with JSON response is below:

$ curl 'https://api.currencyfreaks.com/v2.0/rates/latest?apikey=YOUR_APIKEY'

{
  "date": "2023-03-21 12:43:00+00",
  "base": "USD",
  "rates": {
    "AGLD": "2.3263929277654998",
    "FJD": "2.21592",
    "MXN": "18.670707655673546",
    "LVL": "0.651918",
    "SCR": "13.21713243157135",
    "CDF": "2068.490771",
    "BBD": "2.0",
    "HNL": "24.57644632001569",
    .
    .
    .
  }
}

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.
The URL for this endpoint is same as the previous one which is https://api.currencyfreaks.com/v2.0/rates/latest?apikey=YOUR_APIKEY&symbols={CURRENCYCODE},{CURRENCYCODE},... and here is a curl example to get rates of specific currency codes only:

$ curl 'https://api.currencyfreaks.com/v2.0/rates/latest?apikey=YOUR_APIKEY&symbols=PKR,GBP,EUR,USD'

{
    "date": "2023-03-21 13:26:00+00",
    "base": "USD",
    "rates": {
        "EUR": "0.9278605451274349",
        "GBP": "0.8172754173817152",
        "PKR": "281.6212943333344",
        "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.
The URL for this endpoint is https://api.currencyfreaks.com/v2.0/rates/latest?apikey=YOUR_APIKEY&symbols={CURRENCYCODE},{CURRENCYCODE},...&base={CURRENCYCODE} and here is a curl example to get rates of specific currency codes by EUR as a base currency:

$ curl 'https://api.currencyfreaks.com/v2.0/rates/latest?apikey=YOUR_APIKEY&symbols=PKR,GBP,EUR,INR&base=EUR'

{
    "date": "2023-03-21 13:29:00+00",
    "base": "EUR",
    "rates": {
        "EUR": "1.0",
        "GBP": "0.8810222794437683",
        "PKR": "303.60317616075287",
        "USD": "1.0780547579946744"
    }
}

Get latest rates of all currencies by a specific base

The URL for this endpoint is https://api.currencyfreaks.com/v2.0/rates/latest?apikey=YOUR_APIKEY&base={CURRENCYCODE} and here is a curl example which give rates of available currencies by custom base currency:

$ curl 'https://api.currencyfreaks.com/v2.0/rates/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. (Default=USD)
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/v2.0/rates/latest?apikey=YOUR_APIKEY&symbols=pkr,usd,cad,eur&base=gbp'

  📋 Copy
var unirest = require('unirest');
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.currencyfreaks.com/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

📋 Copy
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api.currencyfreaks.com/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY")
  .get()
  .build();
Response response = client.newCall(request).execute();

📋 Copy
import http.client

conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

📋 Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.currencyfreaks.com/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY',
  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',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

📋 Copy
require "uri"
require "net/http"

url = URI("https://api.currencyfreaks.com/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY")

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 requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.currencyfreaks.com/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

📋 Copy
var client = new RestClient("https://api.currencyfreaks.com/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY");
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/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  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/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY");
  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
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/v2.0/rates/latest?base=gbp&symbols=pkr,usd,cad,eur&apikey=YOUR_APIKEY")!,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))
    semaphore.signal()
    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 is https://api.currencyfreaks.com/v2.0/ convert/latest?apikey=YOUR_APIKEY& from={CURRENCYCODE}&to={CURRENCYCODE}&amount={AMOUNT} and here is a curl example to use conversion endpoint:

$ curl 'https://api.currencyfreaks.com/v2.0/convert/latest?apikey=YOUR_APIKEY&from=USD&to=PKR&amount=500'

{
    "date": "2023-03-21 15:22:00+00",
    "from": "USD",
    "to": "PKR",
    "rate": "281.683",
    "givenAmount": "500.0",
    "convertedAmount": "140841.475"
}
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 [optional] The amount to be converted. (Default = 1.0)

Calling currency conversion endpoint

curl --location --request GET 'https://api.currencyfreaks.com/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY'

📋 Copy
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.currencyfreaks.com/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

📋 Copy
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api.currencyfreaks.com/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY")
  .get()
  .build();
Response response = client.newCall(request).execute();

📋 Copy
import http.client

conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

📋 Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.currencyfreaks.com/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY',
  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',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

📋 Copy
require "uri"
require "net/http"

url = URI("https://api.currencyfreaks.com/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY")

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 requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.currencyfreaks.com/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

📋 Copy
var client = new RestClient("https://api.currencyfreaks.com/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY");
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/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  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/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY");
  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
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/v2.0/convert/latest?from=usd&to=pkr&amount=500&apikey=YOUR_APIKEY")!,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))
    semaphore.signal()
    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 passing a date (format YYYY-MM-DD) as a URL Parameter.

This endpoint is accessible on all paid subscription plans only.

The URL for this endpoint is https://api.currencyfreaks.com /v2.0/rates/historical?apikey= YOUR_APIKEY&date={DATE} and here is a curl example to use historical endpoint:

           
$ curl 'https://api.currencyfreaks.com/v2.0 /rates/historical?apikey= YOUR_APIKEY&date=2022-03-20'

{
    "date": "2022-03-20",
    "base": "USD",
    "rates": {
        "FJD": "2.1176",
        "MATIC": "0.6832001093120175",
        "MXN": "20.385892",
        "STD": "21382.190504",
        "SCR": "14.408136",
        "CDF": "2005.74861",
        "BBD": "2.0",
        "HNL": "24.411536",
        "UGX": "3583.338449",
        "ZAR": "14.9602",
        "STN": "22.425165",
        .
        .
        .
    }
}
           
       
Parameter Description
apikey [required] A unique key assigned to each account used to authenticate with the API.
date [required] A date in the past for which historical rates are required. (Format=YYYY-MM-DD)
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/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY'

📋 Copy
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.currencyfreaks.com/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});


📋 Copy
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api.currencyfreaks.com/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY")
  .get()
  .build();
Response response = client.newCall(request).execute();

📋 Copy
import http.client

conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

📋 Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.currencyfreaks.com/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY',
  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',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

📋 Copy
require "uri"
require "net/http"

url = URI("https://api.currencyfreaks.com/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY")

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 requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.currencyfreaks.com/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

📋 Copy
var client = new RestClient("https://api.currencyfreaks.com/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY");
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/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  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/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY");
  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
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/v2.0/rates/historical?date=2022-03-20&base=gbp&symbols=usd,eur,pkr,cad&apikey=YOUR_APIKEY")!,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))
    semaphore.signal()
    return
  }
  print(String(data: data, encoding: .utf8)!)
  semaphore.signal()
}

task.resume()
semaphore.wait()

📋 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 is https://api.currencyfreaks.com/v2.0/ timeseries?apikey=YOUR_APIKEY&startDate={DATE}&endDate={DATE}&base={CURRENCYCODE}&symbols={CURRENCYCODE},{CURRENCYCODE} and here is a curl example to use time series endpoint:

           
$ curl 'https://api.currencyfreaks.com/v2.0/timeseries?apikey=YOUR_APIKEY&startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd'

{
    "startDate": "2022-06-01",
    "endDate": "2022-06-07",
    "base": "EUR",
    "historicalRatesList": [
        {
            "date": "2022-06-01",
            "rates": {
                "PKR": "210.58073648790247",
                "USD": "1.0651300000000001"
            }
        },
        {
            "date": "2022-06-02",
            "rates": {
                "PKR": "212.41441993262268",
                "USD": "1.07504"
            }
        },
        {
            "date": "2022-06-03",
            "rates": {
                "PKR": "211.80743999999882",
                "USD": "1.0719"
            }
        },
        {
            "date": "2022-06-04",
            "rates": {
                "PKR": "212.3705498572507",
                "USD": "1.0719"
            }
        },
        {
            "date": "2022-06-05",
            "rates": {
                "PKR": "212.49419555477172",
                "USD": "1.0725240781655547"
            }
        },
        {
            "date": "2022-06-06",
            "rates": {
                "PKR": "213.19503849443953",
                "USD": "1.06928999144568"
            }
        },
        {
            "date": "2022-06-07",
            "rates": {
                "PKR": "215.71624763798502",
                "USD": "1.0696700000000001"
            }
        }
    ]
}
           
       
Parameter Description
apikey [required] A unique key assigned to each API account used to authenticate with the API.
startDate [required] The start date of your preferred time frame.
endDate [optional] The end date of your preferred time frame. (Default= Day before Current Date)
base [optional] the currency code which can set as base currency. (Default=USD)
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/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY'

📋 Copy
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.currencyfreaks.com/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

📋 Copy
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api.currencyfreaks.com/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY")
  .get()
  .build();
Response response = client.newCall(request).execute();

📋 Copy
import http.client

conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

📋 Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.currencyfreaks.com/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY',
  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',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

📋 Copy
require "uri"
require "net/http"

url = URI("https://api.currencyfreaks.com/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY")

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 requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.currencyfreaks.com/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

📋 Copy
var client = new RestClient("https://api.currencyfreaks.com/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY");
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/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  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/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY");
  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
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/v2.0/timeseries?startDate=2022-06-01&endDate=2022-06-07&base=eur&symbols=pkr,usd,gbp,cad&apikey=YOUR_APIKEY")!,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))
    semaphore.signal()
    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 “startDate” and “endDate” 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 is https://api.currencyfreaks.com/v2.0/ fluctuation?apikey=YOUR_APIKEY &startDate={DATE}&endDate={DATE} &symbols={CURRECNYCODE}&base={CURRECNYCODE} and here is a curl example to use fluctuation endpoint:
           
$ curl 'https://api.currencyfreaks.com/v2.0/fluctuation?apikey=YOUR_APIKEY&startDate=2022-10-01&endDate=2022-10-15&symbols=PKR&base=GBP'

{
    "startDate": "2022-10-01",
    "endDate": "2022-10-15",
    "base": "GBP",
    "rateFluctuations": {
        "PKR": {
            "startRate": "254.331",
            "endRate": "243.874",
            "change": "10.457",
            "percentChange": "4.11"
        }
    }
}
       
Parameter Description
apikey [required] A unique key assigned to each API account used to authenticate with the API.
startDate [required] The start date of your preferred time frame.
endDate [optional] The end date of your preferred time frame. (Default= Day before Current Date)
base [optional] the currency code which can set as base currency. (Default=USD)
symbols [optional] List of comma-separated currency codes.

Example Codes for the Fluctuation Endpoint

curl --location --request GET 'https://api.currencyfreaks.com/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY'

📋 Copy
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.currencyfreaks.com/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

📋 Copy
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api.currencyfreaks.com/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY")
  .get()
  .build();
Response response = client.newCall(request).execute();

📋 Copy
import http.client

conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

📋 Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.currencyfreaks.com/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY',
  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',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

📋 Copy
require "uri"
require "net/http"

url = URI("https://api.currencyfreaks.com/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY")

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 requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.currencyfreaks.com/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

📋 Copy
var client = new RestClient("https://api.currencyfreaks.com/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY");
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/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  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/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY");
  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
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/v2.0/fluctuation?startDate=2022-10-01&endDate=2022-10-15&symbols=pkr,eur,gbp,cad&base=usd&apikey=YOUR_APIKEY")!,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))
    semaphore.signal()
    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, append the "date", “from” and “to” currency symbols as query parameters.

This endpoint is accessible on all paid subscription plans.

The URL for this endpoint is https://api.currencyfreaks.com/v2.0/ convert/historical/?apikey=YOUR_APIKEY &date={DATE}&from={CURRENCYCODE} &to={CURRENCYCODE}&amount={AMOUNT} and here is a curl example to use historical rates conversion endpoint:

$ curl 'https://api.currencyfreaks.com/v2.0/convert/historical/?apikey=YOUR_APIKEY&date=2022-01-10&from=USD&to=PKR&amount=500'

{
    "date": "2022-01-10",
    "from": "USD",
    "to": "PKR",
    "rate": "176.750",
    "givenAmount": "500.0",
    "convertedAmount": "88375.000"
}
Parameter Description
apikey [required] A unique key assigned to each API account used to authenticate with the API.
date [required] A date in the past for which historical rates are requested. (Format=YYYY-MM-DD)
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 [optional] The amount to be converted. (Default=1.0)

Example Codes for the Historical Currency Conversion

curl --location --request GET 'https://api.currencyfreaks.com/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY'

📋 Copy
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.currencyfreaks.com/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

📋 Copy
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api.currencyfreaks.com/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY")
  .get()
  .build();
Response response = client.newCall(request).execute();

📋 Copy
import http.client

conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

📋 Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.currencyfreaks.com/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY',
  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',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

📋 Copy
require "uri"
require "net/http"

url = URI("https://api.currencyfreaks.com/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY")

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 requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.currencyfreaks.com/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

📋 Copy
var client = new RestClient("https://api.currencyfreaks.com/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY");
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/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  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/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY");
  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
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/v2.0/convert/historical?from=usd&to=pkr&amount=500&date=2022-01-10&apikey=YOUR_APIKEY")!,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))
    semaphore.signal()
    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 is https://api.currencyfreaks.com/v2.0/ iptocurrency?apikey=YOUR_APIKEY&from={CURRENCYCODE}&ip={IPV4}&amount={AMOUNT} and here is a curl example to use IP to currency endpoint:


$ curl 'https://api.currencyfreaks.com/v2.0/iptocurrency?apikey=YOUR_APIKEY&from=GBP&ip=182.186.18.91&amount=500'

{
    "date": "2023-03-22 08:03:00+00",
    "from": "GBP",
    "to": "PKR",
    "rate": "346.232",
    "ipAddress": "182.186.18.9",
    "givenAmount": "500.0",
    "convertedAmount": "173115.892"
}

Parameter Description
apikey [required] A unique key assigned to each API account used to authenticate with the API.
from [required] The 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 [optional] The amount to be converted. (Default=1.0)

Example Codes for the IP To Currency Endpoint

curl --location --request GET 'https://api.currencyfreaks.com/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY'

📋 Copy
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://api.currencyfreaks.com/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY',
  'headers': {
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

📋 Copy
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
Request request = new Request.Builder()
  .url("https://api.currencyfreaks.com/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY")
  .get()
  .build();
Response response = client.newCall(request).execute();

📋 Copy
import http.client

conn = http.client.HTTPSConnection("api.currencyfreaks.com")
payload = ''
headers = {}
conn.request("GET", "/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

📋 Copy
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.currencyfreaks.com/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY',
  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',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


📋 Copy
require "uri"
require "net/http"

url = URI("https://api.currencyfreaks.com/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY")

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 requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://api.currencyfreaks.com/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

📋 Copy
var client = new RestClient("https://api.currencyfreaks.com/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY");
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/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY"
  method := "GET"

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, nil)

  if err != nil {
    fmt.Println(err)
    return
  }
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  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/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY");
  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
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif

var semaphore = DispatchSemaphore (value: 0)

var request = URLRequest(url: URL(string: "https://api.currencyfreaks.com/v2.0/iptocurrency?from=gbp&amount=500&ip=182.186.18.9&apikey=YOUR_APIKEY")!,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))
    semaphore.signal()
    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
206 Partial Response
404 Required URL is not found. [Contact tech. support for assistance at support@currencyfreaks.com]
400 Please provide API Key to use CurrencyFreaks API. To get an apikey for free, signup here https://currencyfreaks.com/signup.html.
401 Provided API key is invalid. [Contact tech. support for assistance at support@currencyfreaks.com]
401 Provided API key is inactive. [Contact tech. support for assistance at support@currencyfreaks.com]
429 You have exceeded the limit of {ALLOWED_REQUESTS} requests for your subscribed plan {PLAN_NAME}. Please upgrade your plan to continue using our API without interruption
402 This feature is available on {PLAN_NAME} plan and onwards!
400 Invalid URL Parameters. [Contact tech. support for assistance at support@currencyfreaks.com]
400 You have provided invalid parameters for this endpoint. [Contact tech. support for assistance at support@currencyfreaks.com]
400 Invalid format (Available formats: json, xml). [Contact tech. support for assistance at support@currencyfreaks.com]
400 Invalid Amount. Please provide amount in decimal format and greater than 0!
400 From Currency is invalid. It cannot be empty or null!
400 Provided Date {DATE} is in invalid format. It should be like YYYY-MM-DD!
400 Provided Dates are in Invalid Format. Dates must be in a valid format YYYY-MM-DD!
404 Rates of provided date {DATE} are not available in our database
400 Starting date cannot be after current date or ending date.
404 Rates of provided base and symbols are not found for given intervals.
400 Provided IP Address {IP_ADDRESS} is invalid.
404 Geolocation of provided IP {IP_ADDRESS} is unknown.
404 "Rates of provided currency {CURRENCY} are available from {AVAILABLE_FROM} to {AVAILABLE_UNTIL} in our database!"
404 Rates of provided currency {CURRENCY} are not available in our database!
404 Rates of provided Symbols are not available in our database!