Upload File
Upload a file into the platform asset system and receive a file_id, which can be reused by id in asynchronous / large-file scenarios such as ASR. This endpoint aligns with the Files upload operation; the request body is multipart/form-data.
Authentication
Add Authorization: Bearer <API_KEY> to the request header to authenticate. You can generate a key on the "API Keys" page of the console.
curl https://api.mosi.cn/v1/files \
-H "Authorization: Bearer $MOSS_API_KEY"
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | The multipart file field, streamed into assets; the whole file is not read into memory. |
| purpose | string | Yes | File purpose, for example |
Request example
curl https://api.mosi.cn/v1/files \
-H "Authorization: Bearer $MOSS_API_KEY" \
-F file=@speech.wav \
-F purpose=audio
Response fields
| Field | Type | Always returned | Description |
|---|---|---|---|
| id | string | Yes | The file id, i.e. the |
| object | string | Yes | Always |
| bytes | integer | Yes | File size in bytes. |
| created_at | integer | Yes | Creation time, a Unix timestamp in seconds. |
| filename | string | Yes | The original file name. |
| purpose | string | Yes | The purpose marker passed in on upload. |
| status | string | Yes | File status, for example |
Response example
{
"id": "<file_id>",
"object": "file",
"bytes": 1048576,
"created_at": 1710000000,
"filename": "speech.wav",
"purpose": "audio",
"status": "processed"
}