> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lacy.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete document

> Delete a document from a knowledgebase

This endpoint permanently deletes a document from a knowledgebase. The document's vector embeddings are also removed from the vector database.

### Path Parameters

**knowledgebaseId** `integer` *required*

The unique identifier of the knowledgebase

**documentId** `integer` *required*

The unique identifier of the document to delete

### Response

**message** `string`

Success message

```json 200 Response theme={null}
{
  "message": "Document deleted successfully."
}
```

```json 404 Knowledgebase Not Found theme={null}
{
  "error": "Knowledgebase not found."
}
```

```json 404 Document Not Found theme={null}
{
  "error": "Document not found."
}
```

```json 500 Error theme={null}
{
  "error": "Failed to delete document. Please try again."
}
```

### What Gets Deleted

When you delete a document:

* **Document record** is removed from the database
* **Vector embeddings** are deleted from the vector database
* **Processed content** is removed from external document stores
* **Parent knowledgebase status** is updated automatically

> [!WARNING]
>
> This action is irreversible. The document and all its processed content will be permanently deleted.

> [!NOTE]
>
> If this was the last document in the knowledgebase, the knowledgebase status will change to `empty`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.