# Historical Data

## Get historical data in JSON format

<mark style="color:blue;">`GET`</mark> `https://<host>/api/historical-data/json`

Note: You must ensure that your tag names are URL encoded before being sent. For example, a space character would be replaced by the character sequence `%20`.

#### Query Parameters

| Name                                        | Type      | Description                                                                                                                                                                                                                                                                                                                      |
| ------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tags<mark style="color:red;">\*</mark>      | string\[] | tags to get data for. You can pass multiple, e.g. \`?tags=temperature\&tags=pressure                                                                                                                                                                                                                                             |
| beginTime<mark style="color:red;">\*</mark> | number    | beginning of requested time range, milliseconds since Jan 1 1970 UTC                                                                                                                                                                                                                                                             |
| endTime<mark style="color:red;">\*</mark>   | number    | end of requested time range, milliseconds since Jan 1 1970 UTC                                                                                                                                                                                                                                                                   |
| interval                                    | number    | requested time interval between data points, in milliseconds. If none is given, raw full-resolution data is returned                                                                                                                                                                                                             |
| includeAverage                              | boolean   | defaults to `true`; whether to include the average value in each time range (`v` arrays in response)                                                                                                                                                                                                                             |
| includeMin                                  | boolean   | whether to include the minimum value in each time interval (`min` property)                                                                                                                                                                                                                                                      |
| includeMax                                  | string    | whether to include the minimum value in each time interval (`max` property)                                                                                                                                                                                                                                                      |
| lookbackMode                                | string    | `none`, `actual` or `normalized`. Defaults to `none` if `interval` is not given, `normalized` otherwise. `actual` will include the last raw point within timeout range before `beginTime`, if any; `normalized` will add a point at `beginTime` with the value of the last point within timeout range before `beginTime`, if any |

#### Headers

| Name                                            | Type   | Description          |
| ----------------------------------------------- | ------ | -------------------- |
| Authorization<mark style="color:red;">\*</mark> | string | `bearer <api token>` |

{% tabs %} {% tab title="200: OK expand to see response fields" %}

\`

\`\`json5 { data: { temperature: { t: \[1640113400000, 1640113410000, 1640113420000], v: \[76.3, 78.2, 79.1], // "min": \[...], // will be included if includeMin=true // "max": \[...], // will be included if includeMax = true // "aggregatedValues: \[...], // may be included for enum tags }, pressure: { t: \[1640113400000, 1640113410000, 1640113420000], v: \[29.3, 29.8, 30.1], // "min": \[...], // will be included if includeMin=true // "max": \[...], // will be included if includeMax = true // "aggregatedValues: \[...], // may be included for enum tags }, }, }

````

</div>

<div data-gb-custom-block data-tag="tab" data-title='400: Bad Request If any request parameters are invalid'>

```javascript
{
  // Response
}
````

```javascript
{
  // Response
}
```

```javascript
{
  // Response
}
```

```javascript
{
  // Response
}
```

```javascript
{
  // Response
}
```


---

# 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.jcore.io/clarity/api/historical-data.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.
