> ## Documentation Index
> Fetch the complete documentation index at: https://payload-storage-bunny.seshuk.im/llms.txt
> Use this file to discover all available pages before exploring further.

# Create or resume a TUS upload session

> Creates the video in Bunny Stream (if needed) and returns a signed TUS authorization so the browser can upload directly to Bunny. Access is gated by `stream.tus.access` or the built-in rule. See [TUS uploads](/v4/configuration/stream/tus).



## OpenAPI

````yaml /v4/api-reference/openapi.json post /api/storage-bunny/stream/tus-auth
openapi: 3.1.0
info:
  description: >-
    HTTP endpoints the plugin registers on your Payload app under `/api`. The
    admin UI calls these for you; document and drive them yourself only if you
    build a custom upload flow.
  title: Payload Storage Bunny — Plugin API
  version: 4.0.0-beta.1
servers:
  - description: Your Payload app origin
    url: https://your-site.com
security:
  - payloadToken: []
paths:
  /api/storage-bunny/stream/tus-auth:
    post:
      tags:
        - Bunny Stream
      summary: Create or resume a TUS upload session
      description: >-
        Creates the video in Bunny Stream (if needed) and returns a signed TUS
        authorization so the browser can upload directly to Bunny. Access is
        gated by `stream.tus.access` or the built-in rule. See [TUS
        uploads](/v4/configuration/stream/tus).
      requestBody:
        content:
          application/json:
            schema:
              properties:
                collection:
                  description: Target upload collection.
                  type: string
                filename:
                  description: Original file name.
                  type: string
                filesize:
                  description: File size in bytes.
                  type: number
                filetype:
                  description: File MIME type.
                  type: string
                head:
                  description: >-
                    Base64 of the first bytes of the file (at most 8192
                    characters). When sent, the response includes a `filename`
                    and a `signedReceipt` for a client-direct upload.
                  type: string
                title:
                  description: Video title. Required when creating a new video.
                  type: string
                videoId:
                  description: >-
                    Existing Bunny video GUID, to resume an upload. Used only
                    with a matching `videoToken`.
                  type: string
                videoToken:
                  description: The `videoToken` returned with `videoId`.
                  type: string
              required:
                - collection
                - filename
                - filesize
                - filetype
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  authorizationExpire:
                    description: Signature expiry as a UNIX timestamp (seconds).
                    type: number
                  authorizationSignature:
                    description: SHA-256 TUS authorization signature.
                    type: string
                  filename:
                    description: >-
                      Returned when the request includes `head`. Unique
                      sanitized file name the `signedReceipt` is bound to;
                      submit the file under this name.
                    type: string
                  libraryId:
                    description: Bunny Stream library the video lives in.
                    type: number
                  signedReceipt:
                    description: >-
                      Returned when the request includes `head`. Send it as
                      `uploadReference.signedReceipt` of the file submitted with
                      the Payload document.
                    type: string
                  thumbnailTime:
                    description: Thumbnail capture time (ms), when configured.
                    type: number
                  type:
                    description: >-
                      `upload` returns a signature to proceed; `uploaded` means
                      the video already exists.
                    enum:
                      - upload
                      - uploaded
                    type: string
                  videoId:
                    description: Bunny video GUID.
                    type: string
                  videoToken:
                    description: >-
                      Token bound to `videoId` and the signed-in user, valid for
                      24 hours. Send it as `bunnyData.stream.videoToken` when
                      saving the document, and with `videoId` to resume.
                    type: string
                type: object
          description: >-
            TUS authorization for a new/resumed upload, or an `uploaded`
            short-circuit when the video is already processed.
        '400':
          description: >-
            Missing required fields, an invalid `head`, file name, MIME type or
            size, an SVG or XML file, a missing title for a new video, or Stream
            TUS uploads not enabled for the collection.
        '403':
          description: Access denied.
        '404':
          description: The collection does not exist.
        '413':
          description: The file exceeds `upload.limits.fileSize`.
        '415':
          description: >-
            The file type is restricted or not accepted by the collection or the
            Stream options.
        '500':
          description: >-
            Unexpected failure, such as a Bunny Stream API error. Details are
            hidden from the response.
components:
  securitySchemes:
    payloadToken:
      description: >-
        Payload authentication cookie. These endpoints run Payload access
        control; an authenticated admin session is required.
      in: cookie
      name: payload-token
      type: apiKey

````

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