---
title: Event archives
method: GET
weight: 1
section: 'Basics'
---

import {
  EndpointHeader,
  ParamField,
  ParamFields,
  CodeGroup,
  RequestExample,
  ResponseExample,
} from '@/components/api';
import Alert from '@/components/docs/Alert.astro';

<EndpointHeader method="GET" path="/api/v1/channel_data" />

Returns the event archive for a metering device. It uses the same `channel_data` endpoint as readings, but with an event-type `archive_type`; the response contains event/message records (codes and descriptions) instead of numeric channels.

<ParamFields title="Query parameters">
  <ParamField name="archive_type" type="string" required>
    Event archive type. One of: `nesht`, `nesht_svod`, `changes`, `event`, `alarm`, `valve`,
    `seance`.
  </ParamField>
  <ParamField name="equipment_id" type="integer" required>
    Metering device identifier. Alternatively, the pair `energy_varname` + `uid` can be passed.
  </ParamField>
  <ParamField name="fp_start" type="string">
    Time interval (segment start), `yyyy-mm-dd`. Optional.
  </ParamField>
  <ParamField name="fp_end" type="string">
    Time interval (segment end), `yyyy-mm-dd`. Optional.
  </ParamField>
  <ParamField name="page" type="integer">
    Page number.
  </ParamField>
  <ParamField name="per_page" type="integer">
    Page size. Optional. Defaults to 10 for event archives.
  </ParamField>
</ParamFields>

## Response fields

| Attribute             | Description                                                                                                                |
| --------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| `data[].event_time`   | Unix time of the event (seconds; milliseconds are appended as a fractional part)                                           |
| `data[].channel_data` | Array of single-key `{ varname: value }` objects. `*Description` fields are enriched with texts from the message reference |
| `total_pages`         | Total number of pages in the returned set                                                                                  |
| `current_page`        | Current page                                                                                                               |
| `next_page`           | Next page available for downloading, `null` if the current page is the last one                                            |

<Alert type="info">
  All event archive types — `nesht`, `nesht_svod`, `changes`, `event`, `alarm`, `valve`, `seance` —
  are handled the same way; only the set of channels and message codes differs. The time interval is
  interpreted in the time zone of the metering unit's station; if the station has no time zone, the
  request returns `404`.
</Alert>

<RequestExample>
  <CodeGroup labels={["curl", "Node", "Python", "Go", "PHP"]}>
    <Fragment slot="panel-0">

```bash
curl -i \
  --header "access-token: *********************" \
  --header "token-type: Bearer" \
  --header "client: **********************" \
  --header "uid: user@local.net" \
  --header "Content-Type: application/json" \
  --request GET \
  "https://uztgs.uz/api/v1/channel_data?archive_type=nesht&equipment_id=906&fp_start=2025-05-01&fp_end=2026-05-29&page=1"
```

    </Fragment>
    <Fragment slot="panel-1">

```js
const res = await fetch(
  'https://uztgs.uz/api/v1/channel_data?archive_type=nesht&equipment_id=906&fp_start=2025-05-01&fp_end=2026-05-29&page=1',
  {
    headers: {
      'access-token': '*********************',
      'token-type': 'Bearer',
      client: '**********************',
      uid: 'user@local.net',
      'Content-Type': 'application/json',
    },
  },
);
const data = await res.json();
```

    </Fragment>
    <Fragment slot="panel-2">

```python
import requests

res = requests.get(
    "https://uztgs.uz/api/v1/channel_data",
    params={
        "archive_type": "nesht",
        "equipment_id": 906,
        "fp_start": "2025-05-01",
        "fp_end": "2026-05-29",
        "page": 1,
    },
    headers={
        "access-token": "*********************",
        "token-type": "Bearer",
        "client": "**********************",
        "uid": "user@local.net",
        "Content-Type": "application/json",
    },
)
data = res.json()
```

    </Fragment>
    <Fragment slot="panel-3">

```go
req, _ := http.NewRequest("GET", "https://uztgs.uz/api/v1/channel_data?archive_type=nesht&equipment_id=906&fp_start=2025-05-01&fp_end=2026-05-29&page=1", nil)
req.Header.Set("access-token", "*********************")
req.Header.Set("token-type", "Bearer")
req.Header.Set("client", "**********************")
req.Header.Set("uid", "user@local.net")
req.Header.Set("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)
```

    </Fragment>
    <Fragment slot="panel-4">

```php
$ch = curl_init("https://uztgs.uz/api/v1/channel_data?archive_type=nesht&equipment_id=906&fp_start=2025-05-01&fp_end=2026-05-29&page=1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "access-token: *********************",
    "token-type: Bearer",
    "client: **********************",
    "uid: user@local.net",
    "Content-Type: application/json",
]);
$data = json_decode(curl_exec($ch), true);
```

    </Fragment>

  </CodeGroup>
</RequestExample>

<ResponseExample>

```json
{
  "data": [
    {
      "event_time": 1748476800.123,
      "channel_data": [
        { "Code": "1" },
        { "CodeDescription": "Emergency situation: connection loss" },
        { "ValCode": "23.6" },
        { "Izm": "0" }
      ]
    }
  ],
  "total_pages": 5,
  "current_page": 1,
  "next_page": 2
}
```

</ResponseExample>
