Upload media: upload
curl --request POST \
--url https://apistable.ai/api/v1/files/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form uploadPath=files \
--form 'fileName=<string>'const form = new FormData();
form.append('file', '<string>');
form.append('uploadPath', 'files');
form.append('fileName', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://apistable.ai/api/v1/files/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.ai/api/v1/files/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"uploadPath": "files",
"fileName": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text){
"success": true,
"code": 200,
"msg": "<string>",
"data": {
"fileName": "<string>",
"filePath": "<string>",
"downloadUrl": "<string>",
"fileSize": 123,
"mimeType": "<string>",
"uploadedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}
}文件上传
上传文件
获取有效期 24 小时的公开媒体 URL。
POST
/
api
/
v1
/
files
/
upload
Upload media: upload
curl --request POST \
--url https://apistable.ai/api/v1/files/upload \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form file=@example-file \
--form uploadPath=files \
--form 'fileName=<string>'const form = new FormData();
form.append('file', '<string>');
form.append('uploadPath', 'files');
form.append('fileName', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://apistable.ai/api/v1/files/upload', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.ai/api/v1/files/upload"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"uploadPath": "files",
"fileName": "<string>"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text){
"success": true,
"code": 200,
"msg": "<string>",
"data": {
"fileName": "<string>",
"filePath": "<string>",
"downloadUrl": "<string>",
"fileSize": 123,
"mimeType": "<string>",
"uploadedAt": "2023-11-07T05:31:56Z",
"expiresAt": "2023-11-07T05:31:56Z"
}
}能力按服务端配置逐项启用。未启用操作返回 503 且不创建任务;音乐积分扣除当前未启用。
输入
使用 Bearer API Key。upload 为 multipart/form-data,其他方式为 JSON;uploadPath 是相对逻辑路径,fileName 可选。存储按账户隔离并使用独立对象版本,之后同名上传不会改掉旧任务使用的文件。 文件流/URL 上传上限 500 MiB。URL 拉取 30 秒超时,建议不超过 100 MiB;本站 Base64 解码文件上限 10 MiB,较大文件请使用 URL 或文件流。模型输入限制单独校验。{
"file": "multipart binary",
"uploadPath": "audio",
"fileName": "sample.wav"
}
输出
{
"success": true,
"code": 200,
"msg": "File uploaded successfully",
"data": {
"fileName": "sample.wav",
"filePath": "audio/sample.wav",
"downloadUrl": "https://files.apistable.ai/uploads/account/version/sample.wav",
"fileSize": 245760,
"mimeType": "audio/wav",
"uploadedAt": "2026-11-01T00:00:00Z",
"expiresAt": "2026-11-02T00:00:00Z"
}
}