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

# Start a resumable upload

> Starts a resumable upload session for one orientation of a video. Send the file in 8 MB chunks with `PATCH /uploads/{upload}`, then finish with `POST /uploads/{upload}/complete`. The session expires 24 hours after it is created.

For files under 100 MB, the single-shot upload endpoint is simpler.

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



## OpenAPI

````yaml /api-reference/openapi.json post /videos/{video}/upload/init
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/init:
    post:
      tags:
        - Uploads
      summary: Start a resumable upload
      description: >-
        Starts a resumable upload session for one orientation of a video. Send
        the file in 8 MB chunks with `PATCH /uploads/{upload}`, then finish with
        `POST /uploads/{upload}/complete`. The session expires 24 hours after it
        is created.


        For files under 100 MB, the single-shot upload endpoint is simpler.


        Requires a token with the `videos:write` scope.
      operationId: initVideoUpload
      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:
          application/json:
            schema:
              $ref: '#/components/schemas/UploadInitRequest'
      responses:
        '201':
          description: The upload session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadInitResponse'
        '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'
        '422':
          description: >-
            Validation failed. Check `size` is between 1 and 5,368,709,120
            bytes, and `mime_type` is one of the supported video types.
          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:
    UploadInitRequest:
      type: object
      required:
        - filename
        - size
        - mime_type
      properties:
        filename:
          type: string
          maxLength: 255
        size:
          type: integer
          minimum: 1
          maximum: 5368709120
          description: >-
            The file size in bytes. Capped at 5 GB (5,368,709,120 bytes), the
            same ceiling as the dashboard.
        mime_type:
          type: string
          enum:
            - video/mp4
            - video/quicktime
            - video/x-m4v
            - video/x-msvideo
            - video/webm
            - video/ogg
            - video/3gpp
            - video/x-matroska
        orientation:
          type: string
          enum:
            - landscape
            - portrait
          default: landscape
          description: Which of the video's two orientation slots this upload fills.
    UploadInitResponse:
      type: object
      properties:
        upload_id:
          type: string
          examples:
            - tpup_8f2c9a1b3e4d5f607182930a4b5c6d7e
        chunk_size:
          type: integer
          description: >-
            Bytes to send per `PATCH` chunk (8,388,608, fixed by the server).
            The last chunk is whatever is left.
          examples:
            - 8388608
        offset:
          type: integer
          description: Bytes received so far. `0` at init.
        size:
          type: integer
          description: The size you declared.
        expires_at:
          type: string
          format: date-time
          description: The session and its chunks expire after this time.
        upload_url:
          type: string
          format: uri
          description: Where to `PATCH` chunks.
    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
  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.