# Delete File

Deletes a file.

## Endpoint

```http
DELETE /files/{file_id}
```

operationId: `deleteFile`

### Servers

- `https://api.deepseek.com`

## Authentication

### Alternative 1

**bearerAuth**

`Authorization: Bearer <API_KEY>`

```yaml
type: http
scheme: bearer
```

## Parameters

**`file_id`** (path) — required

The ID of the file to delete.

- `type`: `string`

## Responses

### 200

OK, returns the deletion status.

#### application/json

- Reference: [DeleteFileResponse](#schema-delete-file-response) (`#/components/schemas/DeleteFileResponse`)

**Example**

```json
{
  "id": "file-api-0a1b2c3d4e5f60718293a4b5c6d7e8f9",
  "object": "file",
  "deleted": true
}
```

## Code samples

### curl

```bash
# Set DEEPSEEK_API_KEY to your API key before running this example.
# Set DEEPSEEK_FILE_ID to the id returned by the upload example.
curl --silent --show-error --max-time 60 --request DELETE "https://api.deepseek.com/files/${DEEPSEEK_FILE_ID}" \
  --header "Authorization: Bearer ${DEEPSEEK_API_KEY}"
```

### Python — OpenAI SDK

```python
# Set DEEPSEEK_API_KEY to your API key before running this example.
# Set DEEPSEEK_FILE_ID to the id returned by the upload example.
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com",
    timeout=60.0,
)

deleted = client.files.delete(os.environ["DEEPSEEK_FILE_ID"])
print(deleted.model_dump_json(indent=2))
```

## Referenced schemas

### schema-delete-file-response

**DeleteFileResponse** — `#/components/schemas/DeleteFileResponse`

- `type`: `object`

- `required`: `["id","object","deleted"]`

- **Properties**

  - **`id`** (required)

    The ID of the deleted file.

    - `type`: `string`

  - **`object`** (required)

    The object type, which is always `file`.

    - `type`: `string`

    - `enum`: `["file"]`

  - **`deleted`** (required)

    Whether the file was successfully deleted.

    - `type`: `boolean`
