Documentation Index
Fetch the complete documentation index at: https://www.t0ai.cn/ Use this file to discover all available pages before exploring further.
File Stream Upload
- Upload files using multipart/form-data format
- Supports both underscore and camelCase parameter naming
- Suitable for uploading local files directly
- 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-stream.json post /api/v1/files/upload/stream openapi: 3.1.0 info: title: File Stream Upload API description: Upload files to the file server via multipart/form-data 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/stream: post: tags: - File Upload summary: File Stream Upload description: >- - Upload files using multipart/form-data format
- Supports both underscore and camelCase parameter naming
- Suitable for uploading local files directly
- 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: uploadFileStream
requestBody:
required: true
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/StreamUploadRequest'
examples:
stream_upload:
summary: File Stream Upload
value:
file: '@/path/to/file.png'
responses:
'200':
description: File uploaded successfully
content:
application/json:
schema:
$ref: '#/components/schemas/FileUploadResponse'
components: schemas: StreamUploadRequest: type: object required: - file properties: file: type: string format: binary description: >- File binary data
**Note:**
- Upload via form-data format
- System will automatically identify file type
- Maximum `1` image per request
- Currently supports uploading files in: `image/jpeg`, `image/png`,
`image/gif`, `image/webp` formats only
upload_path:
type: string
description: >-
Custom upload path
**Note:**
- Supports underscore naming: `upload_path`
- Supports camelCase naming: `uploadPath`
- If not specified, system will automatically categorize based on
file type
example: photos
file_name:
type: string
description: >-
Custom file name
**Note:**
- Supports underscore naming: `file_name`
- Supports camelCase naming: `fileName`
- If not specified, system will automatically generate a unique file
name
example: photo.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: photo.png
original_name:
type: string
description: Original file name
example: photo.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: photos
file_url:
type: string
format: uri
description: File access URL
example: https://files.t0ai.cn/photos/photo.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
```
````