跳转到主要内容
GET /v1/files 获取当前账户下的文件列表。默认不返回 deleted 状态的文件。

请求头

头部必选说明
AuthorizationBearer <PAT>

查询参数

参数类型必选说明
limitinteger每页返回的最大文件数量。必须为正整数;默认 20,最大 100
after_idstring游标分页:返回此 file_id 之后的文件。不能与 before_id 同时传入
before_idstring游标分页:返回此 file_id 之前的文件。不能与 after_id 同时传入
orderstringcreated_atid 排序的方向。使用 ascdesc,默认 desc
purposestring按文件用途过滤,见 File purpose
namestring按文件名前缀搜索,不区分大小写
session_idstring按关联 Session 过滤;未传 status 时,Session 范围列表只返回 ready 文件
statusstringFile status 过滤。传入时会覆盖默认的 deleted 排除逻辑
include_deletedboolean未传 status 时,设为 true 可包含 deleted 状态文件
完整分页规范详见 分页

示例请求

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

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

# 游标分页
curl -X GET "https://api.qoder.com/api/v1/cloud/files?limit=10&after_id=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"
}

响应字段

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

分页说明

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

错误码

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

相关

附加与下载文件

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