# Historical Rates

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

Historical rates may be accessed by simply attaching the `date` parameter with a valid date (Format: `YYYY-MM-DD`) to the API's `historical` endpoint.

<mark style="color:blue;">`GET`</mark> `https://api.curexapi.com/historical`

**Request Parameters**

<table><thead><tr><th width="166">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>access_key</td><td>string</td><td>Your access key</td></tr><tr><td>date</td><td>string</td><td>Date format: YYYY-MM-DD</td></tr><tr><td>source</td><td>string</td><td>Source currency code<br><em>(optional) (default:USD)</em></td></tr><tr><td>currencies</td><td>string</td><td>Target currency codes<br>(optional)</td></tr></tbody></table>

**Sample Requests**

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location 'https://api.curexapi.com/historical?access_key=YOUR_ACCESS_KEY&date=2023-01-01&source=USD&currencies=EUR%2CGBP'
```

{% endtab %}

{% tab title="Javascript" %}

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

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://api.curexapi.com/historical?access_key=YOUR_ACCESS_KEY&date=2023-01-01&source=USD&currencies=EUR,GBP',
  headers: { }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.curexapi.com/historical?access_key=YOUR_ACCESS_KEY&date=2023-01-01&source=USD&currencies=EUR%2CGBP',
  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="Python" %}

```python
import requests

url = "https://api.curexapi.com/historical?access_key=YOUR_ACCESS_KEY&date=2023-01-01&source=USD&currencies=EUR,GBP"

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

print(response.text)
```

{% endtab %}
{% endtabs %}

**Sample Response**

```json
{
    "success": true,
    "timestamp": 1672531200,
    "source": "USD",
    "date": "2023-01-01",
    "rates": {
        "EUR": 0.932,
        "GBP": 0.827
    }
}
```


---

# 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://docs.curexapi.com/api-reference/historical-rates.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.
