---
title: "Statistics by interval (moved to /statistics/interval)"
method: GET
path: "/queries/statistics"
tags: ["Queries / Statistics"]
---

# Statistics by interval (moved to /statistics/interval)

`GET /queries/statistics`

This endpoint returns statistics calculated based on the data available for a specific time period. The data is aggregated according to the time interval specified in your request, allowing you to see trends and patterns over time. 

<Note>
Refer to the different statistics types in the [Statistics Types](/technical-references/statistics_matrix) section for more information on how the data is aggregated for each type.
</Note>

#### Coordinated Universal Time

The `/statistics/interval` endpoint uses Coordinated Universal Time (UTC) for all its calculations. This standardization ensures that data is consistent and comparable across different time zones. By using UTC, the API provides a global view of the data, which is crucial for applications that require a uniform time reference. This approach contrasts with the `/statistics/daily` endpoint, which uses the user's local timezone for calculations, offering a more personalized view.

#### Selection of Provider Source
Within a single statistics interval there can be data aggregated from one provider source only.

## Query parameters

- `from_timestamp` string, date-time — Start time of the query range in UTC
- `to_timestamp` string, date-time — End time of the query range in UTC
- `interval` 'fifteen_minute' | 'thirty_minute' | 'hour' | 'day', required — Interval of the query
- `exclude_manual` boolean — Exclude manual metrics from the statistics
- `types` string[], required
- `providers` string[]
- `include_record_ids` boolean — Whether to include the record IDs in the response
- `device_types` string[] — Device types to include in the statistics

## Response `200`

OK

- StatisticsIntervalQueryOutput
  - `from_timestamp` string, date-time, required
  - `statistics` StatisticsIntervalQueryOutputValue[], nullable, required
    - `from_timestamp` string, date-time
    - `record_ids` string[], nullable
    - `to_timestamp` string, date-time
    - `values` object, required — Statistics values
      - `activity_score` number — activity_score in count
      - `calories_burned_active` number — calories_burned_active in kcal
      - `calories_burned_basal` number — calories_burned_basal in kcal
      - `calories_burned_total` number — calories_burned_total in kcal
      - `distance_cycling` number — distance_cycling in meters
      - `distance_running` number — distance_running in meters
      - `distance_total` number — distance_total in meters
      - `distance_walking` number — distance_walking in meters
      - `duration_high_intensity` number — duration_high_intensity in ms
      - `duration_low_intensity` number — duration_low_intensity in ms
      - `duration_moderate_intensity` number — duration_moderate_intensity in ms
      - `heartrate` number — heartrate in bpm
      - `heartrate_max` number — heartrate_max in bpm
      - `heartrate_min` number — heartrate_min in bpm
      - `heartrate_resting` number — heartrate_resting in bpm
      - `hrv_rmssd` number — hrv_rmssd in ms
      - `hrv_sdnn` number — hrv_sdnn in ms
      - `recovery_score` number — recovery_score in count
      - `sleep_duration_total` number — sleep_duration_total in ms
      - `sleep_score` number — sleep_score in count
      - `sleep_skin_temperature_deviation` number — sleep_skin_temperature_deviation in celsius
      - `steps` number — steps in count
      - `stress_score` number — stress_score in count
  - `to_timestamp` string, date-time, required

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `422` — Unprocessable Entity
- `500` — Internal Server Error

---

[API](https://skmtc.dev/spikeapi/apis/application-user-api.md) · [All operations](https://skmtc.dev/spikeapi/apis/application-user-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/spikeapi/application-user-api/revisions/637338fb0c9d/schema)
