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

# Upload a file

> Uploads one local image, video, or audio file and returns a reusable file ID.



## OpenAPI

````yaml /openapi.json post /openapi/v1/files
openapi: 3.0.3
info:
  title: Neural4D API
  description: >-
    API v1 uploads reusable input files, creates videos asynchronously, and
    retrieves task status and results.
  version: 1.0.0
servers:
  - url: https://api.neural4d.com
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Video generation
    description: Create asynchronous video generation tasks.
  - name: Tasks
    description: Poll asynchronous tasks by ID.
  - name: Files
    description: Upload input files for reuse in generation requests.
paths:
  /openapi/v1/files:
    post:
      tags:
        - Files
      summary: Upload a file
      description: >-
        Uploads one local image, video, or audio file and returns a reusable
        file ID.
      operationId: uploadFile
      parameters: []
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateManagedFileRequest'
      responses:
        '201':
          description: File uploaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedFile'
              example:
                id: 550e8400-e29b-41d4-a716-446655440000
                filename: first-frame.png
                bytes: 245760
                mime_type: image/png
                created_at: 1784044800
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      servers:
        - url: https://api.neural4d.com
          description: Production server
components:
  schemas:
    CreateManagedFileRequest:
      type: object
      required:
        - file
      additionalProperties: false
      properties:
        file:
          type: string
          format: binary
          description: >-
            File to upload. Supported image formats: JPG, JPEG, PNG, GIF, WEBP,
            BMP, HEIC, and HEIF. Supported video formats: MP4, MOV, WEBM, M4V,
            OGG, and OGV. Supported audio formats: MP3 and WAV.
    ManagedFile:
      type: object
      required:
        - id
        - filename
        - bytes
        - mime_type
        - created_at
      additionalProperties: false
      properties:
        id:
          type: string
          pattern: >-
            ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
          example: 550e8400-e29b-41d4-a716-446655440000
          description: File ID used by generation requests.
        filename:
          type: string
          example: first-frame.png
          description: Original name of the uploaded file.
        bytes:
          type: integer
          format: int64
          minimum: 0
          example: 245760
          description: Uploaded file size in bytes.
        mime_type:
          type: string
          example: image/png
          description: Media type detected for the uploaded file.
        created_at:
          type: integer
          format: int64
          description: Unix timestamp in seconds when the file was created.
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/ApiError'
          description: Structured error details.
    ApiError:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Stable machine-readable error code.
          example: invalid_prompt
        message:
          type: string
          example: prompt is required and must be a non-empty string
          description: Human-readable explanation of the error.
        doc_url:
          type: string
          format: uri
          nullable: true
          example: https://api.neural4d.com/docs/errors#invalid_prompt
          description: Optional documentation URL with more information about the error.
  responses:
    BadRequest:
      description: Invalid request
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invalid_prompt:
              summary: Invalid prompt
              value:
                error:
                  code: invalid_prompt
                  message: prompt is required and must be a non-empty string
            unsupported_model:
              summary: Unsupported model
              value:
                error:
                  code: unsupported_model
                  message: 'Unsupported modelKey: missing-model'
            model_unavailable:
              summary: Model unavailable
              value:
                error:
                  code: model_unavailable
                  message: 'Model is unavailable: veo-3.1'
    Unauthorized:
      description: Authentication failed
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: invalid_api_key
              message: The API key is invalid or expired
    Forbidden:
      description: >-
        The authenticated user cannot access this resource or has insufficient
        credits
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: insufficient_credits
              message: Insufficient credits for video generation
    RateLimited:
      description: Request or quota limit exceeded
      headers:
        Retry-After:
          $ref: '#/components/headers/RetryAfter'
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: rate_limit_exceeded
              message: Too many requests. Retry after the indicated interval.
    InternalError:
      description: Internal or upstream service error
      headers:
        x-ratelimit-limit-requests:
          $ref: '#/components/headers/RateLimitLimitRequests'
        x-ratelimit-remaining-requests:
          $ref: '#/components/headers/RateLimitRemainingRequests'
        x-ratelimit-reset-requests:
          $ref: '#/components/headers/RateLimitResetRequests'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            error:
              code: internal_error
              message: An internal error occurred
  headers:
    RateLimitLimitRequests:
      description: Request limit for the current window.
      schema:
        type: integer
        format: int32
        minimum: 0
    RateLimitRemainingRequests:
      description: Requests remaining in the current window.
      schema:
        type: integer
        format: int32
        minimum: 0
    RateLimitResetRequests:
      description: Time until the request window resets, such as 1s.
      schema:
        type: string
        example: 1s
    RetryAfter:
      description: Seconds to wait before retrying.
      schema:
        type: integer
        minimum: 0
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: Neural4D API key using the Bearer scheme.
      x-default: ${YOUR_API_KEY}

````