ToAPIsToAPIs
使用者檔案

列出使用者檔案

分頁查詢目前帳號已登記的自有檔案

GET
/api/v1/user/file

中國大陸用戶請注意: 中國大陸用戶請使用 https://api.toapis.cn 作為接口地址 (Base URL). 文檔示例中的 https://api.toapis.com 請替換為 https://api.toapis.cn.

使用說明

依檔案建立時間遞減列出目前帳號已登記的自有檔案, 相同時間再依 ID 遞減. 僅涵蓋已登記檔案, 不代表儲存空間中的所有歷史物件. 回應不含下載 URL, 儲存路徑或提示詞; 任務關聯可能稍後補齊.

本介面僅回傳 data.items, data.next_cursor, 不含 has_more, meta 或總數. 將非空 next_cursor 原樣傳入下一次的 cursor; 最後一頁為 "", 空清單為 []. 游標綁定帳號, 跨帳號或竄改回傳 400. 僅支援 limit 和 cursor, 不支援時間或刪除狀態篩選.

驗證

Authorizationstring請求頭必填

使用系統存取權杖, 格式為 Bearer YOUR_SYSTEM_ACCESS_TOKEN. 不接受模型 API Key, 無需 X-User-Id. 僅操作目前驗證帳號自己的檔案與策略, 不合併子帳號資料.

請求參數

limitinteger查詢預設值: 50

每頁筆數, 預設 50, 範圍 1-100.

cursorstring查詢

上一頁回傳的非空 next_cursor. 第一頁省略, 空字串表示停止翻頁.

請求示例

curl --request GET \
  --url 'https://api.toapis.com/api/v1/user/file?limit=50' \
  --header 'Authorization: Bearer YOUR_SYSTEM_ACCESS_TOKEN'
import requests

response = requests.get(
    "https://api.toapis.com/api/v1/user/file?limit=50",
    headers={"Authorization": "Bearer YOUR_SYSTEM_ACCESS_TOKEN"},
    timeout=30,
)
response.raise_for_status()
print(response.json())
const response = await fetch("https://api.toapis.com/api/v1/user/file?limit=50", {
  method: "GET",
  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());

回應欄位

範例使用虛構資料. 共用回應格式見接入方式.

data.itemsobject[]

本頁檔案, 空清單為 [].

data.items[].idstring

單檔刪除使用的檔案 ID.

data.items[].sourcestring

登記來源, 例如 task_result, upload, private_asset.

data.items[].task_kindstring | null

選填的任務關聯類型, 例如 generation 或 export.

data.items[].task_idstring | null

選填的任務 ID, 尚未關聯為 null.

data.items[].mime_typestring | null

MIME 類型, 未知為 null.

data.items[].size_bytesinteger | null

檔案大小, 單位位元組, 未知為 null.

data.items[].created_atstring

檔案建立時間, 不是登記時間.

data.items[].delete_statestring

none 未排入刪除; pending 等待; deleting 執行中; blocked 受阻; deleted 僅供歷史列使用. 清單不保留完整的檔案刪除歷史.

data.next_cursorstring

下一頁游標, 最後一頁為空字串.

響應示例

{
  "code": 0,
  "message": "",
  "data": {
    "items": [
      {
        "id": "123",
        "source": "task_result",
        "task_kind": "generation",
        "task_id": "task_example_01",
        "mime_type": "image/png",
        "size_bytes": 204800,
        "created_at": "2026-11-01T08:00:00Z",
        "delete_state": "none"
      }
    ],
    "next_cursor": ""
  }
}

錯誤處理

limit, cursor 或查詢參數無效時回傳 400; 檔案讀取暫時無法使用時回傳 503.

共用驗證, 速率限制與錯誤處理見接入方式.