---
metadata:
  - name: generator
    content: Diplodoc Platform v5.54.1
alternate:
  - https://yandex.ru/dev/metrika/en/stat/openapi/bytime.md
  - https://yandex.ru/dev/metrika/ru/stat/openapi/bytime.md
  - href: ru/stat/openapi/bytime.md
    type: text/markdown
    title: Markdown version
  - href: ../../llms.txt
    type: text/markdown
    title: llms.txt
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.ru/dev/metrika/ru/llms.txt

<div class="openapi">

# Получение данных по времени

<!-- markdownlint-disable-file -->

Позволяет получить данные с разбивкой по времени (например, по дням, неделям, месяцам). Используйте данный тип запроса для построения графиков и отслеживания динамики.
Посмотрите как используется данный запрос в [примере](https://yandex.ru/dev/metrika/ru/stat/examples.md#query).

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-get);margin-bottom: 12px">

<div class="openapi__request">

GET {.openapi__method}
```text translate=no
https://api-metrika.yandex.net/stat/v1/data/bytime
```

</div>

</div>

</div>

### Query parameters

#|
|| **Name** | **Description** ||
||

_ids_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: integer[]

Идентификаторы счетчиков, через запятую.

_Example:_{.json-schema-reset .json-schema-example} `44147844,2215573`
{.table-cell}
||
||

_metrics_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Список метрик, разделенных запятой.
Лимит: 20 метрик в запросе.

_Example:_{.json-schema-reset .json-schema-example} `ym:s:pageviews`
{.table-cell}
||
||

