Upload media: upload_url
curl --request POST \
--url https://apistable.com/api/v1/files/upload_url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileUrl": "<string>",
"uploadPath": "files",
"fileName": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileUrl: '<string>', uploadPath: 'files', fileName: '<string>'})
};
fetch('https://apistable.com/api/v1/files/upload_url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.com/api/v1/files/upload_url"
payload = {
"fileUrl": "<string>",
"uploadPath": "files",
"fileName": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, 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"
}
}文件上传
通过 URL 上传
获取有效期 24 小时的公开媒体 URL。
POST
/
api
/
v1
/
files
/
upload_url
Upload media: upload_url
curl --request POST \
--url https://apistable.com/api/v1/files/upload_url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileUrl": "<string>",
"uploadPath": "files",
"fileName": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({fileUrl: '<string>', uploadPath: 'files', fileName: '<string>'})
};
fetch('https://apistable.com/api/v1/files/upload_url', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://apistable.com/api/v1/files/upload_url"
payload = {
"fileUrl": "<string>",
"uploadPath": "files",
"fileName": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, 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 或文件流。模型输入限制单独校验。{
"fileUrl": "https://example.com/sample.wav",
"uploadPath": "audio",
"fileName": "sample.wav"
}
输出
{
"success": true,
"code": 200,
"msg": "File uploaded successfully",
"data": {
"fileName": "sample.wav",
"filePath": "audio/sample.wav",
"downloadUrl": "https://r2.apistable.com/uploads/account/version/sample.wav",
"fileSize": 245760,
"mimeType": "audio/wav",
"uploadedAt": "2026-11-01T00:00:00Z",
"expiresAt": "2026-11-02T00:00:00Z"
}
}