跳转到内容
中文

获取任务详情

GET /v1/tasks/:id

路径参数 :id 为创建任务时返回的 tk-hiapi- taskId。常用于轮询。

Authorization Bearer YOUR_API_KEY 必填

账号 API Key,所有请求必填。

id string 必填

创建任务时返回的 taskId,前缀 tk-hiapi-。

示例 tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR
字段类型说明
taskIdstring任务 ID,前缀固定 tk-hiapi-
modelstring创建任务时传入的模型名
statusstring状态枚举,见下
creatednumber任务创建时间(Unix 秒)
completednumber进入终态的 Unix 秒;非终态固定为 0
outputarraystatus == success 时出现
errorobjectstatus == fail 时出现,结构 { code, message }
status含义是否返回 output
queued已入队,尚未开始
handling处理中
archiving处理完成,产物准备中
success终态:完成,产物可用
fail终态:失败否,返回 error
字段类型说明
urlstring资源 URL,可直接下载
typestring产物类型,见下
expireAtnumber资源可访问截止时间(Unix 秒);过期前请完成下载或转存

常见 type(可扩展):videoimageaudiofirst_framelast_framethumbnailoutput 始终为数组,同一任务可能同时返回多个 type(如 video + first_frame)。

{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR",
"model": "happyhorse-1-0",
"status": "success",
"created": 1777282033,
"completed": 1777282099,
"output": [
{
"url": "https://cdn.hiapi.ai/tasks/.../video.mp4",
"type": "video",
"expireAt": 1777886899
},
{
"url": "https://cdn.hiapi.ai/tasks/.../first_frame.jpg",
"type": "first_frame",
"expireAt": 1777886899
}
]
}
}

非终态响应(如 status = archiving

Section titled “非终态响应(如 status = archiving)”
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "archiving",
"created": 1777282033,
"completed": 0
}
}
{
"code": 200,
"message": "success",
"data": {
"taskId": "tk-hiapi-...",
"model": "happyhorse-1-0",
"status": "fail",
"created": 1777282033,
"completed": 1777282099,
"error": {
"code": "TASK_FAILED",
"message": "task failed"
}
}
}

error.code 取值见状态码

任务不存在或不属于当前账号:

{
"code": 404,
"message": "task not found",
"data": null
}