ToAPIsToAPIs
帳戶查詢任務

列出帳戶任務

使用系統存取權杖讀取目前帳戶的資料

GET
/api/v1/account/tasks

中國大陸用戶請注意: 中國大陸用戶請使用 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. pending 帳務省略金額, 確認後為 settled 或 refunded.

驗證

Authorizationstring請求頭必填

使用系統存取權杖, 格式為 Bearer YOUR_SYSTEM_ACCESS_TOKEN. 此介面不接受模型 API Key, 不需要 X-User-Id.

請求參數

fromstring查詢

含時區的 RFC 3339 起始時間, 包含該時刻. 與 to 成對提供.

限制: date-time.

tostring查詢

含時區的 RFC 3339 結束時間, 不包含該時刻, 必須晚於 from.

限制: date-time.

modelstring查詢

精確比對模型識別碼. 用量介面的空字串會比對空模型名稱.

限制: maxLength=191.

cursorstring查詢

原樣傳入上一頁的 next_cursor, 保留相同篩選條件. 變更條件後重新開始.

限制: maxLength=2048.

limitinteger查詢預設值: 20

每頁最多回傳的項目數.

限制: minimum=1; maximum=50; 預設值: 20.

typestring查詢

任務類型. 不支援 status 查詢參數.

限制: image, video, music, other.

client_business_idstring查詢

精確比對業務 ID, 不允許前後空白或控制字元.

限制: minLength=1; maxLength=191.

idsstring查詢

以逗號分隔的平台任務 ID, 原始項目最多 20 個, 不可與任何其他查詢參數併用. 去重後依首次出現順序回傳可見項目, 省略不存在或他人的任務.

請求示例

curl --request GET \
  --url 'https://toapis.com/api/v1/account/tasks?from=2026-11-01T00:00:00Z&to=2026-11-02T00:00:00Z&type=video&limit=20' \
  --header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'
import requests

response = requests.get(
    "https://toapis.com/api/v1/account/tasks",
    headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
    params={
        "from": "2026-11-01T00:00:00Z",
        "to": "2026-11-02T00:00:00Z",
        "type": "video",
        "limit": "20"
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())
const url = new URL("https://toapis.com/api/v1/account/tasks");
url.search = new URLSearchParams({
  "from": "2026-11-01T00:00:00Z",
  "to": "2026-11-02T00:00:00Z",
  "type": "video",
  "limit": "20"
}).toString();

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". 實際換算請以回應為準.

清單位於 data.items, 以 has_more 及 next_cursor 分頁. 最後一頁的游標為 null, 不回傳總數.

codeinteger

業務狀態碼, 成功時為 0.

messagestring

回應訊息, 成功時為空字串. 錯誤訊息依請求語言回傳.

dataobject

本次查詢的結果物件.

data.itemsobject[]

目前頁面的記錄清單, 空結果為 [].

data.items[].idstring

平台任務 ID. 任務詳情使用此值, 並非業務 ID.

data.items[].client_business_idstring | null

建立任務時儲存的客戶端業務 ID, 與平台任務 ID 不同. 無法確認或不適用時為 null.

data.items[].api_key_idstring | null

關聯模型 API Key 的 ID. 無關聯時為 null.

data.items[].typestring

任務類型. 可選值: image, video, music, other.

data.items[].modelstring

模型識別碼.

data.items[].statusstring

任務公開狀態. 影片轉存或結算未完成時仍為 processing. 可選值: pending, processing, completed, failed.

data.items[].progressinteger

任務進度百分比, 範圍為 0-100.

data.items[].created_atstring | null

建立時間. 時間格式為含時區的 RFC 3339. 無法確認或不適用時為 null.

data.items[].finished_atstring | null

可確認的任務終態時間. 處理中或尚未確認時為 null. 時間格式為含時區的 RFC 3339.

data.items[].billingobject | null

可確認的任務帳務資訊, 無法確認時為 null.

data.items[].billing.statusstring

任務帳務狀態. pending 不回傳金額; 確認後為 settled 或 refunded. 可選值: pending, settled, refunded.

data.items[].billing.creditsstring

確認後的任務帳務金額, 單位為 credits. pending 時省略. 以十進位字串回傳以保留精度.

data.items[].billing.cost_usdstring

確認後的任務帳務 USD 金額. pending 時省略. 以十進位字串回傳以保留精度.

data.has_moreboolean

是否還有下一頁.

data.next_cursorstring | null

下一頁游標, 原樣作為 cursor 傳入並保留篩選條件. 最後一頁為 null.

data.metaobject

資料來源, 查詢範圍及資料口徑等中繼資料.

data.meta.scopestring

查詢資料的歸屬範圍, 目前為驗證帳戶自身.

data.meta.sourcestring

資料來源. 本地設定或帳本快照不代表 Stripe 即時狀態.

data.meta.consistencystring

資料一致性類型. eventual 表示記錄可能稍後更新.

data.meta.fromstring

查詢時間範圍下界, 包含該時刻.

data.meta.tostring

查詢時間範圍上界, 不包含該時刻.

響應示例

{
  "code": 0,
  "message": "",
  "data": {
    "items": [
      {
        "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"
        }
      }
    ],
    "has_more": false,
    "next_cursor": null,
    "meta": {
      "scope": "self",
      "source": "persisted_tasks",
      "consistency": "eventual",
      "from": "2026-11-01T00:00:00Z",
      "to": "2026-11-02T00:00:00Z"
    }
  }
}