Delete Document

Delete Document

This method allows you to remove a document from an index.

When a document is removed, its embeddings (if any) are removed from the vector-store associated with the index, and its chunks will no-longer appear in any search result.

Note that you can only remove documents from an index for a knowledge base that was created with data_origin_type=LOCAL_FILES. For details, refer to the method to Create a new knowledge base.

To remove documents from any other type of index, remove the documents from the underlying data source and trigger a new indexing. Any document that is not found in the data source will be removed automatically as part of the indexing.

Request
URI
DELETE
https://{api_host}/api/v1/control/knowledge-bases/{knowledge_base_id}/indexes/{index_id}/documents/{document_id}
COPY
Path Parameters
string
knowledge_base_id
Required

knowledge_base_id

string
index_id
Required

index_id

string
document_id
Required

document_id


Authentication
This operation uses the following authentication methods.
Responses
200

Successful Response

Returns DeletionStatusResponse of type(s) application/json
{
    "id": "string",
    "object": "string",
    "deleted": false
}
string As uuid As uuid
id
Required

id

string
object
Required

object

boolean
deleted
Required

deleted


404

Invalid document ID or mismatched knowledge base and document IDs.

Operation doesn't return any data structure

422

Validation Error

Returns HTTPValidationError of type(s) application/json
"HTTPValidationError Object"
array of object
detail
Optional

detail


Code Samples
COPY
                    curl -X DELETE -H 'Authorization: <value>' https://{api_host}/api/v1/control/knowledge-bases/{knowledge_base_id}/indexes/{index_id}/documents/{document_id}