# 刪除單一檔案

此 API 用於刪除指定的檔案（File）。

透過提供檔案的 file_id，你可以將該檔案從系統中移除。不過，**若該檔案仍被包含於任何 Fileset 中，系統將阻止刪除操作，並回傳錯誤。**

請先移除該檔案與所有 Fileset 的關聯，才能成功執行刪除。

檔案刪除後將無法復原，也無法再被檢索或用於問答。

```javascript
curl -X 'DELETE' \
  'http://127.0.0.1:8000/v1/files/{file_id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-api-key>'
```

#### Request Headers

| **Key** | **Value** |
| --- | --- |
| Request Method | DELETE |
| accept | application/json |
| Authorization | Bearer &lt;your-api-key> |

#### Query Parameters

| **Field** | **Type** | **Note** | **Required** |
| --- | --- | --- | --- |
| file_id | string | uuid | true |

#### Response Body

```javascript
{
  "id": "b0d1bdbc-4f94-40b0-9358-68c579c99e8c",
  "object": "file",
  "deleted": true
}
```

**Field Explanation**

| **Field** | **Detail** |
| --- | --- |
| id | 刪除之檔案 ID |
| object | (與 OpenAI 相容而保留) |
| deleted | 是否已刪除 |
