> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bunny.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Video Statistics

> Returns time-series views and watch time, plus country-level aggregates, at the library level or for a specific video. Control the time window with dateFrom/dateTo and the granularity with hourly. Basic safeguards prevent spam and bot inflation by de-duplicating sessions and ignoring obviously invalid events.



## OpenAPI

````yaml https://video.bunnycdn.com/openapi/bunnynet-video-api.public.json get /library/{libraryId}/statistics
openapi: 3.0.0
info:
  title: Stream API
  termsOfService: https://bunny.net/tos
  contact:
    name: bunny.net
    url: https://docs.bunny.net
    email: support@bunny.net
  version: 1.5.6
servers:
  - url: https://video.bunnycdn.com
security: []
tags:
  - name: Manage Collections
  - name: Manage Videos
paths:
  /library/{libraryId}/statistics:
    get:
      tags:
        - Manage Videos
      summary: Get Video Statistics
      description: >-
        Returns time-series views and watch time, plus country-level aggregates,
        at the library level or for a specific video. Control the time window
        with dateFrom/dateTo and the granularity with hourly. Basic safeguards
        prevent spam and bot inflation by de-duplicating sessions and ignoring
        obviously invalid events.
      operationId: Video_GetVideoStatistics
      parameters:
        - name: libraryId
          in: path
          required: true
          schema:
            type: integer
            format: int64
          x-position: 1
        - name: dateFrom
          in: query
          description: >-
            Optional start of the time range (UTC). If omitted or invalid, the
            last 30 days are returned.
          schema:
            type: string
            format: date-time
            nullable: true
          x-position: 2
        - name: dateTo
          in: query
          description: >-
            Optional end of the time range (UTC). If omitted with a valid start,
            defaults to now; otherwise the last 30 days are returned.
          schema:
            type: string
            format: date-time
            nullable: true
          x-position: 3
        - name: hourly
          in: query
          description: >-
            Optional. If true, returns hourly data; otherwise daily (UTC).
            Default is daily.
          schema:
            type: boolean
            default: false
          x-position: 4
        - name: videoGuid
          in: query
          description: >-
            Optional video GUID to filter results. When omitted, returns
            library-level aggregates.
          schema:
            type: string
            nullable: true
          x-position: 5
      responses:
        '200':
          description: >-
            Statistics including time-series views and watch time, country
            breakdowns, and engagement score when available.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoStatisticsModel'
        '401':
          description: The request authentication failed
        '404':
          description: Video not found (when filtering by videoGuid)
        '500':
          description: Internal Server Error
      security:
        - AccessKey: []
components:
  schemas:
    VideoStatisticsModel:
      type: object
      additionalProperties: false
      properties:
        viewsChart:
          type: object
          description: >-
            Shows the number of playback starts over time, with each data point
            representing the count of view starts in the corresponding UTC
            interval (hourly or daily). It is available at both the library
            level (aggregated across all videos) and the video level (for a
            single video). A playback start is counted once per viewer session
            per video and empty intervals are shown as zero.
          nullable: true
          additionalProperties:
            type: integer
            format: int64
        watchTimeChart:
          type: object
          description: >-
            Shows the cumulative time viewers spent watching over time, with
            each data point representing total watch time in the corresponding
            UTC interval (hourly or daily). It is available at both the library
            level (aggregated across all videos) and the video level (for a
            single video). Rewatches and repeated visits add to the total and
            empty intervals are shown as zero.
          nullable: true
          additionalProperties:
            type: integer
            format: int64
        countryViewCounts:
          type: object
          description: >-
            Shows the total number of playback starts by country for the
            selected time range. It is available at both the library level
            (aggregated across all videos) and the video level (for a single
            video). Each country’s value reflects unique playback starts per
            viewer session based on IP geolocation at playback start.
          nullable: true
          additionalProperties:
            type: integer
            format: int64
        countryWatchTime:
          type: object
          description: >-
            Shows the total watch time by country for the selected time range.
            It is available at both the library level (aggregated across all
            videos) and the video level (for a single video). Values reflect
            cumulative viewing time (rewatches and repeated visits add to the
            total) based on IP geolocation at playback start.
          nullable: true
          additionalProperties:
            type: integer
            format: int64
        engagementScore:
          type: integer
          description: >-
            Indicates how engaging a specific video is on a 0–100 scale based on
            viewing duration and viewing patterns; higher values reflect
            stronger viewer retention. Reported at the video level only and may
            be unavailable when there isn’t enough viewing data.
          format: int32
  securitySchemes:
    AccessKey:
      type: apiKey
      description: AccessKey based authentication
      name: AccessKey
      in: header

````