Documentation Index

Fetch the complete documentation index at: https://www.t0ai.cn/ Use this file to discover all available pages before exploring further.

Base64 File Upload

  • Supports Base64 encoding and Data URL formats
  • Automatically identifies file types and categorizes storage
  • Returns accessible file URLs and download links
  • Files will expire after 72 hours
  • Current user quota is limited. Uploads will fail when quota is exhausted. Please save locally if persistent storage is needed

Note: The file upload API base URL ishttps://files-api.t0ai.cn

OpenAPI

````yaml en/api-manual/file-series/upload-base64.json post /api/v1/files/upload/base64 openapi: 3.1.0 info: title: Base64 File Upload API description: Upload files to the file server via Base64 encoding license: name: MIT version: 1.0.0 servers: - url: https://files-api.t0ai.cn description: File Service Environment security: - bearerAuth: [] tags: - name: File Upload description: File upload related APIs paths: /api/v1/files/upload/base64: post: tags: - File Upload summary: Base64 File Upload description: >- - Supports Base64 encoding and Data URL formats

    - Automatically identifies file types and categorizes storage

    - Returns accessible file URLs and download links

    - Files will expire after 72 hours

    - Current user quota is limited. Uploads will fail when quota is
    exhausted. Please save locally if persistent storage is needed


    **Note:**

    The file upload API base URL is`https://files-api.t0ai.cn`
  operationId: uploadFileBase64
  requestBody:
    required: true
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/Base64UploadRequest'
        examples:
          base64_upload:
            summary: Base64 File Upload
            value:
              base64_data: data:image/png;base64,iVBORw0KGgo...
  responses:
    '200':
      description: File uploaded successfully
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/FileUploadResponse'

components: schemas: Base64UploadRequest: type: object required: - base64_data properties: base64_data: type: string description: >- Base64 encoded file data

        **Supported Formats:**

        - Data URL format: `data:image/png;base64,iVBORw0KGgo...`

        - Pure Base64 encoding: `iVBORw0KGgo...`


        **Note:**

        - Maximum `1` image per request

        - Currently supports uploading files in: `image/jpeg`, `image/png`,
        `image/gif`, `image/webp` formats only
      example: data:image/png;base64,iVBORw0KGgo...
    upload_path:
      type: string
      description: >-
        Custom upload path


        **Note:**

        - If not specified, system will automatically categorize based on
        file type
      example: avatars
    file_name:
      type: string
      description: >-
        Custom file name


        **Note:**

        - If not specified, system will automatically generate a unique file
        name
      example: avatar.png
FileUploadResponse:
  type: object
  properties:
    success:
      type: boolean
      description: Whether the request was successful
      example: true
    code:
      type: integer
      description: Response status code
      example: 200
    msg:
      type: string
      description: Response message
      example: File uploaded successfully
    data:
      $ref: '#/components/schemas/FileData'
FileData:
  type: object
  properties:
    file_id:
      type: string
      description: Unique file identifier
      example: file_abc123
    file_name:
      type: string
      description: Stored file name
      example: avatar.png
    original_name:
      type: string
      description: Original file name
      example: avatar.png
    file_size:
      type: integer
      description: File size (bytes)
      example: 2048
    mime_type:
      type: string
      description: File MIME type
      example: image/png
    upload_path:
      type: string
      description: File storage path
      example: avatars
    file_url:
      type: string
      format: uri
      description: File access URL
      example: https://files.t0ai.cn/avatars/avatar.png
    download_url:
      type: string
      format: uri
      description: File download URL
      example: https://files.t0ai.cn/api/v1/files/download/file_abc123
    upload_time:
      type: string
      format: date-time
      description: Upload time (ISO 8601 format)
      example: '2025-10-09T00:00:00+08:00'
    expires_at:
      type: string
      format: date-time
      description: File expiration time (ISO 8601 format)
      example: '2025-10-12T00:00:00+08:00'

securitySchemes: bearerAuth: type: http scheme: bearer description: >- ##All APIs require Bearer Token authentication##

    **Get API Key:**


    Visit [API Key Management Page](https://t0ai.cn/dashboard/keys) to
    get your API Key


    **Add to request header:**

    ```

    Authorization: Bearer YOUR_API_KEY

    ```

````