跳转到内容
EN

列出文件

GET/anthropic/v1/files● 支持

Anthropic 官方文档 ↗

请求参数

  • 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 格式返回,参见 错误码

请求示例

curl
curl https://api.deepraxis.com/anthropic/v1/files \
  -H "x-api-key: $PRAXIS_API_KEY" \
  -H "anthropic-version: 2023-06-01"
Python
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.deepraxis.com/anthropic",
    api_key="$PRAXIS_API_KEY",
)

files = client.files.list()
TypeScript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.deepraxis.com/anthropic",
  apiKey: "$PRAXIS_API_KEY",
});

const files = await client.files.list();

响应示例 200

{
  "data": [
    {
      "id": "file_dp_01M42FVDJD8QGPRQ0059E7V056",
      "type": "file",
      "filename": "pixel.png",
      "mime_type": "image/png",
      "size_bytes": 70,
      "created_at": "2026-10-04T03:38:18.651Z",
      "expires_at": null,
      "downloadable": false
    }
  ],
  "next_page": null
}

响应

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