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
获取当前账户下的文件列表,支持分页和按用途过滤。
请求头
| 头部 | 必选 | 说明 |
|---|
Authorization | 是 | Bearer <PAT> |
查询参数
| 参数 | 类型 | 必选 | 说明 |
|---|
purpose | string | 否 | 按文件用途过滤。可选值:user_upload、tool_output、skill_output、session_resource、agent_output |
limit | integer | 否 | 每页返回的最大文件数量 |
after | string | 否 | 游标分页:返回此 file_id 之后的文件(向后翻页) |
before | string | 否 | 游标分页:返回此 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"
}
响应字段
| 字段 | 类型 | 说明 |
|---|
data | array | 文件对象数组 |
first_id | string | null | 当前页第一个文件的 ID(无数据时为 null) |
last_id | string | null | 当前页最后一个文件的 ID(无数据时为 null) |
has_more | boolean | 是否还有更多数据 |
data 中每个文件对象的字段与上传文件响应一致。
空列表响应:
{
"data": [],
"first_id": null,
"has_more": false,
"last_id": null
}
分页说明
列表按创建时间降序排列(最新的在前)。使用游标分页遍历所有文件:
- 首次请求设置
limit 获取第一页
- 如果
has_more 为 true,使用 after=<last_id> 获取下一页
- 使用
before=<first_id> 可向前翻页
错误码
| HTTP | type | 触发条件 |
|---|
| 401 | authentication_error | 缺少或无效的认证令牌 |
完整错误信封说明详见 错误参考。