openapi: 3.0.3
info:
  title: Mediaseer API
  version: 0.1.0
  license:
    name: Proprietary
  description: |
    Upload videos, start analyses and read their scenes, highlights and ad opportunities.
    Authenticate with an API key in the `X-Api-Key` header.

    - Resources belong to the caller. A resource owned by another user is reported as `404`, never
      as `403`.
    - HTTP error responses use the `Error` schema. Platform errors are passed through neither there nor in
      an analysis's `error`.
    - Mediaseer resource IDs are opaque strings. Scene IDs come from the analysis results.
    - Timestamps are RFC 3339 in UTC.
    - Playback is the one exception to header auth: the player fetches the playlist with a
      short-lived ticket in the URL (see `getVodAnalysisStream`), because media elements send no
      headers.
servers:
  - url: https://api.mediaseer.ai/api/v1
tags:
  - name: vod-analysis
    description: Upload a video and run AI scene analysis on it. One resource = one upload = one analysis.
  - name: clips
    description: Cut the video of a finished analysis into vertical (9:16) clips.
  - name: usage
    description: Quota, storage and limits for the caller.
  - name: billing
    description: Plan limits and available prices.
security:
  - apiKeyAuth: []
paths:
  /vod-analysis:
    post:
      tags:
        - vod-analysis
      operationId: createVodAnalysis
      externalDocs:
        description: Quota recovery policy
        url: https://mediaseer.ai/docs/guides/retries/#quota-refusals
      summary: Create a VOD analysis and open an upload session
      description: |
        Checks the caller's quota and the declared file size, creates the resource in state
        `UPLOADING` and returns a resumable upload session URL for Google Cloud Storage. The client
        uploads the file straight to that URL (chunked, resumable) and then calls `start`. Uploads
        never pass through this API.

        Not idempotent: repeating an accepted request creates another analysis and uses another slot.
        After a timeout or lost response, inspect `listVodAnalyses` before deciding to create another.
        There is no idempotency-key header to deduplicate creation requests.
        See https://mediaseer.ai/docs/guides/retries/ for retry and reconciliation guidance.

        A confirmed email may be required: otherwise `403` (`EMAIL_NOT_VERIFIED`) and nothing is created.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateVodAnalysisRequest"
      responses:
        "201":
          description: Created. Upload to `upload.url`, then call `start`.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateVodAnalysisResponse"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "429":
          $ref: "#/components/responses/QuotaExceeded"
        default:
          $ref: "#/components/responses/Error"
    get:
      tags:
        - vod-analysis
      operationId: listVodAnalyses
      summary: List my VOD analyses
      description: Newest first. A minimal projection; use `getVodAnalysis` for the full resource.
      parameters:
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Offset"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VodAnalysisPage"
        "401":
          $ref: "#/components/responses/Unauthorized"
        default:
          $ref: "#/components/responses/Error"
  /vod-analysis/{id}:
    parameters:
      - $ref: "#/components/parameters/VodAnalysisId"
    get:
      tags:
        - vod-analysis
      operationId: getVodAnalysis
      summary: Get a VOD analysis
      description: |
        The full resource without the analysis results (see `getVodAnalysisResults`). After starting
        an analysis, poll this operation until `state` is `FINISHED`, `FAILED` or `CANCELLED`.
        Only `FINISHED` has results; use `getVodAnalysisResults` to read them.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VodAnalysis"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        default:
          $ref: "#/components/responses/Error"
    delete:
      tags:
        - vod-analysis
      operationId: deleteVodAnalysis
      summary: Delete a VOD analysis
      description: |
        Removes the analysis from your account, in any state. An analysis in progress is stopped first.
        File and processing-record cleanup is best effort; see https://mediaseer.ai/docs/data/.
        A `502` (`UPSTREAM_ERROR`) can be retried safely.
      responses:
        "204":
          description: Deleted
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        default:
          $ref: "#/components/responses/Error"
  /vod-analysis/{id}/start:
    parameters:
      - $ref: "#/components/parameters/VodAnalysisId"
    post:
      tags:
        - vod-analysis
      operationId: startVodAnalysis
      externalDocs:
        description: Quota recovery policy
        url: https://mediaseer.ai/docs/guides/retries/#quota-refusals
      summary: Start the analysis after the upload finished
      description: |
        Verifies that the uploaded object exists in storage, records its size and starts the
        encoding with scene analysis. Moves the resource from `UPLOADING` to `QUEUED`. Refused
        (`429`, field `minutes`) when no analysed minutes are left in this period; a video longer
        than the minutes left ends `FAILED` once its length is known (`minutes` in `getUsage`).

        While `QUEUED`, the whole video is read to check its length before the encoding starts. A
        file that can't be read as a video, one without a video track, and a video longer than the
        length limit or the minutes left end `FAILED` with a reason in `error.message`; such a start
        doesn't count towards the daily starts, and no minutes are counted.

        Idempotent: calling it again while `QUEUED` or `PROCESSING` returns the current resource
        without starting anything. In a terminal state it returns `409`, as does an `UPLOADING`
        resource whose upload window (7 days from creation) has passed: create a new one instead.
        A `502` (`UPSTREAM_ERROR`) can be retried safely. Check the analysis's state after an uncertain answer.
        See https://mediaseer.ai/docs/guides/retries/ for retry and reconciliation guidance.
      responses:
        "202":
          description: |
            Accepted. The resource is `QUEUED` (or already further along). Poll `getVodAnalysis`
            (`GET /vod-analysis/{id}`) with this resource's `id` until `state` is `FINISHED`,
            `FAILED` or `CANCELLED`. The `Location` header is a same-origin status-resource URI reference;
            resolve it against the request URL. Acceptance does not mean that results are ready.
          headers:
            Location:
              description: Status resource for this analysis, also returned on an idempotent accepted start.
              schema:
                type: string
                format: uri-reference
                example: /api/v1/vod-analysis/747eab8d-d788-4abd-ae9e-144b930df539
          links:
            GetAnalysisStatus:
              operationId: getVodAnalysis
              parameters:
                id: $response.body#/id
              description: Poll this analysis until its state is FINISHED, FAILED or CANCELLED.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VodAnalysis"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          description: |
            Not startable. `UPLOAD_INCOMPLETE`: no object was found in storage yet; the analysis stays
            `UPLOADING`, and a start after the upload has finished can succeed. `INVALID_STATE`: the
            resource is in a terminal state, or its upload window has passed.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "429":
          $ref: "#/components/responses/QuotaExceeded"
        default:
          $ref: "#/components/responses/Error"
  /vod-analysis/{id}/stop:
    parameters:
      - $ref: "#/components/parameters/VodAnalysisId"
    post:
      tags:
        - vod-analysis
      operationId: stopVodAnalysis
      summary: Stop an analysis in progress
      description: |
        - `UPLOADING`: the upload is abandoned; the resource and any partial object are deleted and
          the response is `204`.
        - `QUEUED` or `PROCESSING`: cancellation is requested and the resource moves to `CANCELLED`.
          Processing may still be stopping after the response.
        - Terminal states: `409`.
        File cleanup is best effort; see https://mediaseer.ai/docs/data/.

        After a timeout or lost response, read `getVodAnalysis` before retrying. A retry can return
        `404` after an upload was abandoned, or `409` after cancellation already took effect.
        See https://mediaseer.ai/docs/guides/retries/ for retry and reconciliation guidance.
      responses:
        "200":
          description: Stopped. The resource is `CANCELLED`.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VodAnalysis"
        "204":
          description: The upload was abandoned and the resource deleted.
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/InvalidState"
        default:
          $ref: "#/components/responses/Error"
  /vod-analysis/{id}/results:
    parameters:
      - $ref: "#/components/parameters/VodAnalysisId"
    get:
      tags:
        - vod-analysis
      operationId: getVodAnalysisResults
      summary: Get the scene analysis results
      description: |
        Only available once the resource is `FINISHED`. Returns the video-level and scene-level analysis.

        A field without a value is left out, never null: the value was not available, an optional list
        was empty, or the value belongs to an enum this API does not know yet. Required lists are empty
        instead, and an optional text can be an empty string. In a shot's `shotAdvisories`, an unknown
        value removes the whole object, because a partial list of advisories would read as "nothing found".
      parameters:
        - name: language
          in: query
          required: false
          description: |
            Not supported today: no translated results exist, and any value is answered with `400`
            `VALIDATION`.
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/VodAnalysisResults"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/InvalidState"
        default:
          $ref: "#/components/responses/Error"
  /vod-analysis/{id}/stream:
    parameters:
      - $ref: "#/components/parameters/VodAnalysisId"
    get:
      tags:
        - vod-analysis
      operationId: getVodAnalysisStream
      summary: Get a playable URL for the encoded video
      description: |
        Only available once the resource is `FINISHED`. Returns the URL of the playlist endpoint
        with a short-lived, per-resource ticket embedded in it. Hand `playlistUrl` to the player
        as-is: a media element sends no headers, so the ticket in the URL is the credential. The
        ticket grants playback of this one resource until `expiresAt`; nothing else. Call again
        for a fresh one when it expires.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StreamInfo"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          $ref: "#/components/responses/InvalidState"
        default:
          $ref: "#/components/responses/Error"
  /vod-analysis/{id}/clip-jobs:
    parameters:
      - $ref: "#/components/parameters/VodAnalysisId"
    post:
      tags:
        - clips
      operationId: createClipJob
      externalDocs:
        description: Quota recovery policy
        url: https://mediaseer.ai/docs/guides/retries/#quota-refusals
      summary: Create clips from a finished analysis
      description: |
        Starts cutting the analysis's video into vertical (9:16) clips and returns the new job at
        once, in state `SUBMITTING`. Handing the video over can take minutes; poll `getClipJob` until
        the job is `READY` or `FAILED`. Clips can only be created while the analysis's
        `clips.available` is `true`; otherwise `409` and nothing is created.

        While `emailVerificationRequired` is `true`, the caller's email must be confirmed, as for
        creating an analysis: otherwise `403` (`EMAIL_NOT_VERIFIED`) and nothing is created.

        Every job counts towards the caller's daily clip limits (`429`), also one that fails or is
        deleted later. The clips a job makes count towards the plan's clips per period
        (`clips` in `getUsage`) once it is `READY`.

        Not idempotent: repeating an accepted request creates another job and consumes quota again.
        After a timeout or lost response, inspect `listClipJobs` for this analysis before deciding to
        create another job. There is no idempotency-key header to deduplicate creation requests.
        An explicit `503` (`CLIPS_UNAVAILABLE`) creates nothing and can be retried later.
        See https://mediaseer.ai/docs/guides/retries/ for retry and reconciliation guidance.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateClipJobRequest"
      responses:
        "201":
          description: Created. The job is `SUBMITTING`.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClipJob"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          description: |
            Confirming the email is required, and the caller's email is not confirmed yet
            (`EMAIL_NOT_VERIFIED`).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          $ref: "#/components/responses/NotFound"
        "409":
          description: |
            No clips can be created from this analysis (`INVALID_STATE`): its `clips.available` is
            `false`, and `clips.reason` says why.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "429":
          $ref: "#/components/responses/ClipQuotaExceeded"
        "501":
          $ref: "#/components/responses/ClipsNotConfigured"
        "503":
          description: |
            Creating clips is temporarily unavailable (`CLIPS_UNAVAILABLE`). Nothing was created; try
            again later.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          $ref: "#/components/responses/Error"
    get:
      tags:
        - clips
      operationId: listClipJobs
      summary: List the clip jobs of an analysis
      description: |
        Newest first. Deleted jobs are not listed. Like `getClipJob`, reading brings the jobs' states
        up to date.
      parameters:
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Offset"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClipJobPage"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        default:
          $ref: "#/components/responses/Error"
  /clip-jobs/{id}:
    parameters:
      - $ref: "#/components/parameters/ClipJobId"
    get:
      tags:
        - clips
      operationId: getClipJob
      summary: Get a clip job
      description: |
        Reading the job brings its state up to date, so poll this while the job is `SUBMITTING` or
        `PROCESSING`. A deleted job is `404`.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClipJob"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        default:
          $ref: "#/components/responses/Error"
    delete:
      tags:
        - clips
      operationId: deleteClipJob
      summary: Delete a clip job
      description: |
        Allowed in any state; a job whose clips are still being made is stopped. The job and its
        clips are gone from this API at once. Their copies at the clip service are removed
        afterwards, as far as that service allows. Deleting gives nothing back against the clip
        limits.
      responses:
        "204":
          description: Deleted
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        default:
          $ref: "#/components/responses/Error"
  /clip-jobs/{id}/episodes/{episode}/media:
    parameters:
      - $ref: "#/components/parameters/ClipJobId"
      - $ref: "#/components/parameters/EpisodeNumber"
    get:
      tags:
        - clips
      operationId: getClipEpisodeMedia
      summary: Get the URLs to watch and download a clip
      description: |
        Only available once the job is `READY`. Returns short-lived signed URLs for the clip, its
        poster and its download as JSON, not as a redirect: a `<video>` element and a download link
        send no `Authorization` header, so they use these URLs as they are. Every call returns fresh
        URLs. Call it before playing, and again once they expire (`expiresAt`), for example when a
        seek fails.
      parameters:
        - name: version
          in: query
          required: false
          description: |
            Which version of the clip. Leaving it out means `ORIGINAL`. With `EDITED`, the URLs are
            those of the newest finished edit of the clip in the web app's editor, and the clip's
            `editedAt` is brought up to date; a clip without a finished edit is a `404`
            (`NOT_FOUND`).
          schema:
            $ref: "#/components/schemas/ClipVersion"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClipEpisodeMedia"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          description: |
            No such clip job, or the job has no clip with this number (`NOT_FOUND`).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "409":
          $ref: "#/components/responses/InvalidState"
        "501":
          $ref: "#/components/responses/ClipsNotConfigured"
        default:
          $ref: "#/components/responses/Error"
  /usage:
    get:
      tags:
        - usage
      operationId: getUsage
      summary: Quota, storage and limits for the caller
      description: |
        Your analysis slots, the storage your source videos and clips take, the size and duration
        limits per video, and the video analysed and the clips made in your current period with
        your plan's limits on them.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Usage"
        "401":
          $ref: "#/components/responses/Unauthorized"
        default:
          $ref: "#/components/responses/Error"
  /plans:
    get:
      tags:
        - billing
      operationId: listPlans
      summary: The plans and their limits
      description: |
        Every plan with the limits it sets, as `getUsage` reports them for the plan you are on, and
        for a plan you can buy, its price. Your current plan is `plan.id` in `getUsage`.
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlanList"
        "401":
          $ref: "#/components/responses/Unauthorized"
        default:
          $ref: "#/components/responses/Error"
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: API key created on the Account page of the app.
  parameters:
    VodAnalysisId:
      name: id
      in: path
      required: true
      description: The analysis's opaque `id`, returned by `createVodAnalysis` or `listVodAnalyses`.
      schema:
        type: string
    ClipJobId:
      name: id
      in: path
      required: true
      description: The clip job's `id`.
      schema:
        type: string
    EpisodeNumber:
      name: episode
      in: path
      required: true
      description: The clip's `number` within the job, from 1.
      schema:
        type: integer
        minimum: 1
    Limit:
      name: limit
      in: query
      required: false
      description: Maximum number of items to return, newest first. The response can contain fewer items.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 20
    Offset:
      name: offset
      in: query
      required: false
      description: Number of items to skip, starting from the newest. Use the same limit when fetching later pages.
      schema:
        type: integer
        minimum: 0
        default: 0
  responses:
    Error:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    BadRequest:
      description: The request is malformed or fails validation (`VALIDATION`).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    Unauthorized:
      description: Missing, invalid or expired credentials (`UNAUTHENTICATED`).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    Forbidden:
      description: |
        The credentials are valid but this action is not allowed (`FORBIDDEN`), or a confirmed email
        is required to create or start an analysis (`EMAIL_NOT_VERIFIED`).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    NotFound:
      description: No such resource for this caller (`NOT_FOUND`). Other users' resources look the same.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    InvalidState:
      description: The resource is in a state that does not allow this operation (`INVALID_STATE`).
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    QuotaExceeded:
      description: |
        A limit was hit (`QUOTA_EXCEEDED`). `details[].field` can name your analysis slots (`jobs`),
        file size (`sizeBytes`), your plan's storage for source videos (`storage`, when creating an
        analysis), your plan's analysed minutes (`minutes`, when starting an analysis) or daily
        starts (`dailyStarts`).

        - `jobs`: delete an analysis you no longer need to free a slot.
        - `sizeBytes`: use a smaller file; retrying the same oversized upload does not help.
        - `storage`: the file's size does not fit into what your source videos (`storage.sourceBytes`
          in `getUsage`) leave of `storage.limitBytes`. Clips do not count. Delete analyses you no
          longer need; a successful delete frees their storage at once.
        - `minutes`: no analysed minutes are left in this period (`minutes` in `getUsage`). They
          start again from 0 at `period.end`; deleting an analysis does not give them back.
        - `dailyStarts`: wait until the next UTC day. Stopping or deleting an analysis does not
          refund a daily start.

        Follow the response's guidance for another refusal. These quota refusals do not include a
        `Retry-After` header; do not repeatedly retry an unchanged request.
        See https://mediaseer.ai/docs/guides/retries/#quota-refusals for recovery guidance.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    ClipQuotaExceeded:
      description: |
        A clip limit was hit (`QUOTA_EXCEEDED`). `details[].field` can name `clips` (the clips your
        plan includes in this period), `activeClipJobs` (the caller's jobs `SUBMITTING` or
        `PROCESSING` at once) or `dailyClipJobs` (the jobs the caller created this UTC day). Every
        job created counts towards the daily limit, also when it fails or is deleted. Storage never
        refuses a clip job: clips have no storage limit.

        - `clips`: the clips of this period are used up (`clips` in `getUsage`). They start again
          from 0 at `period.end`; deleting clip jobs does not give them back.
        - `activeClipJobs`: wait for an existing job to finish, reading `getClipJob` to refresh its
          state, or delete an unwanted job to free its active slot.
        - `dailyClipJobs`: wait until the next UTC day; deleting or failing a job does not refund it.

        Follow the response's guidance for another refusal. These quota refusals do not include a
        `Retry-After` header; do not repeatedly retry an unchanged request.
        See https://mediaseer.ai/docs/guides/retries/#quota-refusals for recovery guidance.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    ClipsNotConfigured:
      description: |
        This environment offers no clips (`CLIPS_NOT_CONFIGURED`): its backend has no access to the
        clip service. Trying again does not help.
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          $ref: "#/components/schemas/ErrorCode"
        message:
          type: string
          description: |
            Human-readable, safe to show to the user. For `VALIDATION` with a single detail, it states
            that detail's reason, naming the field where the reason needs it; with several, it is
            generic and `details` lists them.
          example: The file is larger than the limit of 2147483648 bytes.
        details:
          type: array
          description: Optional field-level or limit-level detail.
          items:
            $ref: "#/components/schemas/ErrorDetail"
    ErrorCode:
      type: string
      description: Stable machine-readable code. Clients branch on this, never on `message`.
      x-enum-elements:
        - name: CLIPS_NOT_CONFIGURED
        - name: CLIPS_UNAVAILABLE
      enum:
        - VALIDATION
        - UNAUTHENTICATED
        - INVALID_TOKEN
        - FORBIDDEN
        - EMAIL_NOT_VERIFIED
        - NOT_FOUND
        - INVALID_STATE
        - UPLOAD_INCOMPLETE
        - QUOTA_EXCEEDED
        - RATE_LIMITED
        - UPSTREAM_ERROR
        - CLIPS_NOT_CONFIGURED
        - CLIPS_UNAVAILABLE
        - INTERNAL
    ErrorDetail:
      type: object
      required:
        - message
      properties:
        field:
          type: string
          description: |
            The request field the detail refers to, if any; for `QUOTA_EXCEEDED`, the limit that was
            hit.
          example: sizeBytes
        message:
          type: string
          example: must be at most 2147483648
    VodAnalysisState:
      type: string
      description: |
        - `UPLOADING`: created, waiting for the client to upload and call `start`
        - `QUEUED`: started; the video's length is checked, then it waits to be processed
        - `PROCESSING`: encoding and analysis running
        - `FINISHED`: results available
        - `FAILED`: could not start or finish, or the video was too long; see `error`
        - `CANCELLED`: stopped by you or the processing service
      enum:
        - UPLOADING
        - QUEUED
        - PROCESSING
        - FINISHED
        - FAILED
        - CANCELLED
    VodAnalysisSummary:
      type: object
      description: |
        A summary of one analysis. `title`, `description`, `sceneCount`, `keywords` and
        `durationSeconds` come from the analysis results and are absent until it is `FINISHED`
        (`title` may be present earlier if given at create).
      required:
        - id
        - state
        - fileName
        - createdAt
      properties:
        id:
          type: string
          example: 7f3c2a1e-0b4d-4c7e-9a52-1d2e3f4a5b6c
        state:
          $ref: "#/components/schemas/VodAnalysisState"
        fileName:
          type: string
          description: Name of the uploaded file.
          example: episode-01.mp4
        createdAt:
          type: string
          format: date-time
        title:
          type: string
          description: Given at create, else inferred by the analysis.
          example: Los Angeles 1947
        description:
          type: string
          description: Summary of the whole video, from the analysis.
          example: A noir mystery set in Los Angeles in 1947.
        sceneCount:
          type: integer
          example: 9
        keywords:
          type: array
          items:
            type: string
          example:
            - Los Angeles
            - "1947"
            - mystery
        durationSeconds:
          type: number
          format: double
          example: 719.02
    VodAnalysis:
      allOf:
        - $ref: "#/components/schemas/VodAnalysisSummary"
        - type: object
          required:
            - updatedAt
          properties:
            updatedAt:
              type: string
              format: date-time
            sizeBytes:
              type: integer
              format: int64
              description: Size of the uploaded object; known from `start` on.
              example: 734003200
            startedAt:
              type: string
              format: date-time
              description: When `start` was accepted.
            finishedAt:
              type: string
              format: date-time
              description: When the resource reached a terminal state.
            error:
              $ref: "#/components/schemas/VodAnalysisError"
            clips:
              description: |
                Whether clips can be created from this analysis, and if not, why. Treat an absent
                `clips` as not available.
              allOf:
                - $ref: "#/components/schemas/ClipAvailability"
    VodAnalysisError:
      type: object
      description: Why the analysis failed. Only set in state `FAILED`.
      required:
        - message
      properties:
        message:
          type: string
          description: |
            A sentence for people, in Mediaseer's own words, never the processing platform's text. It names
            the cause when Mediaseer knows it, such as a video longer than the length limit or a start that
            never ran; otherwise it says only that the encoding failed or no longer exists. Don't branch on
            its wording.
          example: The encoding failed.
    VodAnalysisPage:
      type: object
      required:
        - items
        - total
        - limit
        - offset
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/VodAnalysisSummary"
        total:
          type: integer
          description: Total number of resources of the caller, regardless of paging.
        limit:
          type: integer
        offset:
          type: integer
    CreateVodAnalysisRequest:
      type: object
      required:
        - fileName
        - sizeBytes
      properties:
        fileName:
          type: string
          minLength: 1
          maxLength: 255
          description: Name of the file the client is about to upload. Shown until a title exists.
          example: episode-01.mp4
        sizeBytes:
          type: integer
          format: int64
          minimum: 1
          description: Declared file size, checked against the size limit before an upload session is issued.
          example: 734003200
        contentType:
          type: string
          maxLength: 100
          description: |
            MIME type the client will send: a `video/*` type. Omit it when the type is unknown.
          example: video/mp4
        title:
          type: string
          maxLength: 255
          description: Optional title. Without it, the analysis's inferred title is used once known, and `fileName` until then.
    CreateVodAnalysisResponse:
      type: object
      required:
        - analysis
        - upload
      properties:
        analysis:
          $ref: "#/components/schemas/VodAnalysis"
        upload:
          $ref: "#/components/schemas/UploadSession"
    UploadSession:
      type: object
      description: |
        A Google Cloud Storage resumable upload session. Upload the file with `PUT` requests to `url`
        (whole file, or chunks with `Content-Range`); the session supports resuming after a network
        drop. No credentials are needed; the URL is the credential.
      required:
        - url
        - expiresAt
      properties:
        url:
          type: string
          format: uri
          example: https://storage.googleapis.com/upload/storage/v1/b/example-uploads/o?uploadType=resumable&upload_id=example
        expiresAt:
          type: string
          format: date-time
          description: Deadline for uploading to this URL. A completed upload can still be started within the analysis's upload window.
    VodAnalysisResults:
      type: object
      required:
        - outputLanguageCodes
        - analysis
      properties:
        outputLanguageCodes:
          type: array
          description: Languages of translated results available through Mediaseer. This list is currently always empty.
          items:
            type: string
          example: []
        analysis:
          description: The analysis of the video, generated by Bitmovin AI Scene Analysis.
          allOf:
            - $ref: "#/components/schemas/SceneAnalysisDetails"
    StreamInfo:
      type: object
      required:
        - playlistUrl
        - expiresAt
      properties:
        playlistUrl:
          type: string
          format: uri
          description: Absolute playback URL. Give it to the player unchanged.
          example: https://api.example.com/api/v1/vod-analysis/7f3c2a1e/playlist.m3u8?ticket=eyJhbGciOi
        expiresAt:
          type: string
          format: date-time
          description: When the ticket stops opening the playlists. Segments already listed keep playing.
    SceneAnalysisDetails:
      type: object
      required:
        - scenes
        - description
        - keywords
        - ratings
        - sensitiveTopics
        - iabSensitiveTopicTaxonomies
        - metadata
      properties:
        scenes:
          type: array
          description: The scenes of the video with available results, each with its start and end time.
          items:
            $ref: "#/components/schemas/Scene"
        duration:
          type: number
          format: double
          description: Duration of the analyzed video in seconds, based on the detected shot timeline.
        description:
          type: string
          description: AI-generated summary of the video as a whole. Can be empty when no asset summary is available.
        title:
          type: string
          description: Inferred title for the analysed content as a whole. Absent or empty when not available.
        keywords:
          type: array
          description: Free-text keywords for the video as a whole. Empty when no terms were produced, including when the asset summary is unavailable.
          items:
            type: string
        ratings:
          type: array
          description: AI-estimated content ratings for the video, with one entry per supported region and rating system when asset summarization succeeds. Empty when no ratings were produced.
          items:
            $ref: "#/components/schemas/Rating"
        sensitiveTopics:
          type: array
          description: Free-text sensitive topics inferred for the video as a whole. They can differ from the combined scene topics. Empty when no asset-level topics were produced, including when the asset summary is unavailable.
          items:
            type: string
        iabSensitiveTopicTaxonomies:
          type: array
          description: Distinct IAB Content Taxonomy IDs drawn from the scenes' sensitive-topic annotations. Empty when no IDs were collected or when the aggregate is unavailable.
          items:
            type: string
        inputLanguageCodes:
          type: array
          description: Language codes identified for spoken dialogue or narration in the source video, such as `en`. Identification excludes theme-song vocals, lyrics, music and written text. Empty or absent when no codes were returned, including for input without audio.
          items:
            type: string
        credits:
          description: Selected cast, crew and song credits and the copyright year, extracted from readable on-screen credit text. Credits can be empty when no readable credits were available or extraction produced no result.
          allOf:
            - $ref: "#/components/schemas/Credits"
        metadata:
          description: "Information about the analysis that produced this result: the software version and a disclaimer."
          allOf:
            - $ref: "#/components/schemas/SceneAnalysisMetadata"
    SceneAnalysisMetadata:
      type: object
      properties:
        version:
          type: string
          description: Version of the analysis software that generated the result. A local build without a recorded version uses `0.0.0`.
        disclaimer:
          type: string
          description: Attribution identifying the result as AI-generated, such as `Generated by Bitmovin AI`.
    Rating:
      type: object
      properties:
        region:
          type: string
          description: Region label for the estimate, such as `US`, `UK` or `EU`.
        system:
          type: string
          description: Name of the movie or TV rating system used for the estimate, such as `MPAA (Motion Picture Association of America) Ratings` or `TV Parental Guidelines`.
        rating:
          type: string
          description: AI-estimated classification within the indicated system, such as `PG-13` or `TV-14`. Can be empty when no classification was provided.
    Credits:
      type: object
      properties:
        persons:
          type: array
          description: Selected cast and crew extracted from on-screen credits. Credits are deduplicated by name within each department. Empty or absent when no people were returned.
          items:
            $ref: "#/components/schemas/Person"
        songs:
          type: array
          description: Songs identified in on-screen credits, such as opening, ending or insert songs. Empty or absent when no songs were returned.
          items:
            $ref: "#/components/schemas/Song"
        copyright:
          type: string
          description: Production copyright year extracted from on-screen credits, as text, such as `2016`. Empty when unavailable in the source result. Absent when the source omits the field. This is extracted analysis output and does not establish ownership, licensing or permission to use the video.
    Person:
      type: object
      properties:
        name:
          type: string
          description: Name extracted for the credited person. Capitalization can be normalized.
        role:
          type: string
          description: Credited role. For acting credits, this is the character played when known, or a generic credit such as `Cast`. The value can be empty when unavailable.
        department:
          description: The detected department of a person. `UNKNOWN` when the department could not be determined. Absent if no supported department was returned.
          allOf:
            - $ref: "#/components/schemas/Department"
    Department:
      type: string
      enum:
        - ACTING
        - ANIMATION
        - CASTING
        - CINEMATOGRAPHY
        - COSTUME_DESIGN
        - DIRECTING
        - FILM_EDITING
        - MAKEUP_AND_HAIRSTYLING
        - MUSIC
        - PRODUCTION
        - PRODUCTION_DESIGN
        - SOUND
        - VISUAL_EFFECTS
        - WRITING
        - UNKNOWN
      x-enum-elements:
        - name: ACTING
          description: Cast members and their portrayed characters
        - name: ANIMATION
          description: Chief Animation Director, Animation Director, Character Designer, Color Design
        - name: CASTING
          description: Casting Director
        - name: CINEMATOGRAPHY
          description: Director of Photography
        - name: COSTUME_DESIGN
          description: Costume Designer
        - name: DIRECTING
          description: Director
        - name: FILM_EDITING
          description: Film Editor
        - name: MAKEUP_AND_HAIRSTYLING
          description: Department head Makeup Artist and Hair Stylist
        - name: MUSIC
          description: Film score Composer
        - name: PRODUCTION
          description: Producers and Executive Producers
        - name: PRODUCTION_DESIGN
          description: Production Designer
        - name: SOUND
          description: Primary Sound Designer or Sound Mixer
        - name: VISUAL_EFFECTS
          description: Visual Effects Supervisor
        - name: WRITING
          description: Screenplay, Created By, or Story By credits
        - name: UNKNOWN
          description: Fallback when department cannot be determined
    Song:
      type: object
      properties:
        name:
          type: string
          description: Song title extracted from on-screen credits. Can be empty when unavailable.
        artist:
          type: string
          description: Performer identified for the song in the on-screen credits. Can be empty when unavailable.
    Scene:
      type: object
      required:
        - sensitiveTopics
        - keywords
      properties:
        id:
          type: string
          description: Opaque identifier assigned to the scene within this analysis result. It can change across analyses of the same video.
        title:
          type: string
          description: Short AI-generated title for the scene.
        startInSeconds:
          type: number
          format: double
          description: Start of the scene in seconds from the beginning of the video.
        endInSeconds:
          type: number
          format: double
          description: End of the scene in seconds from the beginning of the video.
        content:
          description: Structured description of the scene's characters, objects, settings and narrative dynamics. Individual findings can be unavailable.
          allOf:
            - $ref: "#/components/schemas/SceneContent"
        summary:
          type: string
          description: Concise AI-generated summary of the scene.
        verboseSummary:
          type: string
          description: Detailed AI-generated description of the scene, with more context than the summary.
        sensitiveTopics:
          type: array
          description: Sensitive topics in the scene, as short phrases such as `violence` or `war`. Empty when none were found, or when the analysis did not produce the list.
          items:
            type: string
        keywords:
          type: array
          description: Free-text keywords for the scene. Empty when no terms were produced.
          items:
            type: string
        iab:
          description: IAB taxonomy classifications of the scene's subject matter, relevant advertising categories and sensitive topics. Classification lists can be empty when no taxonomy result is available.
          allOf:
            - $ref: "#/components/schemas/IabTaxonomy"
        type:
          description: The detected type of scene based on content analysis. `UNKNOWN` when the analysis cannot determine the scene type. Absent if no supported type was returned.
          allOf:
            - $ref: "#/components/schemas/SceneType"
        shots:
          type: array
          description: A detailed breakdown of individual camera shots within this scene, providing granular analysis of visual content and subjects. Can be empty or absent when no shot results are available. The list can omit shots, and a listed shot can cross a scene boundary or fall outside the associated scene's interval.
          items:
            $ref: "#/components/schemas/Shot"
        adOpportunityInformation:
          description: Suitability of the end of this scene for an ad break. Default values can be returned when the scene was not assessed. This field does not report a placed ad.
          allOf:
            - $ref: "#/components/schemas/AdOpportunity"
    SceneType:
      type: string
      enum:
        - LOGO_IDENT
        - OPENING_CREDITS
        - RECAP
        - PREVIEW_THIS_TITLE
        - PROMOTION_OTHER_TITLE
        - BREAK_BUMPER
        - END_CREDITS
        - ADS
        - MAIN_CONTENT
        - UNKNOWN
      x-enum-elements:
        - name: LOGO_IDENT
          description: Network, studio, or platform identification bumpers
        - name: OPENING_CREDITS
          description: Opening sequence presenting title, credits, or thematic elements without in-world dialogue
        - name: RECAP
          description: '"Previously on …" montage sequences from prior episodes'
        - name: PREVIEW_THIS_TITLE
          description: Teaser or preview for this title or its upcoming episode
        - name: PROMOTION_OTHER_TITLE
          description: Promotion or trailer for a different title or programming
        - name: BREAK_BUMPER
          description: Short bumper marking an act or advertising break
        - name: END_CREDITS
          description: Closing credits, acknowledgments, or copyright notices
        - name: ADS
          description: Commercial advertisements with promotional intent and call-to-action
        - name: MAIN_CONTENT
          description: Main narrative, dialogue, or educational material
        - name: UNKNOWN
          description: Fallback when AI confidence is below minimum threshold
    SceneContent:
      type: object
      required:
        - characters
        - objects
        - settings
      properties:
        characters:
          type: array
          description: People and characters in the scene. Empty when there are none, or when the analysis did not produce the list.
          items:
            $ref: "#/components/schemas/SceneCharacter"
        objects:
          type: array
          description: Selected notable objects described in the scene. Empty when none were returned or when object findings were unavailable.
          items:
            $ref: "#/components/schemas/SceneObject"
        settings:
          type: array
          description: Places and conditions described in the scene. A scene can have multiple settings. Empty when none were returned or when settings were unavailable.
          items:
            $ref: "#/components/schemas/SceneSetting"
        dynamics:
          description: Assessment of the scene's narrative tension and pacing. Individual values can be `UNKNOWN` when unavailable.
          allOf:
            - $ref: "#/components/schemas/SceneDynamics"
    SceneCharacter:
      type: object
      properties:
        name:
          type: string
          description: Name assigned to the character when identified. It can be absent, empty or reported as unknown, even when a summary names the person.
        playedBy:
          type: string
          description: Name of the performer credited for the identified character role when the role maps to a single performer. Can be absent or empty when unresolved.
        description:
          type: string
          description: What the character does in the scene. Absent when not determined.
        characterAppearance:
          description: Description of the character's visible appearance. Individual attributes can be empty or unknown.
          allOf:
            - $ref: "#/components/schemas/CharacterAppearance"
    CharacterAppearance:
      type: object
      properties:
        summary:
          type: string
          description: Short description of the character's visible appearance. Can be empty when unavailable.
        gender:
          type: string
          description: Apparent gender in free text, such as `male`, `female` or `unknown`. Can be empty when unavailable.
        approximateAge:
          description: The approximate age range of the character. `UNKNOWN` when an age band could not be estimated or does not apply. Absent if no supported age band was returned.
          allOf:
            - $ref: "#/components/schemas/AgeRange"
        hairColor:
          type: string
          description: Hair color in free text. The original analysis often uses uppercase labels such as `DARK`, `RED` or `GRAY`. Values can be empty or use unknown wording.
        hairStyle:
          type: string
          description: Hairstyle in free text, such as `short` or `curly`. Can be empty or use unknown wording.
        hairFullness:
          type: string
          description: Hair fullness in free text, such as `full`, `thinning` or `bald`. Can be empty or use unknown wording.
        facialHair:
          type: string
          description: Facial hair in free text, such as `clean-shaven`, `stubble` or `beard`. Can be empty when no description is available.
        physicalBuild:
          type: string
          description: Build in free text, such as `average`, `athletic` or `lean`. Can be empty when unavailable.
        distinguishingFeatures:
          type: string
          description: Distinctive visible features in free text, such as glasses or a scar. An empty string or wording such as `none` means no feature was described.
        clothing:
          type: string
          description: What the character wears, in free text. Can be empty when no description is available.
    AgeRange:
      type: string
      enum:
        - CHILD
        - TEEN
        - TWENTIES
        - THIRTIES
        - FORTIES
        - FIFTIES
        - SIXTIES_PLUS
        - UNKNOWN
      x-enum-elements:
        - name: CHILD
          description: Character appears to be a child
        - name: TEEN
          description: Character appears to be a teen
        - name: TWENTIES
          description: Character appears to be in their 20s
        - name: THIRTIES
          description: Character appears to be in their 30s
        - name: FORTIES
          description: Character appears to be in their 40s
        - name: FIFTIES
          description: Character appears to be in their 50s
        - name: SIXTIES_PLUS
          description: Character appears to be 60 or older
        - name: UNKNOWN
          description: Fallback when age range cannot be determined
    SceneObject:
      type: object
      properties:
        description:
          type: string
          description: Description of the object. Absent when not determined.
        category:
          type: string
          description: Kind of object in free text, such as `Furniture`, `Vehicle` or `Weapon`. Not from a fixed list, so spelling and case vary. Absent when not determined.
    SceneSetting:
      type: object
      properties:
        location:
          description: Place described for the setting. The description need not identify a real geographic location.
          allOf:
            - $ref: "#/components/schemas/SceneLocation"
        timeOfDay:
          type: string
          description: Time of day in free text, such as `morning` or `night`. Wording and case can vary, including for unknown values.
        atmosphere:
          description: Inferred mood, lighting and weather of the setting. Individual descriptions can be empty or unknown.
          allOf:
            - $ref: "#/components/schemas/SceneAtmosphere"
    SceneLocation:
      type: object
      properties:
        name:
          type: string
          description: Short descriptive name of the place, such as `Basketball Arena`. Can be empty when unavailable.
        description:
          type: string
          description: Free-text description of the place. Can be empty when unavailable.
    SceneAtmosphere:
      type: object
      properties:
        mood:
          type: string
          description: Mood or tone of the setting, in free text. Can be empty when unavailable.
        lighting:
          type: string
          description: Lighting of the setting, in free text, such as `dim` or `bright studio lighting`. Can be empty when unavailable.
        weather:
          type: string
          description: Weather or indoor conditions, in free text. Can be empty or use unknown wording.
    SceneDynamics:
      type: object
      properties:
        tension:
          description: The detected tension of the scene based on content analysis. `UNKNOWN` when the analysis could not determine tension. Absent if no supported value was returned.
          allOf:
            - $ref: "#/components/schemas/SceneTension"
        pacing:
          description: The detected pacing of the scene based on content analysis. `UNKNOWN` when the analysis could not determine pacing. Absent if no supported value was returned.
          allOf:
            - $ref: "#/components/schemas/ScenePacing"
    SceneTension:
      type: string
      enum:
        - EXTREME
        - HIGH
        - MODERATE
        - LOW
        - UNKNOWN
      x-enum-elements:
        - name: EXTREME
          description: Peak suspense or intensity, such as climactic confrontations or life-threatening situations
        - name: HIGH
          description: Significant tension with emotionally charged moments, such as arguments or chase scenes
        - name: MODERATE
          description: Some tension present, engaging but not overwhelming, such as mild conflict or anticipation
        - name: LOW
          description: Minimal tension with calm or relaxed scenes, such as exposition or casual dialogue
        - name: UNKNOWN
          description: Unable to determine tension level
    ScenePacing:
      type: string
      enum:
        - SLOW
        - MEASURED
        - BRISK
        - FRANTIC
        - UNKNOWN
      x-enum-elements:
        - name: SLOW
          description: Deliberate, unhurried pace with contemplative moments or establishing shots
        - name: MEASURED
          description: Steady, controlled pace typical of dialogue-driven scenes or methodical storytelling
        - name: BRISK
          description: Quick, energetic pace found in action sequences or montages
        - name: FRANTIC
          description: Rapid, chaotic pace with intense action or panic-driven scenes
        - name: UNKNOWN
          description: Unable to determine pacing
    IabTaxonomy:
      type: object
      required:
        - contentTaxonomies
        - adOpportunityTaxonomies
        - sensitiveTopicTaxonomies
      properties:
        contentVersion:
          type: string
          description: Version of the IAB Content Taxonomy used by `contentTaxonomies` and `sensitiveTopicTaxonomies`, such as `3.1`.
        adProductVersion:
          type: string
          description: Version of the IAB Ad Product Taxonomy used by `adOpportunityTaxonomies`, such as `2.0`.
        contentTaxonomies:
          type: array
          description: IAB Content Taxonomy IDs describing the scene's subject matter. Empty when no IDs were returned, including when the taxonomy result was unavailable.
          items:
            type: string
        adOpportunityTaxonomies:
          type: array
          description: IAB Ad Product Taxonomy IDs for advertising categories relevant to the scene. Empty when no IDs were returned, including when the taxonomy result was unavailable.
          items:
            type: string
        sensitiveTopicTaxonomies:
          type: array
          description: Sensitive topics in the scene, as IAB Content Taxonomy ids (not names). Empty when none were found, or when the analysis did not produce the list.
          items:
            type: string
    Shot:
      type: object
      required:
        - startInSeconds
        - endInSeconds
      properties:
        startInSeconds:
          type: number
          format: double
          description: The start time of the shot in seconds from the beginning of the video
        endInSeconds:
          type: number
          format: double
          description: The end time of the shot in seconds from the beginning of the video
        detailedDescription:
          type: string
          description: A comprehensive textual description of the visual content, action, and context within this shot. Absent when not determined.
        keywords:
          type: array
          description: A list of relevant keywords and tags that describe the content, themes, or notable elements in this shot. Can be empty or absent when no keywords were returned, including when shot-detail analysis was unavailable.
          items:
            type: string
        mainSubjects:
          type: array
          description: Selected physical subjects described in the shot. Positions refer to a sampled frame. Can be empty or absent when no subjects were returned, including when shot-detail analysis was unavailable.
          items:
            $ref: "#/components/schemas/MainSubject"
        shotAdvisories:
          description: Content advisory detection results for this shot, such as tobacco or vaping imagery. Absent when no advisory assessment is available or the result contains an unsupported advisory value. If the model declined assessment and a blocked result was returned, its status is `BLOCKED`.
          allOf:
            - $ref: "#/components/schemas/ShotAdvisories"
    MainSubject:
      type: object
      required:
        - classification
        - description
        - appearanceTimeInSeconds
        - centerX
        - centerY
      properties:
        classification:
          type: string
          description: Category of the subject, usually an Open Images V7 class name such as `Person` or `Vehicle`. Other text values can occur.
        description:
          type: string
          description: A detailed textual description of the subject's appearance and characteristics
        appearanceTimeInSeconds:
          type: number
          format: double
          description: Time in seconds from the start of the shot to the subject's sampled appearance.
        centerX:
          type: number
          format: double
          description: Horizontal centre as a percentage from the left edge (0–100).
        centerY:
          type: number
          format: double
          description: Vertical centre as a percentage from the top edge (0–100).
        box2d:
          type: array
          description: Bounding box at the subject's sampled appearance, in `[ymin, xmin, ymax, xmax]` order. Integer coordinates use a 0–1000 scale with a top-left origin, normalized independently against the full frame height and width. Empty when no box is available in the source result. Absent when the source omits the field. The centre coordinates remain usable when no box is available.
          items:
            type: integer
    ShotAdvisories:
      type: object
      required:
        - status
        - advisories
      properties:
        status:
          description: Whether and how the shot was assessed for content advisories
          allOf:
            - $ref: "#/components/schemas/AdvisoryAnalysisStatus"
        advisories:
          type: array
          description: Advisories reported for this shot. Use the `status` to distinguish assessed shots from blocked shots.
          items:
            $ref: "#/components/schemas/ContentAdvisory"
    AdvisoryAnalysisStatus:
      type: string
      enum:
        - ANALYZED
        - BLOCKED
      x-enum-elements:
        - name: ANALYZED
          description: Advisory assessment completed, including shots cleared by the scene pre-filter
        - name: BLOCKED
          description: The model declined to assess the shot. A conservative `TOBACCO` advisory with `UNKNOWN` confidence marks it for manual review
    ContentAdvisory:
      type: object
      required:
        - category
        - confidence
      properties:
        category:
          description: Kind of imagery reported or conservatively assumed.
          allOf:
            - $ref: "#/components/schemas/AdvisoryCategory"
        confidence:
          description: Confidence tier based on the visual evidence for a reported finding, or `UNKNOWN` when blocked.
          allOf:
            - $ref: "#/components/schemas/AdvisoryConfidence"
        reason:
          type: string
          description: A short explanation of what was seen in the shot. Can also explain why a blocked shot was flagged for review. Absent when no reason is available.
    AdvisoryCategory:
      type: string
      enum:
        - TOBACCO
        - VAPE
      x-enum-elements:
        - name: TOBACCO
          description: Tobacco imagery such as smoking, cigarettes, cigars, pipes, or tobacco products
        - name: VAPE
          description: Vaping imagery such as e-cigarettes, vape pens, or their use
    AdvisoryConfidence:
      type: string
      enum:
        - HIGH
        - MEDIUM
        - LOW
        - UNKNOWN
      x-enum-elements:
        - name: HIGH
          description: The finding rests on the product itself, or on tobacco packaging, an ashtray or legible tobacco branding or signage, visible in the shot
        - name: MEDIUM
          description: The finding rests on a plume or trail of smoke or vapor rising from a person, not on the product itself
        - name: LOW
          description: The model flagged the shot on a cue it could not resolve, for example a small, dark or fleeting object, and another reading of it is possible. Detection is tuned to flag uncertain cases rather than miss them, so advisories below HIGH confidence are expected
        - name: UNKNOWN
          description: No verdict was available because the model declined to assess the shot. For a `BLOCKED` shot, the advisory flags the shot for manual review
    AdOpportunity:
      type: object
      properties:
        reason:
          type: string
          description: The reason why the scene was rated with a certain score. Can be empty when no explanation is available.
        score:
          type: number
          format: double
          description: Score from 0.0 to 1.0 rating the ad placement suitability at the end of a scene based on content analysis. Higher values indicate greater suitability. A score of `0.5` can also be returned when the scene was not assessed.
          minimum: 0
          maximum: 1
    ClipAvailability:
      type: object
      description: Whether clips can be created from an analysis.
      required:
        - available
      properties:
        available:
          type: boolean
          description: Whether clips can be created from the analysis now.
        reason:
          description: Why not. Set exactly while `available` is `false`.
          allOf:
            - $ref: "#/components/schemas/ClipUnavailableReason"
    ClipUnavailableReason:
      type: string
      description: |
        Why no clips can be created from an analysis. When several apply, the first in this list:

        - `UNSUPPORTED_FILE_TYPE`: clips can't be made from the uploaded file's type. Judged by the extension of `fileName`; supported are `mp4`, `mov`, `mkv`, `m4v`, `avi` and `webm`.
        - `NOT_FINISHED`: the analysis is not `FINISHED`.
        - `TOO_LONG`: the video is longer than the longest video an analysis may have (`limits.maxDurationSeconds` in `getUsage`).
        - `CREATED_BEFORE_CLIPS`: the analysis is older than clips, and its original upload is gone. Upload the video again to create clips.
        - `SOURCE_NOT_KEPT`: the original upload is not kept with the analysis yet. Reading the analysis again retries.

        More reasons can be added. A client treats a reason it does not know like any other: clips
        are not available.
      enum:
        - UNSUPPORTED_FILE_TYPE
        - NOT_FINISHED
        - TOO_LONG
        - CREATED_BEFORE_CLIPS
        - SOURCE_NOT_KEPT
    ClipMode:
      type: string
      description: |
        What the clip service makes of the video. Every mode makes vertical (9:16) clips.

        - `FULL_VERTICAL_CROP`: the whole video, cropped to vertical
        - `PROMPTED_CLIPS`: clips of the moments the `prompt` asks for
        - `MICRODRAMA`: short episodes that tell the video's story
      enum:
        - FULL_VERTICAL_CROP
        - PROMPTED_CLIPS
        - MICRODRAMA
    ClipOptions:
      type: object
      description: |
        How the clips are made. More options can be added; each comes with a default, so a request
        without it keeps working as before. This API ignores an option it does not know. In a
        response, every option shows the value the job uses.
      properties:
        subtitles:
          type: boolean
          default: true
          description: Burn subtitles of what is said into the clips.
    CreateClipJobRequest:
      type: object
      required:
        - mode
      properties:
        mode:
          description: What to make.
          allOf:
            - $ref: "#/components/schemas/ClipMode"
        prompt:
          type: string
          minLength: 1
          maxLength: 1000
          description: |
            What the clips should show, in the user's words. Required with `PROMPTED_CLIPS`, refused
            with any other mode, and refused when it is only whitespace (`VALIDATION`).
          example: The three funniest moments
        options:
          description: Settings for the clips. Leaving out an option, or `options` as a whole, means its default.
          allOf:
            - $ref: "#/components/schemas/ClipOptions"
    ClipJobState:
      type: string
      description: |
        - `SUBMITTING`: created; the video is being handed over to the clip service, which can take minutes for a long video
        - `PROCESSING`: the clips are being made
        - `READY`: the clips are done; see `episodes`
        - `FAILED`: no clips were made; see `error`
      enum:
        - SUBMITTING
        - PROCESSING
        - READY
        - FAILED
    ClipJobErrorCode:
      type: string
      description: |
        Why a clip job failed. Clients branch on this, never on `message`.

        - `SOURCE_REJECTED`: the clip service can't use this video. Another job for it fails the same way.
        - `UNAVAILABLE`: creating clips was temporarily unavailable. Try again later.
        - `BUSY`: the clip service was busy. Try again in a few minutes.
        - `PIPELINE_FAILED`: making the clips failed; `message` is the clip service's reason.
        - `LAUNCH_FAILED`: the job could not be started. Try again.
        - `OUTCOME_UNKNOWN`: the job got no clear answer from the clip service and was given up. Try again.

        More codes can be added. A client shows `message` for a code it does not know.
      enum:
        - SOURCE_REJECTED
        - UNAVAILABLE
        - BUSY
        - PIPELINE_FAILED
        - LAUNCH_FAILED
        - OUTCOME_UNKNOWN
    ClipJobError:
      type: object
      description: Why the job failed. Only set in state `FAILED`.
      required:
        - code
        - message
      properties:
        code:
          description: The reason, for clients to branch on.
          allOf:
            - $ref: "#/components/schemas/ClipJobErrorCode"
        message:
          type: string
          description: The reason in words, safe to show to the user.
          example: This video can't be used for clips.
    ClipEpisode:
      type: object
      description: One clip of a `READY` job.
      required:
        - number
      properties:
        number:
          type: integer
          minimum: 1
          description: Position of the clip in the job, counted from 1 without gaps. The `episode` of `getClipEpisodeMedia`.
          example: 1
        title:
          type: string
          description: Title the clip service gave the clip. Absent when it gave none.
          example: The storm hits the harbour
        editedAt:
          type: string
          format: date-time
          description: |
            When the newest edit of the clip finished in the web app's editor; get it with
            `getClipEpisodeMedia` and `version=EDITED`. Brought up to date when the job is read. Absent while the clip has no
            finished edit.
    ClipJob:
      type: object
      description: One request to cut an analysis's video into clips, and its outcome.
      required:
        - id
        - analysisId
        - state
        - mode
        - options
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          description: Identifier of the clip job.
          example: 0b9e4d2c-5a1f-4e8b-b3c7-2f6a9d1e8c40
        analysisId:
          type: string
          description: The `id` of the analysis whose video the clips are cut from.
          example: 7f3c2a1e-0b4d-4c7e-9a52-1d2e3f4a5b6c
        state:
          description: Where the job is. Brought up to date when the job is read.
          allOf:
            - $ref: "#/components/schemas/ClipJobState"
        mode:
          description: What the job makes.
          allOf:
            - $ref: "#/components/schemas/ClipMode"
        prompt:
          type: string
          description: The prompt given at create. Only set with `PROMPTED_CLIPS`.
          example: The three funniest moments
        options:
          description: The options the job uses, defaults included.
          allOf:
            - $ref: "#/components/schemas/ClipOptions"
        createdAt:
          type: string
          format: date-time
          description: When the job was created.
        updatedAt:
          type: string
          format: date-time
          description: When the job last changed.
        finishedAt:
          type: string
          format: date-time
          description: When the job became `READY` or `FAILED`.
        error:
          description: Why the job failed. Only set in state `FAILED`.
          allOf:
            - $ref: "#/components/schemas/ClipJobError"
        episodes:
          type: array
          description: |
            The clips, in order; their number is the episode count. Only set in state `READY`, and
            then with at least one clip.
          items:
            $ref: "#/components/schemas/ClipEpisode"
        editable:
          type: boolean
          description: |
            Whether the web app can open the job's clips in its editor now: the job is `READY` and
            this environment offers the editor. Clips are edited only in the web app. Treat an absent `editable` as `false`.
    ClipJobPage:
      type: object
      required:
        - items
        - total
        - limit
        - offset
      properties:
        items:
          type: array
          description: The jobs of this page, newest first.
          items:
            $ref: "#/components/schemas/ClipJob"
        total:
          type: integer
          description: Total number of the analysis's clip jobs, regardless of paging.
        limit:
          type: integer
          description: The `limit` this page was read with.
        offset:
          type: integer
          description: The `offset` this page was read with.
    ClipEpisodeMedia:
      type: object
      description: |
        Signed URLs for one clip. They need no credentials: the URL is the credential, so don't log
        or share it.
      required:
        - episodeUrl
        - downloadUrl
        - expiresAt
      properties:
        episodeUrl:
          type: string
          format: uri
          description: The clip as MP4, for the `src` of a `<video>` element. It supports range requests, so the video can seek.
          example: https://storage.googleapis.com/clips/0b9e4d2c/episode_001.mp4?X-Goog-Signature=3f9a
        posterUrl:
          type: string
          format: uri
          description: |
            A still of the clip, for the video's `poster`. Absent when the clip has none. Posters are
            made on a best-effort basis, so even a given one can fail to load; show the video without
            it then.
          example: https://storage.googleapis.com/clips/0b9e4d2c/episode_001.webp?X-Goog-Signature=7c2e
        downloadUrl:
          type: string
          format: uri
          description: "The same clip served as a file download (`Content-Disposition: attachment`), for a download link."
          example: https://storage.googleapis.com/clips/0b9e4d2c/episode_001.mp4?response-content-disposition=attachment&X-Goog-Signature=9d41
        expiresAt:
          type: string
          format: date-time
          description: |
            When the URLs stop working. Each request is checked, so a playback that started earlier
            can fail after this, at its next seek: get new URLs and continue from the same position.
    ClipVersion:
      type: string
      description: |
        - `ORIGINAL`: the clip as the clip service made it
        - `EDITED`: the newest finished edit of the clip
      enum:
        - ORIGINAL
        - EDITED
    Usage:
      type: object
      required:
        - jobs
        - limits
        - storage
        - plan
        - period
        - minutes
        - clips
      properties:
        jobs:
          $ref: "#/components/schemas/JobQuota"
        limits:
          $ref: "#/components/schemas/Limits"
        storage:
          $ref: "#/components/schemas/StorageQuota"
        plan:
          $ref: "#/components/schemas/Plan"
        period:
          $ref: "#/components/schemas/UsagePeriod"
        minutes:
          $ref: "#/components/schemas/MinutesQuota"
        clips:
          $ref: "#/components/schemas/ClipsQuota"
        subscription:
          allOf:
            - $ref: "#/components/schemas/Subscription"
    Plan:
      type: object
      description: |
        The plan your account is on. It sets `storage.limitBytes`, the storage for your source videos,
        `minutes.limitSeconds` and `clips.limit`, the video you can analyse and the clips you can make
        per period (none of these for test accounts), and can lower `limits`.
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: The plan's identifier, a lower-case slug. New plans may be added.
          example: free
        name:
          type: string
          description: The plan's name, for display.
          example: Free
    JobQuota:
      type: object
      description: |
        Your analysis slots. Creating an analysis takes a slot; `CANCELLED` and `FAILED` free it.
        An `UPLOADING` analysis holds its slot for 7 days from creation.
      required:
        - used
        - limit
        - remaining
      properties:
        used:
          type: integer
          example: 3
        limit:
          type: integer
          example: 10
        remaining:
          type: integer
          example: 7
    StorageQuota:
      type: object
      description: |
        The storage your source videos and clips take. Your plan limits only the source videos
        (`sourceBytes`); clips have no limit, and are counted so you can see what they take.

        A source video counts the size declared for its upload, and once its analysis has finished
        and been measured, the files it keeps; a failed or cancelled analysis, and an upload whose
        upload window has passed, count nothing. A clip job counts its clips and posters once they
        have been measured, which happens when the ready job itself (not the list) is read, or for a
        job that is only listed, by a background check that runs several times an hour. A successful
        delete frees the storage of an analysis or clip job at once.
      required:
        - usedBytes
        - sourceBytes
        - clipBytes
      properties:
        usedBytes:
          type: integer
          format: int64
          minimum: 0
          description: All the storage you use, `sourceBytes` plus `clipBytes`.
          example: 3600000000
        sourceBytes:
          type: integer
          format: int64
          minimum: 0
          description: The storage your source videos take, what `limitBytes` applies to.
          example: 3200000000
        clipBytes:
          type: integer
          format: int64
          minimum: 0
          description: The storage your clips take. It has no limit.
          example: 400000000
        limitBytes:
          type: integer
          format: int64
          minimum: 0
          description: |
            The storage your plan includes for source videos, which `sourceBytes` is held to; clips
            do not count. Absent when there is no limit. Creating an analysis is refused
            (`QUOTA_EXCEEDED`, field `storage`) when its declared size does not fit into what
            `sourceBytes` leaves. `sourceBytes` can still end up above the limit: a finished analysis
            counts the files it keeps, which can be more than its declared size.
          example: 5000000000
    UsagePeriod:
      type: object
      description: |
        The period `minutes` and `clips` are counted in. On a paid plan, the period is your billing
        period, split into months for a yearly price; otherwise it runs monthly from the day (UTC) you
        signed up. Signed up on the 29th, 30th or 31st, a month without that day has its period start
        on its last day. Both ends are midnight UTC; usage resets at `end`, which is the next period's
        `start`.
      required:
        - start
        - end
      properties:
        start:
          type: string
          format: date-time
          description: When the current period began.
          example: 2026-11-03T00:00:00Z
        end:
          type: string
          format: date-time
          description: When the current period ends and `minutes` and `clips` start again from 0.
          example: 2026-12-03T00:00:00Z
    MinutesQuota:
      type: object
      description: |
        The video you analysed in the current period. Each finished analysis counts its video's
        length, rounded up to a whole second, on the day (UTC) it finished. A failed or cancelled
        analysis counts nothing, and deleting an analysis does not give its seconds back.
      required:
        - usedSeconds
      properties:
        usedSeconds:
          type: integer
          format: int64
          minimum: 0
          description: The seconds of video analysed in this period.
          example: 1260
        limitSeconds:
          type: integer
          format: int64
          minimum: 0
          description: |
            The seconds of video your plan includes per period. Absent when there is no limit.
            Starting an analysis is refused (`QUOTA_EXCEEDED`, field `minutes`) when none are left.
            An analysis whose video is longer than what is left ends `FAILED` with the message "The
            video is longer than the minutes left in this period." as soon as its length is known,
            and counts nothing, so finished analyses never take `usedSeconds` above the limit; it is
            above it only when your limit was lowered or newly set during the period. Analyses still
            `QUEUED` or `PROCESSING` already hold their videos' lengths of what is left, rounded up to
            whole seconds, though `usedSeconds` counts them only once they finish.
          example: 3600
    ClipsQuota:
      type: object
      description: |
        The clips you made in the current period. A clip job counts its clips once it is `READY`, on
        the day (UTC) it got there. A failed job counts nothing, and deleting a clip job does not
        give its clips back.
      required:
        - used
      properties:
        used:
          type: integer
          minimum: 0
          description: The clips made in this period.
          example: 4
        limit:
          type: integer
          minimum: 0
          description: |
            The clips your plan includes per period. Absent when there is no limit. Creating a clip
            job is refused (`QUOTA_EXCEEDED`, field `clips`) once `used` has reached it. A job's clips
            count only once it is `READY`, and one job can make several, so jobs created before the
            limit was reached can take `used` above it.
          example: 20
    Limits:
      type: object
      required:
        - maxFileSizeBytes
        - maxDurationSeconds
      properties:
        maxFileSizeBytes:
          type: integer
          format: int64
          example: 2147483648
        maxDurationSeconds:
          type: integer
          description: |
            The longest video an analysis may have, in seconds. After the start, the whole video is read
            to measure its length. An analysis of a longer video ends `FAILED`, without results, before
            it is processed, and so does one that can't be read as a video. Its start doesn't count.
          example: 1800
    Subscription:
      type: object
      description: |
        The subscription you pay your plan with, as the payment provider last reported it. Absent
        while you have none, or once it has ended: you are then on the free plan.
      required:
        - status
      properties:
        status:
          $ref: "#/components/schemas/SubscriptionStatus"
        renewsAt:
          type: string
          format: date-time
          description: |
            When the current billing period ends and the plan is renewed and charged again. Absent
            when the subscription is set to end (`cancelAt`), and while it doesn't pay for the plan
            (`UNPAID`, `INCOMPLETE`, `PAUSED`).
          example: 2026-12-03T10:15:00Z
        cancelAt:
          type: string
          format: date-time
          description: |
            When the subscription ends, as it is set to. While it pays, you keep your plan until
            then; you are on the free plan after it. Absent when it renews.
          example: 2026-12-03T10:15:00Z
        change:
          $ref: "#/components/schemas/PlanChange"
    SubscriptionStatus:
      type: string
      description: |
        - `ACTIVE`: paid, the plan applies
        - `TRIALING`: in a free trial, the plan applies
        - `PAST_DUE`: the last payment failed and is being retried; the plan still applies
        - `UNPAID`: the payment retries ran out; you are on the free plan until it is paid
        - `INCOMPLETE`: the first payment has not gone through yet; the plan applies once it has
        - `PAUSED`: paused; you are on the free plan while it is

        New values may be added.
      enum:
        - ACTIVE
        - TRIALING
        - PAST_DUE
        - UNPAID
        - INCOMPLETE
        - PAUSED
    PlanChange:
      type: object
      description: |
        A move to another plan at `at`, set from the web app. In `getUsage`, a change set for later (a
        smaller plan, or the end of a cancelled subscription), absent when none is set.
      required:
        - plan
        - at
      properties:
        plan:
          $ref: "#/components/schemas/Plan"
        at:
          type: string
          format: date-time
          description: |
            When you move to `plan`: the end of the current billing period (for a cancellation, an
            earlier end set already). A larger plan applies right away, when it is chosen.
          example: 2026-12-03T10:15:00Z
    PlanList:
      type: object
      required:
        - items
      properties:
        items:
          type: array
          description: Every plan, by `id`.
          items:
            $ref: "#/components/schemas/PlanOffer"
    PlanOffer:
      type: object
      description: |
        A plan and the limits it sets. A limit that is absent is not set by the plan. Test accounts
        have none of the plan's limits on storage, minutes and clips.
      required:
        - id
        - name
        - limits
      properties:
        id:
          type: string
          description: The plan's identifier, as `plan.id` in `getUsage`. New plans may be added.
          example: creator
        name:
          type: string
          description: The plan's name, for display.
          example: Creator
        limits:
          $ref: "#/components/schemas/Limits"
        storageLimitBytes:
          type: integer
          format: int64
          minimum: 0
          description: The storage for source videos, as `storage.limitBytes` in `getUsage`.
          example: 50000000000
        minutesLimitSeconds:
          type: integer
          format: int64
          minimum: 0
          description: The seconds of video you can analyse per period, as `minutes.limitSeconds` in `getUsage`.
          example: 36000
        clipsLimit:
          type: integer
          minimum: 0
          description: The clips you can make per period, as `clips.limit` in `getUsage`.
          example: 100
        price:
          $ref: "#/components/schemas/PlanPrice"
    PlanPrice:
      type: object
      description: |
        What the plan costs. Present only for a plan you can buy now, in the web app; absent for a
        free plan, and for any plan while buying is not available.
      required:
        - amount
        - currency
        - interval
      properties:
        amount:
          type: integer
          format: int64
          minimum: 0
          description: The price per interval in the currency's smallest unit (cents for EUR).
          example: 1900
        currency:
          type: string
          pattern: ^[A-Z]{3}$
          description: ISO 4217 currency code.
          example: EUR
        interval:
          $ref: "#/components/schemas/BillingInterval"
    BillingInterval:
      type: string
      description: How often the price is charged. New values may be added.
      enum:
        - MONTH
        - YEAR
