获取账户任务详情
按任务 ID 查询任务元数据与账务状态
国内用户请注意: 中国大陆用户请使用 https://api.toapis.cn 作为接口地址 (Base URL). 文档示例中的 https://api.toapis.com 请替换为 https://api.toapis.cn.
鉴权, 分页与错误处理见接入方式.
使用说明
按 task_id 返回任务的持久化元数据和可确认账务, 用于跟踪生成任务的进度和花费. 不返回生成结果, 提示词或重放数据; 查询不会主动刷新任务状态, 也不会触发结算或 Webhook. 只能用 task_id 查询, 不会回退到 client_business_id; 属于他人或不存在的任务统一返回 404.
视频转存或结算未完成时状态仍为 processing 且 finished_at=null. 接口在返回账务数据前会先做可确认性检查: 检查不通过时直接返回 503, 而不是给出不可靠的数据. 单条任务的账务无法确认时 billing=null.
billing.status=pending 时省略金额字段, 确认后为 settled 或 refunded.
鉴权
Authorizationstring请求头必填使用系统访问令牌, 格式为 Bearer YOUR_SYSTEM_ACCESS_TOKEN. 模型 API Key 不能用于此接口, 无需 X-User-Id.
请求参数
task_idstring路径必填平台任务 ID. 不接受业务 ID 代替, 不允许首尾空白或控制字符.
约束: minLength=1; maxLength=191.
请求示例
请求示例
curl --request GET \
--url 'https://api.toapis.com/api/v1/tasks/task_example_01' \
--header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'import requests
response = requests.get(
"https://api.toapis.com/api/v1/tasks/task_example_01",
headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
timeout=30,
)
response.raise_for_status()
print(response.json())const url = new URL("https://api.toapis.com/api/v1/tasks/task_example_01");
const response = await fetch(url, {
headers: { Authorization: "Bearer YOUR_SYSTEM_ACCESS_TOKEN" },
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}: ${await response.text()}`);
}
console.log(await response.json());响应字段
示例使用虚构数据. 金额样例假设 credits_per_usd="100", 实际换算以响应为准.
codeinteger业务状态码, 成功时为 0.
messagestring响应消息, 成功时为空字符串. 错误消息会按请求语言返回.
dataobject本次查询的结果对象.
data.idstring平台任务 ID. 任务详情查询使用此值, 不是业务 ID.
data.client_business_idstring | null创建任务时保存的客户侧业务 ID, 不等同于平台任务 ID. 无法确认或不适用时为 null.
data.api_key_idstring | null关联模型 API Key 的 ID. 没有关联 Key 时为 null.
data.typestring任务类型. 可选值: image, video, music, other.
data.modelstring模型标识.
data.statusstring任务对外状态. 视频转存或结算未完成时仍为 processing. 可选值: pending, processing, completed, failed.
data.progressinteger任务进度百分比, 范围为 0-100.
data.created_atstring | null创建时间. 时间格式为带时区的 RFC 3339. 无法确认或不适用时为 null.
data.finished_atstring | null可确认的任务终态时间. 仍在处理或终态未确认时为 null. 时间格式为带时区的 RFC 3339.
data.billingobject | null可确认的任务账务信息, 无法确认时为 null.
data.billing.statusstring任务账务状态. pending 时不返回金额; 确认后为 settled 或 refunded. 可选值: pending, settled, refunded.
data.billing.creditsstring确认后的任务账务金额, 单位为 credits. pending 时省略此字段. 以十进制字符串返回以保持精度.
data.billing.cost_usdstring确认后的任务账务 USD 金额. pending 时省略此字段. 以十进制字符串返回以保持精度.
响应示例
响应示例
{
"code": 0,
"message": "",
"data": {
"id": "task_example_01",
"client_business_id": "order_example_01",
"api_key_id": "42",
"type": "video",
"model": "example-video-model",
"status": "completed",
"progress": 100,
"created_at": "2026-11-01T08:00:00Z",
"finished_at": "2026-11-01T08:01:00Z",
"billing": {
"status": "settled",
"credits": "2",
"cost_usd": "0.02"
}
}
}