ToAPIsToAPIs
使用者檔案

查詢檔案保留期

讀取目前帳號設定的檔案保留天數

GET
/api/v1/user/file/retention

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

使用說明

查詢目前帳號自訂的檔案保留天數. 回傳 null 表示未設定自訂期限, 依平台保留規則處理. 平台預設保留 30 天.

使用者設定只能縮短保留時間, 無法延長平台期限. 設定與取消範例見設定檔案保留期.

驗證

Authorizationstring請求頭必填

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

請求參數

無查詢參數或請求主體. 未知或重複的查詢參數回傳 400.

請求示例

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

response = requests.get(
    "https://api.toapis.com/api/v1/user/file/retention",
    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/retention", {
  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.retention_daysinteger | null

使用者設定的保留天數. null 表示未設定自訂期限, 依平台規則處理, 平台預設保留 30 天.

響應示例

{
  "code": 0,
  "message": "",
  "data": {
    "retention_days": null
  }
}

錯誤處理

未知或重複的查詢參數回傳 400; 策略讀取暫時無法使用時回傳 503.

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