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

# Read a video's retention curve

> The share of viewers still watching at each point through the video. Plot it to see the exact second your VSL loses people.

Each bucket carries `watch_pct` as a **fraction between 0 and 1**, not a percent. `0.5` means half of viewers reached that point. Multiply by 100 to render a percentage.

Requires a token with the `analytics:read` scope.

Server: `https://app.trackplay.io/api/v1`



## OpenAPI

````yaml /api-reference/openapi.json get /videos/{video}/analytics/retention
openapi: 3.1.0
info:
  title: TrackPlay API
  description: >-
    Send conversions and events to TrackPlay, and read them back. Authenticated
    with scoped tokens you mint in the dashboard.
  version: 1.0.0
servers:
  - url: https://app.trackplay.io/api/v1
    description: App API. Conversions, videos, webhooks.
  - url: https://e.trackplay.io
    description: Events API. High-volume event ingest.
security:
  - bearerAuth: []
paths:
  /videos/{video}/analytics/retention:
    get:
      tags:
        - Analytics
      summary: Read a video's retention curve
      description: >-
        The share of viewers still watching at each point through the video.
        Plot it to see the exact second your VSL loses people.


        Each bucket carries `watch_pct` as a **fraction between 0 and 1**, not a
        percent. `0.5` means half of viewers reached that point. Multiply by 100
        to render a percentage.


        Requires a token with the `analytics:read` scope.


        Server: `https://app.trackplay.io/api/v1`
      operationId: getVideoAnalyticsRetention
      parameters:
        - name: video
          in: path
          required: true
          schema:
            type: integer
          description: The video's numeric ID.
        - name: from
          in: query
          required: false
          schema:
            type: string
            format: date
          description: Start of the range, as an ISO date. Defaults to 30 days ago.
        - name: to
          in: query
          required: false
          schema:
            type: string
            format: date
          description: End of the range, as an ISO date. Defaults to today.
        - name: tz
          in: query
          required: false
          schema:
            type: string
            default: UTC
          description: Timezone the range is read in, as an IANA name. Defaults to `UTC`.
        - name: buckets
          in: query
          required: false
          schema:
            type: integer
            default: 100
            maximum: 200
          description: >-
            How many points to divide the video into. Defaults to 100. Capped at
            200.
      responses:
        '200':
          description: The retention curve.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RetentionResponse'
              examples:
                retention:
                  value:
                    video_id: 481
                    buckets:
                      - bucket_pct: 0
                        watch_pct: 1
                      - bucket_pct: 25
                        watch_pct: 0.6413
                      - bucket_pct: 50
                        watch_pct: 0.4192
                      - bucket_pct: 75
                        watch_pct: 0.2517
                      - bucket_pct: 100
                        watch_pct: 0.1366
        '401':
          description: >-
            `AUTH_REQUIRED`: no token sent. `INVALID_TOKEN`: the token is
            invalid, expired, or revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '403':
          description: '`INSUFFICIENT_SCOPE`: the token does not carry `analytics:read`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: No video with that ID exists in this workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '422':
          description: >-
            Validation failed. A date could not be parsed, `to` fell before
            `from`, or `buckets` was out of range.
        '429':
          description: Rate limited. Reads are capped at 600 requests per minute per token.
components:
  schemas:
    RetentionResponse:
      type: object
      properties:
        video_id:
          type: integer
        buckets:
          type: array
          description: One entry per point through the video, in order.
          items:
            type: object
            properties:
              bucket_pct:
                type: number
                description: How far through the video this point sits, from 0 to 100.
              watch_pct:
                type: number
                description: >-
                  The share of viewers still watching at this point, as a
                  **fraction between 0 and 1** to four decimal places. This is
                  not a percent. `0.6413` means 64.13% of viewers reached this
                  point.
    ApiError:
      type: object
      description: The error shape the app API returns on a failed read or export.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                A stable error code, e.g. `INSUFFICIENT_SCOPE`,
                `VIDEO_NOT_FOUND`, `EXPORT_NOT_FOUND`.
            message:
              type: string
              description: What went wrong, in plain English.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A scoped token minted in **Settings → API tokens**. Send it as
        `Authorization: Bearer tplt_…` or `X-API-Key: tplt_…`.

````