---
title: "Gets time-series play statistics aggregated by interval."
method: GET
path: "/adhawk/playstatsbytime"
tags: ["AdHawk"]
---

# Gets time-series play statistics aggregated by interval.

`GET /adhawk/playstatsbytime`

## Request

- Base URL: `https://api.reveldigital.com`
- URL: `https://api.reveldigital.com/adhawk/playstatsbytime`
- Auth: one of:
  - OAuth 2
    - Authorization code: `https://id.reveldigital.com/connect/authorize`
    - Token URL: `https://id.reveldigital.com/connect/token` scopes: `webapi`
  - API key in header `X-RevelDigital-ApiKey`
  - API key in query parameter `api_key`
- TypeScript: <https://skmtc.dev/reveldigital/apis/revel-digital-rest-api/docs/adhawk/playstatsbytime/get.ts> (a function with typed inputs; its response is checked against the schema)

## Query parameters

- `startDate` string, date-time
- `endDate` string, date-time
- `deviceId` string[]
- `fileId` string[]
- `interval` 'Minute' | 'Hour' | 'Day' | 'Week' | 'Month'
- `groupByDevice` boolean
- `groupByFile` boolean
- `limit` integer

## Response `200`

OK

- AdHawkPlayStatsByTime[]
  - `device_id` string, nullable: Optional device ID (null if aggregated across all devices)
  - `device_name` string, nullable: Optional device name
  - `file_id` string, nullable: Optional file ID (null if aggregated across all files)
  - `file_name` string, nullable: Optional file name
  - `period_start` string, date-time: Start of the time period for these stats
  - `period_end` string, date-time: End of the time period for these stats
  - `total_plays` integer: Total number of plays during this period
  - `total_duration` integer: Total duration of all plays in seconds
  - `avg_duration` number, double, nullable: Average play duration in seconds
  - `device_count` integer, nullable: Number of unique devices (if aggregated by file)
  - `file_count` integer, nullable: Number of unique files (if aggregated by device)

---

[API](https://skmtc.dev/reveldigital/apis/revel-digital-rest-api.md) - [All operations](https://skmtc.dev/reveldigital/apis/revel-digital-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/reveldigital/apis/revel-digital-rest-api/revisions/39d5c8302822?raw)
