---
title: "Fetches an analytics report over a custom date range"
method: POST
path: "/v2/sites/{site_id}/analytics/queries/"
tags: ["analytics"]
---

# Fetches an analytics report over a custom date range

`POST /v2/sites/{site_id}/analytics/queries/`

## Request

- Base URL: `https://api.jwplayer.com`
- URL: `https://api.jwplayer.com/v2/sites/{site_id}/analytics/queries/`
- Auth: API key in header `Authorization`

Fetches an analytics report over a custom date range

## Path parameters

- `site_id` string, required: Unique identifier for a resource

## Query parameters

- `source` 'default' | 'ott'
- `format` 'json' | 'csv'

## Request body

- ReportQueryRequest
  - `dimensions` string[]: Dimensions to include in the report query response
  - `end_date` string, required: Last date of a query date range in `YYYY-MM-DD` format This date is based on UTC -4/ UTC -5. Time zone is affected by whether daylight saving time or standard time is in effect.
  - `filter` ReportRequestFilters[]: Defines how to restrict the data returned in the response
    - `field` string, required: Dimension `dimension_id` by which to restrict the returned data set When filtering JWX Data, all `dimension_id` variables can be used. When filtering OTT Data, only the following `dimension_id` variables can be used: - `country_code` - `eastern_date` - `media_id` - `platform_id` - `playlist_id` - `playlist_type` - `tag` - `upload_date` - `video_duration`
    - `operator` '=' | '!=' | 'LIKE' | '!LIKE', required: Filter-matching behavior Possible values include the following: - `=`: Use this operator when the value is an ID. - `!=`: Use this operator when the value is an ID. - `LIKE`: Use this operator when the value is metadata information. - `!LIKE`: Use this operator when the value is metadata information.
    - `value` string[], required: Value of specific dimension by which to restrict the returned data set
  - `include_metadata` integer: Indicates that eligible dimensions are enriched with additional metadata Depending on the dimension, enriched metadata appears either in the `includes` or `metadata.name` object of the query response. This feature requires an Enterprise account. **Possible Values**: - `0`: Do not include enriched metadata - `1`: Include enriched metadata Default: `0`
  - `metrics` ReportRequestMetrics[], required: Metrics to include in the report query response
    - `field` string, required: Metric to include in the report query response
    - `operation` 'max' | 'min' | 'sum', required: Calculation applied to selected metric
  - `page` integer: Index of the page of results The value of the first page of results is `0`. The number of total pages is inversely related to the `page_length`.
  - `page_length` integer: (JSON only) Total number of records returned on each page of results If not set, the default value is `10`. This value must be ≤ 100.
  - `relative_timeframe` '7 Days' | '30 Days' | '90 Days' | 'Last Quarter' | 'Month To Date' | 'Today' | 'Yesterday': Preconfigured time range for a report query
  - `sort` ReportRequestSorts[]: Defines the field by which to sort the data and the order of the sort
    - `field` string, required: Metric or dimension by which the response query is organized The metric or dimension must be one of the metrics and dimensions included in the report query body.
    - `operation` 'max' | 'min' | 'sum': Operation to be applied to the data being sorted **Default**: `sum`
    - `order` 'ASCENDING' | 'DESCENDING', required: Manner in which response query is organized
  - `start_date` string, required: First date of a query date range in `YYYY-MM-DD` format This date is based on UTC -4/ UTC -5. Time zone is affected by whether daylight saving time or standard time is in effect.

## Response `200`

Resources successfully retrieved

- ReportQueryResponse
  - `data` ReportDataFields
    - `rows` unknown[]: Individual result with values for each `metadata.column_headers` property
      - unknown
  - `metadata` ReportMetadataFields
    - `column_headers` ReportColumnHeaders
      - `dimensions` ReportColumnHeadersDimensions[]: Set of objects for each dimension included in the report query
        - `display` string: Human-readable name of the dimension
        - `field` string: The `dimension_id` value
        - `type` string: Format of the data that is returned
      - `metrics` ReportColumnHeadersMetrics[]: Set of objects for each metric included in the report query
        - `display` string: Human-readable name of the metric
        - `field` string: The `metric_id` value
        - `units` string: Format of the data that is returned
    - `name` ReportMetadataName
      - `city` object: When `include_metadata: 1` and `dimensions: ["city"]` are part of the API query, an object of identifier-to-name pairings **Example**: `"city": {"Brussels BRU BE": "Brussels - Brussels Capital (Belgium)"}`
      - `country_code` object: When `include_metadata: 1` and `dimensions: ["country_code"]` are part of the API query, an object of identifier-to-name pairings **Example**: `"country_code": {"HU": "Hungary", "NL": "Netherlands"}`
      - `device_id` object: When `include_metadata: 1` and `dimensions: ["device_id"]` are part of the API query, an object of identifier-to-name pairings **Example**: `"device_id": {"Desktop": "Desktop", "Phone": "Phone"}`
      - `platform_id` object: When `include_metadata: 1` and `dimensions: ["platform_id"]` are part of the API query, an object of identifier-to-name pairings **Example**: `"platform_id": {"web": "Web"}`
    - `end_date` string: Last date of a query date range in `YYYY-MM-DD` format
    - `start_date` string: First date of a query date range in `YYYY-MM-DD` format
  - `page` integer: Index of the page of results The value of the first page of results is `0`. The number of total pages is inversely related to the `page_length`.
  - `page_length` integer: (JSON only) Total number of records returned on each page of results If not set, the default value is `10`. This value must be ≤ 100.
  - `type` string
  - `includes` ReportIncludes
    - `(object_id)` object: Unique identifier for one of the following returned types: - `ad_schedule_id` - `media_id` - `playlist_id` - `player_id`
      - `(metadata)` string: Object of identifier-to-name pairings based upon the dimension included with `include_metadata: 1` in the request Identifier-to-name pairing by dimension: - `dimensions: ["ad_schedule_id"]`: Object includes: - `name`: User-generated name of the ad schedule - `dimensions: ["media_id"]`: Object includes: - `duration_bucket`: Categorization of video duration - `tags`: Metadata tags associated with the media item - `title`: Name of the media item - `upload_date`: Date when the media item was uploaded in `YYYY-MM-DD` format - `dimensions: ["player_id"]`: Object includes: - `name`: User-generated name of the player - `dimensions: ["playlist_id"]`: Object includes: - `title`: Name of the media item - `type`: Type of playlist
    - `type` string: Dimension to which the unique ID belongs Possible values include: - `ad_schedule_id` - `media_id` - `player_id` - `playlist_id`

## Changes

- **2026-11-03** `9fad6bd5872e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/jwplayer/apis/management-api-v2/changes/v2/sites/:site_id/analytics/queries/post.md)

---

[API](https://skmtc.dev/jwplayer/apis/management-api-v2.md) - [All operations](https://skmtc.dev/jwplayer/apis/management-api-v2/llms.txt) - [OpenAPI document](https://skmtc.dev/jwplayer/apis/management-api-v2/revisions/9fad6bd5872e?raw)
