> For a complete page index of the Captain API documentation, fetch https://docs.captain.dev/llms.txt?excludeSpec=true

# Delete Document

DELETE https://api.filesearch.dev/v2/collections/{collection_name}/documents/{document_id}

Delete one document from a collection by document ID.

Reference: https://docs.runcaptain.com/reference/v2/document/delete

## Request

### Path parameters

- `collection_name` (string, required)
- `document_id` (string, required)

## Response

### 200

Successful Response

- `message` (string, required)
- `success` (boolean, required)
- `document_id` (string, optional, nullable)
- `documents_deleted` (integer, optional, nullable)

## Examples

**Response**

```json
{
  "message": "Document 'doc_abc123' deleted successfully",
  "success": true
}
```

**SDK Code**

```python Python REST
import requests

BASE_URL = "https://api.filesearch.dev"
API_KEY = "your_api_key"

headers = {
    "Authorization": f"Bearer {API_KEY}",
}

response = requests.delete(
    f"{BASE_URL}/v2/collections/my_documents/documents/doc_abc123",
    headers=headers,
    timeout=30.0
)

if response.status_code == 200:
    print("Document deleted successfully!")
else:
    print(f"Error: {response.status_code}")
```

```typescript TypeScript REST
const response = await fetch(
    "https://api.filesearch.dev/v2/collections/my_documents/documents/doc_abc123",
    {
        method: "DELETE",
        headers: {
            "Authorization": "Bearer your_api_key",
        }
    }
);

if (response.ok) {
    console.log("Document deleted!");
}
```