跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.qoder.com/llms.txt

Use this file to discover all available pages before exploring further.

GET /v1/files 获取当前账户下的文件列表,支持分页和按用途过滤。

请求头

头部必选说明
AuthorizationBearer <PAT>

查询参数

参数类型必选说明
purposestring按文件用途过滤。可选值:user_uploadtool_outputskill_outputsession_resourceagent_output
limitinteger每页返回的最大文件数量
afterstring游标分页:返回此 file_id 之后的文件(向后翻页)
beforestring游标分页:返回此 file_id 之前的文件(向前翻页)
完整分页规范详见 分页

示例请求

# 基本列表
curl -X GET "https://openapi.qoder.sh/api/v1/cloud/files" \
  -H "Authorization: Bearer $QODER_PAT"

# 按用途过滤 + 限制数量
curl -X GET "https://openapi.qoder.sh/api/v1/cloud/files?purpose=session_resource&limit=10" \
  -H "Authorization: Bearer $QODER_PAT"

# 游标分页
curl -X GET "https://openapi.qoder.sh/api/v1/cloud/files?limit=10&after=file_019e3bb8e6c47d18" \
  -H "Authorization: Bearer $QODER_PAT"

示例响应

HTTP 200 OK
{
  "data": [
    {
      "created_at": "2026-05-18T15:33:53Z",
      "file_id": "file_019e3bb8e6c47d189212a79642136696",
      "filename": "report.txt",
      "metadata": {
        "project": "test"
      },
      "mime_type": "text/plain",
      "purpose": "session_resource",
      "size_bytes": 110,
      "status": "ready",
      "updated_at": "2026-05-18T15:33:54Z"
    }
  ],
  "first_id": "file_019e3bb8e6c47d189212a79642136696",
  "has_more": false,
  "last_id": "file_019e3bb8e6c47d189212a79642136696"
}

响应字段

字段类型说明
dataarray文件对象数组
first_idstring | null当前页第一个文件的 ID(无数据时为 null
last_idstring | null当前页最后一个文件的 ID(无数据时为 null
has_moreboolean是否还有更多数据
data 中每个文件对象的字段与上传文件响应一致。 空列表响应:
{
  "data": [],
  "first_id": null,
  "has_more": false,
  "last_id": null
}

分页说明

列表按创建时间降序排列(最新的在前)。使用游标分页遍历所有文件:
  1. 首次请求设置 limit 获取第一页
  2. 如果 has_moretrue,使用 after=<last_id> 获取下一页
  3. 使用 before=<first_id> 可向前翻页

错误码

HTTPtype触发条件
401authentication_error缺少或无效的认证令牌
完整错误信封说明详见 错误参考