GET /v1/files/{file_id}
获取单个 File 对象。deleted 状态的文件不会通过该接口返回。
请求头
| 头部 | 必选 | 说明 |
|---|---|---|
Authorization | 是 | Bearer <PAT> |
路径参数
| 参数 | 类型 | 必选 | 说明 |
|---|---|---|---|
file_id | string | 是 | File ID,前缀为 file_ |
示例请求
示例响应
HTTP 200 OK响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
file_id | string | File ID,前缀为 file_ |
filename | string | 存储后的文件名 |
size_bytes | integer | 文件大小,单位 byte |
mime_type | string | 上传时提供或根据文件名检测出的 MIME type |
purpose | string | 文件用途,见 File purpose |
status | string | 文件状态。获取单个文件时不会返回 deleted 状态的文件 |
metadata | JSON value | 上传时传入的 metadata JSON |
created_at | string | UTC 创建时间,RFC 3339 格式 |
updated_at | string | UTC 更新时间;与 created_at 不同时返回 |
session_id | string | 文件关联 Session 时返回 |
错误码
| HTTP | type | 触发条件 |
|---|---|---|
| 401 | authentication_error | 缺少或无效的认证令牌 |
| 404 | not_found_error | 指定 ID 的文件不存在,或文件处于 deleted 状态 |
相关
附加与下载文件
上传文件为 Agent 提供上下文,并下载 Agent 产出的文件。