> ## 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.

# 删除文件

> 删除一个 File。

`DELETE /api/v1/cloud/files/{file_id}`

删除 File 并返回删除确认。

## 路径参数

| 参数        | 类型     | 说明                  |
| --------- | ------ | ------------------- |
| `file_id` | string | File ID，前缀为 `file_` |

## 请求头

| 头部              | 必选 | 说明             |
| --------------- | -- | -------------- |
| `Authorization` | 是  | `Bearer <PAT>` |

## 示例请求

```bash theme={null}
curl -X DELETE https://api.qoder.com/api/v1/cloud/files/file_019e3bb8c1387743bf4ef115aae5acb1 \
  -H "Authorization: Bearer $QODER_PAT"
```

## 示例响应

**HTTP 200 OK**

```json theme={null}
{
  "id": "file_019e3bb8c1387743bf4ef115aae5acb1",
  "type": "file_deleted"
}
```

删除成功通过响应体中的 `"type": "file_deleted"` 标识。

## 错误码

| HTTP | type                   | 触发条件       |
| ---- | ---------------------- | ---------- |
| 401  | `authentication_error` | 缺少或无效的认证令牌 |
| 404  | `not_found_error`      | 文件不存在      |
| 409  | `conflict_error`       | 文件仍被活跃资源引用 |

完整错误信封说明详见 [错误参考](/zh/cloud-agents/api/conventions/errors)。

## 相关

<CardGroup cols={2}>
  <Card title="附加与下载文件" icon="paperclip" href="/zh/cloud-agents/files">
    上传文件为 Agent 提供上下文，并下载 Agent 产出的文件。
  </Card>
</CardGroup>
