ToAPIsToAPIs
账户查询任务

获取账户任务详情

使用系统访问令牌读取当前账户的数据

GET
/api/v1/account/tasks/%7Btask_id%7D

国内用户请注意: 中国大陆用户请使用 https://toapis.cn 作为接口地址 (Base URL). 文档示例中的 https://toapis.com 请替换为 https://toapis.cn.

鉴权, 分页与错误处理见接入说明.

使用说明

分页查询默认近 24 小时, 最长 31 天, 按内部 ID 倒序. ids 批量模式不分页, meta 不含 from/to. 仅返回持久化任务元数据, 不返回结果 URL 或提示词, GET 不轮询上游, 不结算, 退款或发送 Webhook. 视频转存或结算未完成时仍为 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://toapis.com/api/v1/account/tasks/task_example_01' \
  --header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'
import requests

response = requests.get(
    "https://toapis.com/api/v1/account/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://toapis.com/api/v1/account/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"
    }
  }
}