文件
已上传的文件、其检测结果以及新的下载链接。作业的结果随作业一起返回:请参阅结果与下载。
本页内容
GET/v1/files/{id}
返回文件、其检测结果,以及上传完成后的新下载链接。每次调用都会生成新链接,有效期取 7 天与文件被删除前剩余时间中较短的一个。
路径参数
idstring必填
返回
- 200该文件。
18 个字段
idstring必填namestring必填operationstring必填上传该文件所针对的操作。
statestring必填可选值:
uploading或uploadedsizeinteger必填created_atstring (date-time)必填uploaded_atstring (date-time)delete_atstring (date-time)删除时间。有作业正在使用该文件时不返回此字段。
checkobject上传完成时对文件内容的检测结果。
check.statestring必填proceed:操作可以使用该文件。refuse:无法使用,原因见reason。couldnt_read:检测未能读取全部内容;作业会完整读取。check_failed:我们这边出现问题;再次完成上传即可重试。可选值:
checking、proceed、refuse、couldnt_read或check_failedcheck.reasonstringcheck.detailobjectcheck.kindstring文件的真实类别,例如
video。check.typestring文件的真实格式,例如
mp4,与文件名无关。check.factsobject检测读取到的信息,例如视频的时长、大小和编解码器。
check.facts_completebooleandownload_urlstring (URL)文件上传完成后,仅在
GET /v1/files/{id}中返回。download_expires_atstring (date-time)
错误
示例
curl https://api.filesokay.com/v1/files/file_3cf0737aefa34b89b7b4443c9467d60c \
-H "Authorization: Bearer $FILESOKAY_KEY"const res = await fetch("https://api.filesokay.com/v1/files/file_3cf0737aefa34b89b7b4443c9467d60c", {
headers: {
Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
},
});
const file = await res.json();import os
import requests
res = requests.get(
"https://api.filesokay.com/v1/files/file_3cf0737aefa34b89b7b4443c9467d60c",
headers={
"Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
},
)
file = res.json(){
"id": "file_3cf0737aefa34b89b7b4443c9467d60c",
"name": "lecture.mp4",
"operation": "video.compress",
"state": "uploaded",
"size": 12417467,
"created_at": "2026-12-03T09:22:53Z",
"uploaded_at": "2026-12-03T09:23:02Z",
"delete_at": "2026-12-04T09:23:02Z",
"check": {
"state": "proceed",
"kind": "video",
"type": "mp4",
"facts": {
"container": "mp4",
"protection": "none",
"attachments": [],
"duration_ms": 20023,
"frame_count": 600,
"audio_tracks": [
{
"codec": "aac",
"channels": 1,
"sample_rate": 44100
}
],
"video_tracks": [
{
"hdr": "none",
"codec": "h264",
"width": 1280,
"chroma": "420",
"height": 720,
"profile": "High",
"rotation": 0,
"bit_depth": 8,
"frame_rate": 30,
"interlaced": false,
"variable_frame_rate": false
}
],
"data_end_bytes": 12417467,
"subtitle_tracks": []
},
"facts_complete": true
},
"download_url": "https://…",
"download_expires_at": "2026-12-04T09:23:02Z"
}DELETE/v1/files/{id}
立即删除文件,同时从存储中删除。
路径参数
idstring必填
返回
- 204已删除。
错误
示例
curl -X DELETE https://api.filesokay.com/v1/files/file_3cf0737aefa34b89b7b4443c9467d60c \
-H "Authorization: Bearer $FILESOKAY_KEY"const res = await fetch("https://api.filesokay.com/v1/files/file_3cf0737aefa34b89b7b4443c9467d60c", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
},
});
console.log(res.status);import os
import requests
res = requests.delete(
"https://api.filesokay.com/v1/files/file_3cf0737aefa34b89b7b4443c9467d60c",
headers={
"Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
},
)
print(res.status_code)