> ## 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.

# Upload a video in one request

> Uploads a video file in one `multipart/form-data` request, with the file in a `file` field. Same types as the resumable protocol. One request carries at most 3,000 MB (a larger body gets a 413 from the server before it reaches TrackPlay), and a request that fails partway has to restart from zero, so use it for clips under 100 MB.

The file goes down the same encode and auto-publish pipeline as a dashboard upload, and the `video.uploaded` webhook fires. Answers `202` with the status to poll.

Requires a token with the `videos:write` scope.



## OpenAPI

````yaml /api-reference/openapi.json post /videos/{video}/upload
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: []
tags:
  - name: Videos
    description: Create, read, update, and delete videos, and read workspace metadata.
  - name: Video settings
    description: Save a settings draft, publish it live, and read or restore past deploys.
  - name: Uploads
    description: >-
      Upload a source video file in one request or in resumable chunks, and poll
      its processing status.
  - name: Captions and chapters
    description: >-
      Manage caption tracks, chapter markers, AI-generated segments, and CTA
      cards on a video.
  - name: Playlists
    description: Group videos into a playlist or course, and manage the videos inside it.
  - name: Webhooks
    description: Subscribe a URL to TrackPlay lifecycle events and test deliveries.
  - name: Zapier
    description: >-
      The REST-hook endpoints Zapier calls to connect a workspace and manage
      triggers.
  - name: Analytics
    description: Read play, retention, event, and conversion analytics for a video.
  - name: Exports
    description: Queue and download bulk analytics exports.
  - name: Conversions
    description: Report a sale or a lead, from your own server or from a browser fallback.
  - name: Events
    description: Send a custom event tied to a viewer's session.
  - name: Identity
    description: Resolve a viewer's identity from the page, with no token required.
paths:
  /videos/{video}/upload:
    post:
      tags:
        - Uploads
      summary: Upload a video in one request
      description: >-
        Uploads a video file in one `multipart/form-data` request, with the file
        in a `file` field. Same types as the resumable protocol. One request
        carries at most 3,000 MB (a larger body gets a 413 from the server
        before it reaches TrackPlay), and a request that fails partway has to
        restart from zero, so use it for clips under 100 MB.


        The file goes down the same encode and auto-publish pipeline as a
        dashboard upload, and the `video.uploaded` webhook fires. Answers `202`
        with the status to poll.


        Requires a token with the `videos:write` scope.
      operationId: uploadVideoSingleShot
      parameters:
        - name: video
          in: path
          required: true
          schema:
            type: integer
          description: The video's numeric ID.
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
          description: >-
            Retry-safe key. The first response for a given key is cached for 24
            hours and replayed on a repeat, with `Idempotency-Replayed: true`
            set.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: >-
                    The video file. Up to 3,000 MB in one request (use the
                    resumable protocol for up to 5 GB). mp4, mov, m4v, avi,
                    webm, ogv, 3gp or mkv.
                orientation:
                  type: string
                  enum:
                    - landscape
                    - portrait
                  default: landscape
      responses:
        '202':
          description: >-
            Accepted. The file is stored and on its way to the encoder. Poll
            `GET /videos/{video}/status` until `status` is `ready`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoStatusEnvelope'
        '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 `videos:write`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: '`VIDEO_NOT_FOUND`: no video with that ID exists in this workspace.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '413':
          description: The request body is over 3,000 MB. Use the resumable protocol.
        '422':
          description: >-
            Validation failed. `file` is required, at most 5 GB, and must be a
            supported video type.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '429':
          description: Rate limited. 60 requests per minute per token.
        '507':
          description: >-
            `INSUFFICIENT_STORAGE`: the server cannot take a file this size
            right now. Retry later.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    VideoStatusEnvelope:
      type: object
      properties:
        video:
          $ref: '#/components/schemas/VideoStatus'
    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.
    ValidationError:
      type: object
      description: >-
        Laravel's default validation-failure body. `errors` maps each invalid
        field to its list of messages.
      properties:
        message:
          type: string
          examples:
            - The given data was invalid.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    VideoStatus:
      type: object
      description: >-
        The processing status of a video. Returned by every upload call and by
        `GET /videos/{video}/status`.
      properties:
        id:
          type: integer
        code:
          type: string
        title:
          type: string
        folder_id:
          type:
            - integer
            - 'null'
        status:
          type: string
          enum:
            - waiting_for_upload
            - processing
            - ready
            - error
          description: >-
            `waiting_for_upload`: no file yet. `processing`: on its way to, or
            in, the encoder. `ready`: every uploaded orientation finished
            encoding. `error`: an orientation failed; read its `error`.
        orientations:
          type: object
          properties:
            landscape:
              $ref: '#/components/schemas/OrientationStatus'
            portrait:
              $ref: '#/components/schemas/OrientationStatus'
        plain_mode:
          type: boolean
          description: >-
            Whether the video is set to plain mode (a silent looping clip with
            no overlays).
        status_url:
          type: string
          format: uri
        embed:
          type:
            - object
            - 'null'
          description: >-
            `null` until `status` is `ready`. The player publishes itself within
            about a minute of `ready`.
          properties:
            script_url:
              type: string
              format: uri
            html:
              type: string
              description: The standard embed snippet.
            plain_html:
              type: string
              description: >-
                The plain mode snippet (`data-trackplay-mode="plain"`, clean
                first-frame poster, script loaded only near the viewport).
    OrientationStatus:
      type:
        - object
        - 'null'
      description: '`null` until a file is sent for this orientation.'
      properties:
        status:
          type: string
          enum:
            - waiting_for_upload
            - processing
            - ready
            - error
        progress:
          type: integer
          description: Percentage. Moves in steps, not smoothly.
        error:
          type:
            - string
            - 'null'
          description: >-
            Why the encode failed, in a sentence you can show a person. `null`
            unless `status` is `error`.
  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_…`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.