# Historical Rate Endpoint

The Ipforensics API provides accurate historical exchange rate data for every past day all the way back to the year of 2020.

{% hint style="success" %}
Each request to the currency endpoint consumes 1 token.
{% endhint %}

### Code Snippet

{% tabs %}
{% tab title="PHP Curl" %}

```javascript
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://ipforensics.net/api/v1/currency/historical?apikey=IPF-36ae36a6-4a32-4fae-a422-e45e70b0a515-X&source=NGN&date=2021-11-10',
  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;

```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var requestOptions = {
  method: 'GET',
  redirect: 'follow'
};

fetch("https://ipforensics.net/api/v1/currency/historical?apikey=IPF-36ae36a6-4a32-4fae-a422-e45e70b0a515-X&source=NGN&date=2021-11-10", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Node Js" %}

```javascript
var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://ipforensics.net/api/v1/currency/historical?apikey=IPF-36ae36a6-4a32-4fae-a422-e45e70b0a515-X&source=NGN&date=2021-11-10',
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://ipforensics.net/api/v1/currency/historical?apikey=IPF-36ae36a6-4a32-4fae-a422-e45e70b0a515-X&source=NGN&date=2021-11-10"

payload={}

response = requests.request("GET", url, data=payload)

print(response.text)

```

{% endtab %}

{% tab title="C#" %}

```csharp
var client = new RestClient("https://ipforensics.net/api/v1/currency/historical?apikey=IPF-36ae36a6-4a32-4fae-a422-e45e70b0a515-X&source=NGN&date=2021-11-10");
client.Timeout = -1;
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
```

{% endtab %}
{% endtabs %}

### Sample Response

```javascript
{
    "status": true,
    "code": 200,
    "message": "Successful",
    "meta_data": {
        "currency": "ngn",
        "date": "2021-11-10",
        "exchange_rate": {
            "ada": 0.001055,
            "aed": 0.008947,
            "afn": 0.222495,
            "all": 0.258056,
            "amd": 1.161227,
            "ang": 0.004389,
            "aoa": 1.454077,
            "ars": 0.24374,
            "aud": 0.003302,
            "awg": 0.004385,
            "azn": 0.004133,
            "bam": 0.004114,
            "bbd": 0.004918,
            "bch": 3.0e-6,
            "bdt": 0.20883,
            "bgn": 0.004109,
            "bhd": 0.000918,
            "bif": 4.863971,
            "bmd": 0.002436,
            "bnb": 4.0e-6,
            "bnd": 0.003281,
            "bob": 0.016817,
            "brl": 0.013349,
            "bsd": 0.002436,
            "btc": 0,
            "btn": 0.180204,
            "bwp": 0.027613,
            "byn": 0.005939,
            "byr": 47.738526,
            "bzd": 0.004909,
            "cad": 0.003029,
            "cdf": 4.895635,
            "chf": 0.002219,
            "clf": 7.0e-5,
            "clp": 1.932875,
            "cny": 0.015571,
            "cop": 9.418592,
            "crc": 1.562416,
            "cuc": 0.002436,
            "cup": 0.064544,
            "cve": 0.232408,
            "czk": 0.053035,
            "djf": 0.432861,
            "dkk": 0.015626,
            "doge": 0.008845,
            "dop": 0.13787,
            "dzd": 0.335736,
            "egp": 0.038272,
            "ern": 0.036538,
            "etb": 0.115108,
            "etc": 3.8e-5,
            "eth": 1.0e-6,
            "eur": 0.002101,
            "fjd": 0.005072,
            "fkp": 0.001786,
            "gbp": 0.001796,
            "gel": 0.007673,
            "ggp": 0.001786,
            "ghs": 0.014881,
            "gip": 0.001786,
            "gmd": 0.127019,
            "gnf": 23.272532,
            "gtq": 0.018849,
            "gyd": 0.509315,
            "hkd": 0.018975,
            "hnl": 0.058919,
            "hrk": 0.015792,
            "htg": 0.239989,
            "huf": 0.757849,
            "idr": 34.729656,
            "ils": 0.007569,
            "imp": 0.001786,
            "inr": 0.180664,
            "iqd": 3.556033,
            "irr": 102.881395,
            "isk": 0.315999,
            "jep": 0.001786,
            "jmd": 0.376549,
            "jod": 0.001727,
            "jpy": 0.274962,
            "kes": 0.271939,
            "kgs": 0.206542,
            "khr": 9.92523,
            "kmf": 1.034782,
            "kpw": 2.192074,
            "krw": 2.870352,
            "kwd": 0.000735,
            "kyd": 0.00203,
            "kzt": 1.045908,
            "lak": 25.428072,
            "lbp": 3.712551,
            "link": 7.2e-5,
            "lkr": 0.49075,
            "lrd": 0.357069,
            "lsl": 0.036729,
            "ltc": 9.0e-6,
            "ltl": 0.007192,
            "lvl": 0.001473,
            "lyd": 0.011094,
            "mad": 0.022056,
            "mdl": 0.042743,
            "mga": 9.64513,
            "mkd": 0.129442,
            "mmk": 4.456934,
            "mnt": 6.943823,
            "mop": 0.019543,
            "mro": 0.869523,
            "mur": 0.105223,
            "mvr": 0.037631,
            "mwk": 1.985046,
            "mxn": 0.049502,
            "myr": 0.010112,
            "mzn": 0.155468,
            "nad": 0.03673,
            "ngn": 1,
            "nio": 0.085759,
            "nok": 0.020725,
            "npr": 0.288328,
            "nzd": 0.003416,
            "omr": 0.000938,
            "pab": 0.002436,
            "pen": 0.009781,
            "pgk": 0.008586,
            "php": 0.122226,
            "pkr": 0.417346,
            "pln": 0.009649,
            "pyg": 16.761154,
            "qar": 0.008868,
            "ron": 0.010396,
            "rsd": 0.247071,
            "rub": 0.172322,
            "rwf": 2.447817,
            "sar": 0.009135,
            "sbd": 0.019556,
            "scr": 0.032633,
            "sdg": 1.06681,
            "sek": 0.020898,
            "sgd": 0.003282,
            "shp": 0.003355,
            "sll": 26.597178,
            "sos": 1.427284,
            "srd": 0.052367,
            "std": 50.412812,
            "svc": 0.021312,
            "syp": 3.06153,
            "szl": 0.036729,
            "thb": 0.079792,
            "theta": 0.000305,
            "tjs": 0.027448,
            "tmt": 0.008525,
            "tnd": 0.006907,
            "top": 0.005459,
            "trx": 0.020945,
            "try": 0.023707,
            "ttd": 0.016554,
            "twd": 0.067589,
            "tzs": 5.601969,
            "uah": 0.063577,
            "ugx": 8.609512,
            "usd": 0.002436,
            "usdt": 0.002433,
            "uyu": 0.106248,
            "uzs": 26.04916,
            "vef": 520813248.043943,
            "vnd": 55.197671,
            "vuv": 0.273514,
            "wst": 0.006277,
            "xaf": 1.379619,
            "xag": 0.0001,
            "xau": 1.0e-6,
            "xcd": 0.006582,
            "xdr": 0.001727,
            "xlm": 0.005884,
            "xof": 1.377349,
            "xpf": 0.251968,
            "xrp": 0.001938,
            "yer": 0.609518,
            "zar": 0.036647,
            "zmk": 21.923674,
            "zmw": 0.04253,
            "zwl": 0.784275
        }
    }
}
```

### Endpoint

## Returns list of all historical rate currencies based on the source currency.

<mark style="color:blue;">`GET`</mark> `https://ipforensics.net/api/v1/currency/historical?apikey=...&source=NGN&date=2021-11-10`

Returns response object and a metadata of the request

#### Query Parameters

| Name                                     | Type   | Description                                                                  |
| ---------------------------------------- | ------ | ---------------------------------------------------------------------------- |
| apikey<mark style="color:red;">\*</mark> | String | Your API key                                                                 |
| source<mark style="color:red;">\*</mark> | String | Specify a Source Currency                                                    |
| date                                     | date   | Specify a date for which to request historical rates. (Format: `YYYY-MM-DD`) |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
    "status": true,
    "code": 200,
    "message": "Successful",
    "meta_data": {
        "currency": "ngn",
        "date": "2021-11-10",
        "exchange_rate": {
            "ada": 0.001055,
            "aed": 0.008947,
            "afn": 0.222495,
            "all": 0.258056,
            "amd": 1.161227,
            "ang": 0.004389,
            "aoa": 1.454077,
            "ars": 0.24374,
            "aud": 0.003302,
            "awg": 0.004385,
            "azn": 0.004133,
            "bam": 0.004114,
            "bbd": 0.004918,
            "bch": 3.0e-6,
            "bdt": 0.20883,
            "bgn": 0.004109,
            "bhd": 0.000918,
            "bif": 4.863971,
            "bmd": 0.002436,
            "bnb": 4.0e-6,
            "bnd": 0.003281,
            "bob": 0.016817,
            "brl": 0.013349,
            "bsd": 0.002436,
            "btc": 0,
            "btn": 0.180204,
            "bwp": 0.027613,
            "byn": 0.005939,
            "byr": 47.738526,
            "bzd": 0.004909,
            "cad": 0.003029,
            "cdf": 4.895635,
            "chf": 0.002219,
            "clf": 7.0e-5,
            "clp": 1.932875,
            "cny": 0.015571,
            "cop": 9.418592,
            "crc": 1.562416,
            "cuc": 0.002436,
            "cup": 0.064544,
            "cve": 0.232408,
            "czk": 0.053035,
            "djf": 0.432861,
            "dkk": 0.015626,
            "doge": 0.008845,
            "dop": 0.13787,
            "dzd": 0.335736,
            "egp": 0.038272,
            "ern": 0.036538,
            "etb": 0.115108,
            "etc": 3.8e-5,
            "eth": 1.0e-6,
            "eur": 0.002101,
            "fjd": 0.005072,
            "fkp": 0.001786,
            "gbp": 0.001796,
            "gel": 0.007673,
            "ggp": 0.001786,
            "ghs": 0.014881,
            "gip": 0.001786,
            "gmd": 0.127019,
            "gnf": 23.272532,
            "gtq": 0.018849,
            "gyd": 0.509315,
            "hkd": 0.018975,
            "hnl": 0.058919,
            "hrk": 0.015792,
            "htg": 0.239989,
            "huf": 0.757849,
            "idr": 34.729656,
            "ils": 0.007569,
            "imp": 0.001786,
            "inr": 0.180664,
            "iqd": 3.556033,
            "irr": 102.881395,
            "isk": 0.315999,
            "jep": 0.001786,
            "jmd": 0.376549,
            "jod": 0.001727,
            "jpy": 0.274962,
            "kes": 0.271939,
            "kgs": 0.206542,
            "khr": 9.92523,
            "kmf": 1.034782,
            "kpw": 2.192074,
            "krw": 2.870352,
            "kwd": 0.000735,
            "kyd": 0.00203,
            "kzt": 1.045908,
            "lak": 25.428072,
            "lbp": 3.712551,
            "link": 7.2e-5,
            "lkr": 0.49075,
            "lrd": 0.357069,
            "lsl": 0.036729,
            "ltc": 9.0e-6,
            "ltl": 0.007192,
            "lvl": 0.001473,
            "lyd": 0.011094,
            "mad": 0.022056,
            "mdl": 0.042743,
            "mga": 9.64513,
            "mkd": 0.129442,
            "mmk": 4.456934,
            "mnt": 6.943823,
            "mop": 0.019543,
            "mro": 0.869523,
            "mur": 0.105223,
            "mvr": 0.037631,
            "mwk": 1.985046,
            "mxn": 0.049502,
            "myr": 0.010112,
            "mzn": 0.155468,
            "nad": 0.03673,
            "ngn": 1,
            "nio": 0.085759,
            "nok": 0.020725,
            "npr": 0.288328,
            "nzd": 0.003416,
            "omr": 0.000938,
            "pab": 0.002436,
            "pen": 0.009781,
            "pgk": 0.008586,
            "php": 0.122226,
            "pkr": 0.417346,
            "pln": 0.009649,
            "pyg": 16.761154,
            "qar": 0.008868,
            "ron": 0.010396,
            "rsd": 0.247071,
            "rub": 0.172322,
            "rwf": 2.447817,
            "sar": 0.009135,
            "sbd": 0.019556,
            "scr": 0.032633,
            "sdg": 1.06681,
            "sek": 0.020898,
            "sgd": 0.003282,
            "shp": 0.003355,
            "sll": 26.597178,
            "sos": 1.427284,
            "srd": 0.052367,
            "std": 50.412812,
            "svc": 0.021312,
            "syp": 3.06153,
            "szl": 0.036729,
            "thb": 0.079792,
            "theta": 0.000305,
            "tjs": 0.027448,
            "tmt": 0.008525,
            "tnd": 0.006907,
            "top": 0.005459,
            "trx": 0.020945,
            "try": 0.023707,
            "ttd": 0.016554,
            "twd": 0.067589,
            "tzs": 5.601969,
            "uah": 0.063577,
            "ugx": 8.609512,
            "usd": 0.002436,
            "usdt": 0.002433,
            "uyu": 0.106248,
            "uzs": 26.04916,
            "vef": 520813248.043943,
            "vnd": 55.197671,
            "vuv": 0.273514,
            "wst": 0.006277,
            "xaf": 1.379619,
            "xag": 0.0001,
            "xau": 1.0e-6,
            "xcd": 0.006582,
            "xdr": 0.001727,
            "xlm": 0.005884,
            "xof": 1.377349,
            "xpf": 0.251968,
            "xrp": 0.001938,
            "yer": 0.609518,
            "zar": 0.036647,
            "zmk": 21.923674,
            "zmw": 0.04253,
            "zwl": 0.784275
        }
    }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ipforensics.gitbook.io/ipforensics/api/exchange-rate-api/historical-rate-endpoint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
