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

# File Upload - Stream

> - Upload a file using multipart/form-data stream
- Returns the file ID and accessible URL after successful upload




## OpenAPI

````yaml openapi/en/upload-stream.json POST /v1/files/upload/stream
openapi: 3.1.0
info:
  title: File Stream Upload
  version: '1.0'
servers:
  - url: https://api.aihubmax.com
security:
  - BearerAuth: []
paths:
  /v1/files/upload/stream:
    post:
      tags:
        - File Management
      summary: File Stream Upload
      description: |
        - Upload a file using multipart/form-data stream
        - Returns the file ID and accessible URL after successful upload
      operationId: upload-stream
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: The file to upload
                file_name:
                  type: string
                  description: >-
                    Custom file name (with extension), uses the original file
                    name if not provided
                  example: photo.png
                auto_cleanup:
                  type: boolean
                  default: true
                  description: >
                    Whether to automatically clean up the earliest uploaded
                    files when storage is insufficient


                    **Notes:**

                    - Default `true`: Automatically evicts the earliest uploaded
                    files

                    - Set to `false`: Returns a 403 error directly when storage
                    is insufficient
                  example: true
      responses:
        '200':
          $ref: '#/components/responses/FileUploaded'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  responses:
    FileUploaded:
      description: File uploaded successfully
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/FileUploadResponse'
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse400'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse401'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse403'
    PayloadTooLarge:
      description: File too large
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse413'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse429'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse500'
  schemas:
    FileUploadResponse:
      type: object
      properties:
        id:
          type: string
          description: File ID
          example: file-1757165031-a1b2c3
        filename:
          type: string
          description: Original filename
          example: photo.png
        url:
          type: string
          description: Accessible URL of the uploaded file
          example: https://cdn.foxapi.cc/uploads/20260319/a1b2c3d4e5f6/photo.png
        size:
          type: integer
          description: File size in bytes
          example: 204800
        created:
          type: integer
          description: Upload timestamp
          example: 1757165031
    ErrorResponse400:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid request parameters
            type:
              type: string
              example: invalid_request_error
    ErrorResponse401:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid API key
            type:
              type: string
              example: authentication_error
    ErrorResponse403:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Access denied
            type:
              type: string
              example: permission_error
    ErrorResponse413:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: File too large
            type:
              type: string
              example: file_too_large_error
    ErrorResponse429:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Rate limit exceeded
            type:
              type: string
              example: rate_limit_error
    ErrorResponse500:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              example: Internal server error
            type:
              type: string
              example: server_error
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        ## All APIs require Bearer Token authentication ##

        Add to request header:

        `Authorization: Bearer YOUR_API_KEY`

````