_accuracy_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Размер выборки, используемой для отчета. Позволяет управлять [семплированием](https://yandex.ru/dev/metrika/ru/stat/sampling.md) (количеством визитов, использованных при расчете итогового значения).

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_annotation_groups_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string[]

Группы примечаний, разделенные запятой, которые должны вернуться в ответе.
Передается, если параметр `include_annotations` принимает значение `true`
Если параметр `annotation_groups` не указан, в ответе вернутся все примечания, созданные для счетчика.

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_callback_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Функция обратного вызова, которая обрабатывает ответ API.

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_date1_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Дата начала периода выборки в формате YYYY-MM-DD. Также используйте значения: `today`, `yesterday`, `ndaysAgo`.

_Default:_{.json-schema-reset .json-schema-value} `6daysAgo`

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_date2_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Дата окончания периода выборки в формате YYYY-MM-DD. Также используйте значения: `today`, `yesterday`, `ndaysAgo`.

_Default:_{.json-schema-reset .json-schema-value} `today`

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_dimensions_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Список группировок, разделенных запятой.
Лимит: 10 группировок в запросе.

_Example:_{.json-schema-reset .json-schema-example} `ym:s:trafficSource`
{.table-cell}
||
||

_direct_client_logins_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string[]

Логины клиентов Яндекс Директа, через запятую. Могут использоваться для формирования отчета [Директ-расходы](https://yandex.ru/dev/metrika/ru/stat/direct-clicks.md).

_Example:_{.json-schema-reset .json-schema-example} `login1,login2`
{.table-cell}
||
||

_filters_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Фильтр [сегментации](https://yandex.ru/dev/metrika/ru/stat/segmentation.md).
Лимит: количество уникальных группировок и метрик — до 10, количество отдельных фильтров — до 20, длина строки в фильтре — до 10 000 символов; количество значений в одном условии фильтрации — 100.

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_group_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Группировка данных по времени:
- `all` — временной интервал не разбивается;
- `auto` — интервал устанавливается с учетом выбранного отчетного периода и количества данных, достаточного для этого периода;
- `minutes` — временной интервал разбивается на интервалы из некоторого количества минут. Возможные интервалы minutes: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60, 120, 180, 240, 360, 480, 720, 1440. Расчеты оптимизированы так, чтобы между точками на графике не было больше одного интервала, с лимитом в 1600 точек для минут;
- `dekaminute` — временной интервал разбивается на 10-минутные интервалы;
- `minute` — временной интервал разбивается на минутные интервалы;
- `hour` — временной интервал разбивается на часовые интервалы;
- `hours` — временной интервал разбивается на интервалы из нескольких часов. Возможные интервалы hours: 1, 2, 3, 4, 6, 8, 12, 24. Расчеты оптимизированы так, чтобы между точками на графике не было больше одного интервала, с лимитом в 30 точек для часов;
- `day` — временной интервал разбивается по дням;
- `week` — временной интервал разбивается по неделям;
- `month` — временной интервал разбивается по месяцам;
- `quarter` — временной интервал разбивается по кварталам;
- `year` — временной интервал разбивается по годам.


_Default:_{.json-schema-reset .json-schema-value} `week`

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_include_annotations_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Признак включения в ответ примечания. По умолчанию выключено.

_Default:_{.json-schema-reset .json-schema-value} `false`

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_include_undefined_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Включает в ответ строки, для которых значения группировок не определены. Влияет только на первую группировку. По умолчанию выключено.
{.table-cell}
||
||

_keys_sort_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Список группировок и метрик, разделенных запятой, по которым осуществляется сортировка. По умолчанию сортировка производится по убыванию (указан знак `-` перед группировкой или метрикой). Чтобы отсортировать данные по возрастанию, удалите знак `-`.

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_lang_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Язык.

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_preset_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

[Шаблон отчета](https://yandex.ru/dev/metrika/ru/stat/presets.md).

_Example:_{.json-schema-reset .json-schema-example} `sources_summary`
{.table-cell}
||
||

_pretty_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Задает форматирование результата. Чтобы использовать форматирование, укажите значение `true`.

_Default:_{.json-schema-reset .json-schema-value} `false`

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_proposed_accuracy_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Если параметр выставлен в `true`, API имеет право автоматически увеличивать accuracy до рекомендованного значения.Когда идет запрос в маленькую таблицу с очень маленьким семплингом, параметр поможет получить осмысленные результаты.
{.table-cell}
||
||

_row_ids_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string[][]

Выбор строк для построения графиков. Содержит перечисление списков ключей.

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
||

_timezone_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Часовой пояс в формате ±hh:mm в диапазоне [-23:59; +23:59] (знак плюса нужно передавать как `%2B`),
в котором будут рассчитан период выборки запроса, а также связанные с датой и временем группировки.
По умолчанию используется часовой пояс счетчика.

_Example:_{.json-schema-reset .json-schema-example} `+03:00`
{.table-cell}
||
||

_top_keys_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Задает количество строк результата, если не указан параметр `row_ids`. Максимальное количество строк: 30.

_Default:_{.json-schema-reset .json-schema-value} `7`

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
|#{.json-schema-properties}

## Responses

<div class="openapi__response__code__200">

## 200 OK

OK

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "query": {
    "timezone": "example",
    "preset": "example",
    "dimensions": [
      "example"
    ],
    "metrics": [
      "example"
    ],
    "sort": [
      "example"
    ],
    "date1": "example",
    "date2": "example",
    "filters": "example"
  },
  "data": [
    {
      "dimensions": [
        {}
      ],
      "metrics": [
        [
          0.5
        ]
      ]
    }
  ],
  "total_rows": 0,
  "total_rows_rounded": true,
  "sampled": true,
  "contains_sensitive_data": true,
  "sample_share": 0.5,
  "sample_size": 0,
  "sample_space": 0,
  "data_lag": 0,
  "totals": [
    [
      0.5
    ]
  ],
  "annotations": [
    [
      {
        "id": 0,
        "date": "2025-01-01",
        "time": "12:00:00",
        "title": "example",
        "message": "example",
        "group": "example"
      }
    ]
  ]
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_annotations_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [ConstructorReportChartAnnotation](#entity-ConstructorReportChartAnnotation)[][]

Примечания.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  [
    {
      "id": 0,
      "date": "2025-01-01",
      "time": "12:00:00",
      "title": "example",
      "message": "example",
      "group": "example"
    }
  ]
]
```

{% endcut %}
{.table-cell}
||
||

_contains_sensitive_data_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Признак возможного отсутствия [конфиденциальных данных](https://yandex.ru/support/metrica/reports/report-general.html#privacy) в ответе. К ним относятся данные, которые рассчитываются алгоритмами Яндекса, например, социально-демографические (пол, возраст и др.), адреса страниц входа, поисковые фразы, информация о роботах. При значении `true` в ответе не отобразятся такие данные, если выборка составляет меньше 10 посетителей.
Возможные значения: `true`, `false`.
{.table-cell}
||
||

_data_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [DynamicRow](#entity-DynamicRow)[]

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  {
    "dimensions": [
      {}
    ],
    "metrics": [
      [
        0.5
      ]
    ]
  }
]
```

{% endcut %}
{.table-cell}
||
||

_data_lag_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Задержка в обновлении данных, в секундах.
{.table-cell}
||
||

_query_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: [DynamicQueryExternal](#entity-DynamicQueryExternal)

Исходный запрос. Содержит параметры запроса, включая развернутые параметры из шаблона и параметры для схемы параметризации атрибутов.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "timezone": "example",
  "preset": "example",
  "dimensions": [
    "example"
  ],
  "metrics": [
    "example"
  ],
  "sort": [
    "example"
  ],
  "date1": "example",
  "date2": "example",
  "filters": "example"
}
```

{% endcut %}
{.table-cell}
||
||

_sample_share_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: number

Доля данных, по которым осуществлялся расчет. Доступно значение в пределах от 0 до 1.
{.table-cell}
||
||

_sample_size_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Количество строк в выборке данных.
{.table-cell}
||
||

_sample_space_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Количество строк данных.
{.table-cell}
||
||

_sampled_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Признак семплирования. Показывает, был ли применен семплинг. Возможные значения: `true`, `false`.
{.table-cell}
||
||

_total_rows_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Общее количество строк в ответе по всему множеству данных (с учетом фильтра).
{.table-cell}
||
||

_total_rows_rounded_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: boolean

Признак того, что общее количество строк было округлено.
{.table-cell}
||
||

_totals_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: number[][]

Общие результаты для метрик по всему множеству данных (с учетом фильтра).

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  [
    0.5
  ]
]
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### DynamicQueryExternal {#entity-DynamicQueryExternal}

Исходный запрос. Содержит параметры запроса, включая развернутые параметры из шаблона и параметры для схемы параметризации атрибутов.

#|
|| **Name** | **Description** ||
||

_date1_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Дата начала периода выборки в формате YYYY-MM-DD.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_date2_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Дата окончания периода выборки в формате YYYY-MM-DD.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_dimensions_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string[]

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  "example"
]
```

{% endcut %}
{.table-cell}
||
||

_filters_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Фильтр сегментации.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_metrics_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string[]

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  "example"
]
```

{% endcut %}
{.table-cell}
||
||

_preset_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Пресет отчета.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_sort_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string[]

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  "example"
]
```

{% endcut %}
{.table-cell}
||
||

_timezone_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Часовой пояс периода выборки в формате ±hh:mm.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "timezone": "example",
  "preset": "example",
  "dimensions": [
    "example"
  ],
  "metrics": [
    "example"
  ],
  "sort": [
    "example"
  ],
  "date1": "example",
  "date2": "example",
  "filters": "example"
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### DynamicRow {#entity-DynamicRow}

Строки ответа. Представляет собой массив, каждый элемент которого — одна строка результата.

#|
|| **Name** | **Description** ||
||

_dimensions_{.json-schema-reset .json-schema-property}
{.table-cell}|
{% cut "**Type**: object[]" %}

#|
||

_[additional]_{.json-schema-reset .json-schema-additional-property}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% endcut %}

Массив значений группировок для данной строки. Каждое из значений группировки представляет собой объект. В нем обязательно присутствует поле `name` — текстовое значение, но могут присутствовать дополнительные поля, например идентификатор — `id`.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  {}
]
```

{% endcut %}
{.table-cell}
||
||

_metrics_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: number[][]

Массив массивов значений метрик для данной строки. Внешний массив перечисляет метрики, внутренние массивы — значения конкретной метрики для каждой временной группы.

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
[
  [
    0.5
  ]
]
```

{% endcut %}
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "dimensions": [
    {}
  ],
  "metrics": [
    [
      0.5
    ]
  ]
}
```

{% endcut %}

</div>

<div class="openapi-entity">

### ConstructorReportChartAnnotation {#entity-ConstructorReportChartAnnotation}

#|
|| **Name** | **Description** ||
||

_date_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;date&gt;

Дата.

_Example:_{.json-schema-reset .json-schema-example} `2025-01-01`
{.table-cell}
||
||

_group_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Группа:
- `A` — группа A.
- `B` — группа B.
- `C` — группа C.
- `D` — группа D.
- `E` — группа E.
- `HOLIDAY` — государственные праздники. Отображаются, если Яндекс Метрике удалось определить регион счетчика.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_id_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: integer

Идентификатор примечания.
{.table-cell}
||
||

_message_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Описание.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_time_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string&lt;time&gt;

Время.

_Example:_{.json-schema-reset .json-schema-example} `12:00:00`
{.table-cell}
||
||

_title_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Заголовок.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

{% cut "**Example**" %}{.json-schema-example}

```json translate=no
{
  "id": 0,
  "date": "2025-01-01",
  "time": "12:00:00",
  "title": "example",
  "message": "example",
  "group": "example"
}
```

{% endcut %}

</div>

</div>

</div>

[*Deprecated]: No longer supported, please use an alternative and newer version.