# 附件

## 列出项目附件

**get** `/v1/compliance/apps/projects/{project_id}/attachments`

列出附加到项目的文件和文档。

列出附加到 project_id 所引用项目的文件和项目文档。
这包括附加文件的 ID 和附加项目文档的 ID。

附加文件的原始二进制内容可以使用
GET /v1/compliance/apps/chats/files/{claude_file_id}/content 端点下载。

附加项目文档的文本内容可以使用
GET /v1/compliance/apps/projects/documents/{claude_proj_doc_id} 端点获取。

返回值：
带有分页信息的项目附件列表

异常：
NotFoundException：如果项目不存在或 project_id 格式无效

### 路径参数

- `project_id: string`

  项目 ID（标签 ID，例如 claude_proj_abc123）

### 查询参数

- `limit: optional number`

  最大结果数（默认值：20，最大值：100）

- `page: optional string`

  来自先前响应 `next_page` 字段的不透明分页令牌。传递此值以检索下一页结果。客户端应将此值视为不透明字符串，不要尝试解析或解释其内容，因为格式可能会在不另行通知的情况下更改。

### 请求头参数

- `"x-api-key": optional string`

### 返回值

- `data: array of object { id, created_at, filename, 2 more }  or object { id, created_at, filename, 2 more }`

  按 created_at 时间顺序排列的附件列表，相同时间按 id 排序

  - `ComplianceProjectFileReference object { id, created_at, filename, 2 more }`

    用于合规响应的文件附件引用。

    - `id: string`

      文件标识符（例如 'claude_file_abcd'）

    - `created_at: string`

      创建时间戳（RFC 3339 格式）

    - `filename: string`

      文件的显示名称（例如 'document.pdf'）

    - `mime_type: string`

      文件上传时的 MIME 类型（例如 'application/pdf'）

    - `type: "project_file"`

      标记此为二进制文件的鉴别器

      - `"project_file"`

  - `ComplianceProjectDocReference object { id, created_at, filename, 2 more }`

    用于合规响应的项目文档附件引用。

    - `id: string`

      项目文档标识符（例如 'claude_proj_doc_abcd'）

    - `created_at: string`

      创建时间戳（RFC 3339 格式）

    - `filename: string`

      文档的显示名称（例如 'document.txt'）

    - `mime_type: "text/plain"`

      项目文档的 MIME 类型，始终设置为纯文本

      - `"text/plain"`

    - `type: "project_doc"`

      标记此为纯文本文档的鉴别器

      - `"project_doc"`

- `has_more: boolean`

  是否存在更多记录超出当前结果集

- `next_page: string`

  要获取下一页，请使用当前响应中的 'next_page' 作为下一次请求中的 'page'

### 示例

```http
curl https://api.anthropic.com/v1/compliance/apps/projects/$PROJECT_ID/attachments \
    -H "Authorization: Bearer $ANTHROPIC_COMPLIANCE_API_KEY"
```

#### 响应

```json
{
  "data": [
    {
      "id": "id",
      "created_at": "2019-12-27T18:11:19.117Z",
      "filename": "filename",
      "mime_type": "mime_type",
      "type": "project_file"
    }
  ],
  "has_more": true,
  "next_page": "next_page"
}
```

## 领域类型

### Attachment List Response

- `AttachmentListResponse = object { id, created_at, filename, 2 more }  or object { id, created_at, filename, 2 more }`

  用于合规响应的文件附件引用。

  - `ComplianceProjectFileReference object { id, created_at, filename, 2 more }`

    用于合规响应的文件附件引用。

    - `id: string`

      文件标识符（例如 'claude_file_abcd'）

    - `created_at: string`

      创建时间戳（RFC 3339 格式）

    - `filename: string`

      文件的显示名称（例如 'document.pdf'）

    - `mime_type: string`

      文件上传时的 MIME 类型（例如 'application/pdf'）

    - `type: "project_file"`

      标记此为二进制文件的鉴别器

      - `"project_file"`

  - `ComplianceProjectDocReference object { id, created_at, filename, 2 more }`

    用于合规响应的项目文档附件引用。

    - `id: string`

      项目文档标识符（例如 'claude_proj_doc_abcd'）

    - `created_at: string`

      创建时间戳（RFC 3339 格式）

    - `filename: string`

      文档的显示名称（例如 'document.txt'）

    - `mime_type: "text/plain"`

      项目文档的 MIME 类型，始终设置为纯文本

      - `"text/plain"`

    - `type: "project_doc"`

      标记此为纯文本文档的鉴别器

      - `"project_doc"`
