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.

通用鉴权, 限流和错误处理见接入方式.