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

# Upload File

> Upload a media file using multipart form data.

Upload an image or video file using multipart form data. The response includes an `id` and `path` that can be used as a reference in generation requests.

## Accepted MIME types

| Type   | MIME types                                   |
| ------ | -------------------------------------------- |
| Images | `image/jpeg`, `image/png`, `image/webp`      |
| Videos | `video/mp4`, `video/quicktime`, `video/webm` |

Direct multipart uploads are limited to `20MB`.


## OpenAPI

````yaml openapi.json POST /v1/upload
openapi: 3.1.0
info:
  title: TurboAds Public API
  version: 1.0.0
  description: >-
    Workspace-scoped API for creating media generation jobs and polling for
    results.
servers:
  - url: https://api.turboads.ai
security:
  - bearerAuth: []
tags:
  - name: Projects
    description: Discover projects available to the API key workspace.
  - name: Voices
    description: Discover voices for talking actor generations.
  - name: Actors
    description: Discover actors for talking actor generations.
  - name: Images
    description: Create image generation jobs, poll status, and fetch final URLs.
  - name: Videos
    description: Create video generation jobs, poll status, and fetch final URLs.
  - name: Replace Actors
    description: Create motion-transfer jobs from a character image and reference video.
  - name: Talking Actors
    description: Create AI actor videos, poll status, and fetch final URLs.
paths:
  /v1/upload:
    post:
      tags:
        - Uploads
      summary: Upload File
      description: >-
        Upload an image or video using multipart form data. Direct multipart
        uploads are limited to 20MB by Convex HTTP action limits; use Upload
        from URL for larger videos up to 50MB.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: Image or video file to upload.
                project_id:
                  type: string
                  description: Optional project ID to associate with the uploaded file.
      responses:
        '200':
          description: File uploaded successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/FileUpload'
              examples:
                success:
                  summary: Success
                  value:
                    data:
                      id: k97file123abc456def789
                      name: product-reference.png
                      path: >-
                        https://media.turboads.ai/workspaces/j57workspace123abc456def789/file-uploads/uuid/product-reference.png
                      workspace_id: j57workspace123abc456def789
                      project_id: j97project123abc456def789
                      file_type: image
                      mime_type: image/png
                      file_size: 482193
                      created_at: 1782225600000
                      updated_at: 1782225600000
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    FileUpload:
      type: object
      required:
        - id
        - name
        - path
        - workspace_id
        - project_id
        - file_type
        - mime_type
        - file_size
        - created_at
        - updated_at
      properties:
        id:
          type: string
          description: File upload ID to pass into generation requests.
        name:
          type: string
          description: Original file name.
        path:
          type: string
          format: uri
          description: Public media URL on the TurboAds media domain.
        workspace_id:
          type: string
        project_id:
          type:
            - string
            - 'null'
        file_type:
          type: string
          enum:
            - image
            - video
        mime_type:
          type: string
          enum:
            - image/jpeg
            - image/png
            - image/webp
            - video/mp4
            - video/quicktime
            - video/webm
        file_size:
          type: integer
          description: File size in bytes.
        created_at:
          type: number
          description: Unix timestamp in milliseconds.
        updated_at:
          type: number
          description: Unix timestamp in milliseconds.
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
    RateLimitErrorResponse:
      type: object
      required:
        - error
        - retry_after_ms
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
        retry_after_ms:
          type: number
          description: Milliseconds to wait before retrying.
    ApiError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable machine-readable error code.
        message:
          type: string
          description: Human-readable error message.
  responses:
    BadRequest:
      description: The request body or parameters are invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Required fields are missing or malformed.
              value:
                error:
                  code: invalid_request
                  message: Required fields are missing or malformed.
    Unauthorized:
      description: The API key is missing, invalid, or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Missing, invalid, or revoked API key.
              value:
                error:
                  code: unauthorized
                  message: Missing, invalid, or revoked API key.
    Forbidden:
      description: The requested project is outside the API key workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Project does not belong to this API key workspace.
              value:
                error:
                  code: forbidden
                  message: Project does not belong to this API key workspace.
    RateLimited:
      description: The API key exceeded its rate limit.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/RateLimitErrorResponse'
          examples:
            error:
              summary: Rate limited
              value:
                error:
                  code: rate_limited
                  message: Rate limit exceeded.
                retry_after_ms: 1200
    InternalServerError:
      description: Unexpected server or storage configuration error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            error:
              summary: Internal server error
              value:
                error:
                  code: internal_error
                  message: Something went wrong.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Your TurboAds API key
      x-default: ta_live_your_api_key

````