跳转到主要内容
GET /api/v1/cloud/files 获取当前账户下的文件列表。

请求头

头部必选说明
AuthorizationBearer <PAT>

查询参数

参数类型必选说明
limitinteger每页返回的最大文件数量。默认 20,范围 1-100。超过 100 返回 400 invalid_request_error
pagestringClaude 风格的向后翻页游标,等价于 after_id;与 before_idafter_id 互斥
after_idstring游标分页:返回此 ID 之后的文件。与 pagebefore_id 互斥
before_idstring游标分页:返回此 ID 之前的文件。与 pageafter_id 互斥
namestring按文件名前缀搜索,不区分大小写
scope_idstring按资源 scope 过滤,目前为 Session ID
完整分页规范详见 分页

示例请求

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

# 按 Session scope 过滤并限制数量
curl -X GET "https://api.qoder.com/api/v1/cloud/files?scope_id=sess_019e3bb8e6c47d18&limit=10" \
  -H "Authorization: Bearer $QODER_PAT"

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

示例响应

HTTP 200 OK
{
  "data": [
    {
      "id": "file_019e3bb8e6c47d189212a79642136696",
      "type": "file",
      "filename": "report.txt",
      "mime_type": "text/plain",
      "size_bytes": 110,
      "downloadable": true,
      "scope": {
        "id": "sess_019e3bb8e6c47d18",
        "type": "session"
      },
      "metadata": {
        "project": "demo"
      },
      "created_at": "2026-05-18T15:33:53Z"
    }
  ],
  "next_page": null,
  "first_id": "file_019e3bb8e6c47d189212a79642136696",
  "has_more": false,
  "last_id": "file_019e3bb8e6c47d189212a79642136696"
}

响应字段

字段类型说明
dataarrayFile 对象数组
next_pagestring | null下一页向后游标;has_moretrue 时传给 page
first_idstring | null当前页第一个文件 ID;data 为空时为 null
last_idstring | null当前页最后一个文件 ID;data 为空时为 null
has_moreboolean是否还有更多文件

分页说明

结果按 created_atid 排序。遍历文件列表:
  1. 首次请求设置 limit 获取第一页
  2. 如果 has_moretrue,使用 page=<next_page> 获取下一页
  3. 使用 before_id=<first_id> 可向前翻页

错误码

HTTPtype触发条件
400invalid_request_errorlimit 非法,或同时传入多个 pagebefore_idafter_id
401authentication_error缺少或无效的认证令牌
完整错误信封说明详见 错误参考

相关

附加与下载文件

上传文件为 Agent 提供上下文,并下载 Agent 产出的文件。