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

# Get analytics overview

> Returns plays and watch time for a date range, broken down by date, category, country and video. The range defaults to the current month. Add `includeBandwidth=true` to include CDN bandwidth, storage and response-time figures. Requires the `READ_ANALYTICS` scope.



## OpenAPI

````yaml GET /v1/api/analytics
openapi: 3.1.0
info:
  title: PN Player API
  description: >-
    Manage videos, captions, playlists, tags, analytics, team members and
    account settings for your PN Player account.


    All `/v1/api` endpoints accept either an API key in the `X-Auth-Token`
    header or a JWT in the `Authorization: Bearer` header. Most endpoints also
    require the calling user to hold a specific role (scope): `READ_MEDIA`,
    `UPDATE_MEDIA`, `READ_ANALYTICS`, `READ_BILLING`, `READ_SETTINGS`,
    `UPDATE_SETTINGS` or `UPDATE_USERS`. The required scope is noted on each
    endpoint.
  version: 2.0.0
servers:
  - url: https://api.pnplayer.com
security:
  - apiKeyAuth: []
  - bearerAuth: []
tags:
  - name: Authentication
    description: >-
      Obtain a session token or reset a password. These endpoints do not require
      authentication.
  - name: Videos
    description: Create, list, update and delete videos.
  - name: Captions
    description: Upload, download, transcribe and manage caption tracks for a video.
  - name: Playlists
    description: Manual and rule-based (dynamic) playlists.
  - name: Tags
    description: Account-level tags that can be attached to videos.
  - name: Analytics
    description: Playback, engagement and usage metrics.
  - name: Reports
    description: Saved analytics report links.
  - name: Account
    description: Team members and account-wide streaming and security settings.
  - name: Profile
    description: The authenticated user's own profile.
  - name: API keys
    description: Long-lived keys for programmatic access.
  - name: Webhooks
    description: Configure the HTTPS endpoint that receives signed event notifications.
  - name: Billing
    description: Plan, usage, invoices, expansion packs and billing address.
  - name: Transcription settings
    description: Per-account key/value settings for automatic transcription.
  - name: Feature requests
    description: Submit, upvote and discuss feature requests.
  - name: Agreements
    description: Data processing agreement (DPA) and enterprise order form signing.
paths:
  /v1/api/analytics:
    get:
      tags:
        - Analytics
      summary: Get analytics overview
      description: >-
        Returns plays and watch time for a date range, broken down by date,
        category, country and video. The range defaults to the current month.
        Add `includeBandwidth=true` to include CDN bandwidth, storage and
        response-time figures. Requires the `READ_ANALYTICS` scope.
      parameters:
        - name: from
          in: query
          description: >-
            Start date (`YYYY-MM-DD`). Defaults to the start of the current
            month.
          schema:
            type: string
            format: date
        - name: to
          in: query
          description: End date (`YYYY-MM-DD`). Defaults to today.
          schema:
            type: string
            format: date
        - name: includeBandwidth
          in: query
          description: Any non-empty value adds bandwidth, storage and CDN metrics
          schema:
            type: string
            example: 'true'
        - name: source
          in: query
          description: Filter by traffic source
          schema:
            type: string
        - name: tags
          in: query
          description: >-
            Comma-separated tag IDs. Restricts results to videos carrying any of
            the tags.
          schema:
            type: string
        - name: country
          in: query
          description: ISO country code filter
          schema:
            type: string
            example: AU
        - name: video
          in: query
          description: Restrict to a single video ID
          schema:
            type: string
      responses:
        '200':
          description: Analytics overview
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalyticsOverview'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    AnalyticsOverview:
      type: object
      properties:
        totalPlays:
          type: integer
        totalWatch:
          type: number
          description: Total watch time in seconds
        playsDateWise:
          type: array
          items:
            type: object
            additionalProperties: true
        categoryWise:
          type: array
          items:
            type: object
            additionalProperties: true
        countryWise:
          type: array
          items:
            type: object
            additionalProperties: true
        videoWise:
          type: array
          items:
            type: object
            additionalProperties: true
        totalBandwidthUsed:
          type: number
          description: Bytes. Only with `includeBandwidth`.
        storageUsed:
          type: number
          description: MB. Only with `includeBandwidth`.
        averageServerResponseTime:
          type: number
          description: Only with `includeBandwidth`
        bandwidthUsage:
          type: object
          additionalProperties: true
          description: Bandwidth chart series. Only with `includeBandwidth`.
        geoTrafficUsage:
          type: object
          additionalProperties: true
          description: Traffic by region. Only with `includeBandwidth`.
    Error:
      type: object
      required:
        - message
      properties:
        message:
          type: string
  responses:
    Forbidden:
      description: The caller lacks the required scope
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: Forbidden
    ServerError:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Auth-Token
      description: >-
        API key created in the dashboard or via `POST /v1/api/api-keys`. Keys
        are prefixed `pn_` and do not expire until revoked.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Session token from `POST /auth/token`, valid for 24 hours.

````