列出文件
列出已上传的文件。
/anthropic/v1/files● 支持请求参数
idsarray可选query: Query param: Restrict the result set to Files whose `id` is in this list. At most 100 entries (after de-duplication). Mutually exclusive with `page` and `limit`. When supplied, the response is always a single page (`next_page` is null). IDs that do not resolve to a visible File — including deleted Files — are silently omitted.
已验证生效。
scope_idstring可选◐ 部分支持query: Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID).
需要 anthropic-beta: managed-agents-2026-04-01。非法 scope_id 返回 400,不存在的会话范围返回 404。
limitnumber可选query: Number of items per page.
已验证生效。
pagestring可选query:
已验证生效。
after_idstring可选query: Return the page of files immediately after this file id (older files).
返回该文件之后(更早创建)的一页;不能与 before_id 或 page 同时使用。
before_idstring可选query: Return the page of files immediately before this file id (newer files).
返回该文件之前(更新创建)的一页;不能与 after_id 或 page 同时使用。
返回
200
按创建时间从新到旧排列。用 after_id / before_id 与 limit 分页(两者同时给返回 400),也可以用 page 游标(next_page);三者只能选一个。响应包含 data、has_more、first_id、last_id 与 next_page。ids(最多 100 个去重 ID)与 page、after_id、before_id、limit 互斥。scope_id 需要 anthropic-beta: managed-agents-2026-04-01 请求头;缺少该头返回 400,不存在的会话范围返回 404。anthropic-workspace-id 返回 400。
错误按 Anthropic 格式返回,参见 错误码
响应
HTTP 200
Files listed
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| data | array<object> | |
| data[].id | string | Unique object identifier. The format and length of IDs may change over time. |
| data[].created_at | string | RFC 3339 datetime string representing when the file was created. |
| data[].filename | string | Original filename of the uploaded file. |
| data[].mime_type | string | MIME type of the file. |
| data[].size_bytes | number | Size of the file in bytes. |
| data[].type | string | Object type. For files, this is always `"file"`. |
| data[].downloadable | boolean | Whether the file can be downloaded. |
| data[].expires_at | null | string | RFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with `expires_in_seconds`, this is the upload time plus that value. |
| data[].scope | null | object | The scope of this file, indicating the context in which it was created (e.g., a session). |
| next_page | null | string |