Delete Documents
Overview
The Delete Documents endpoint permanently removes one or multiple documents from the KnowledgeVerse AI platform. This operation deletes the document content, vector embeddings, and all associated metadata. Deletion is immediate and irreversible.
Use this endpoint to:
- Remove single or multiple documents in one request
- Clean up processed documents that are no longer needed
- Implement document lifecycle management in your applications
- Free up resources and reduce storage costs
Endpoint Details
Method:
DELETE
Endpoint:/api/doc/delete
Base URL:https://api.k-v.ai
Authentication: Access Key (Required)
Request Specification
Headers
| Header | Type | Required | Description |
|---|---|---|---|
| access-key | string | Yes | Your unique access-key generated from the platform UI |
| Content-Type | string | Yes | Must be application/json |
Request Body
{
"doc_process_ids": [
"75c7bf79d18df4bb399e2d23f6757ccf",
"6d301787ad5585f205750b7801d46588"
]
}Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
| doc_process_ids | array | Yes | Array of document process IDs to delete (minimum: 1, maximum: 100 per request) |
Response Specification
Success Response (200 OK)
All documents deleted successfully:
{
"data": {},
"message": "Data deleted successfully"
}Indicates: All provided document IDs were valid and successfully deleted.
Partial Success Response (206 Partial Content)
Some documents deleted, some invalid:
{
"data": {
"invalid_docs": [
"6d301787ad5585f205750b7801d46588"
]
},
"message": "Some docs not deleted due to some invalid doc process ids"
}Indicates:
- Valid document IDs are successfully deleted
- Invalid document IDs are listed in
invalid_docs - HTTP status 206 indicates partial success
Response Fields
| Field | Type | Description |
|---|---|---|
| data.invalid_docs | array | List of document IDs that were not found or could not be deleted |
| message | string | Indicates partial success with some invalid IDs |
Error Responses
401 Unauthorized
{
"data": {},
"message": "Invalid or missing access key"
}Cause: Missing or invalid access-key header.
400 Bad Request
All provided document IDs are invalid:
{
"data": {
"invalid_docs": [
"75c7bf79d18df4bb399e2d23f6757ccf",
"6d301787ad5585f205750b7801d46588"
]
},
"message": "Invalid doc process ids"
}Causes:
- All document IDs in the request are invalid
- Document IDs don't exist in your account
500 Internal Server Error
{
"data": {},
"message": "Something went wrong"
}Cause: Server-side processing error or database connectivity issue.
Important Notes
- Document IDs: Use the
doc_process_idvalues obtained from the "List Documents" or "Upload Document" APIs. - Validation: Invalid document IDs are reported in the response without affecting valid deletions.
Code Snippets
curl --location --request DELETE 'https://api.k-v.ai/api/doc/delete' \
--header 'access-key: 1d601fe74a4cab36cc07864bd455ad73' \
--header 'Content-Type: application/json' \
--data '{
"doc_process_ids": ["f4e09f3ca3a0a8b0ed88749a9558e596"]
}'import requests
import json
url = "https://api.k-v.ai/api/doc/delete"
payload = json.dumps({
"doc_process_ids": [
"f4e09f3ca3a0a8b0ed88749a9558e596"
]
})
headers = {
'access-key': 'YOUR_ACCESS_KEY',
'Content-Type': 'application/json'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)const axios = require('axios');
let data = JSON.stringify({
"doc_process_ids": [
"f4e09f3ca3a0a8b0ed88749a9558e596"
]
});
let config = {
method: 'delete',
maxBodyLength: Infinity,
url: 'https://api.k-v.ai/api/doc/delete',
headers: {
'access-key': 'YOUR_ACCESS_KEY',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});Important Warnings
Permanent Deletion
Deleted documents cannot be recovered. Always verify IDs before deletion.
Cascade Effects
Deleting a document removes:
- Original document content
- Vector embeddings
- Search index entries
- All metadata and processing history
Knowledge Agent Impact
Documents used in knowledge agents will no longer be searchable after deletion.
Data Retention
- Immediate Deletion: Documents are removed from the system immediately
- No Recovery Period: There is no grace period or "trash bin" for recovery
Next Steps
After deleting documents:
- Verify Deletion: Use the "List Documents" API to confirm removal
- Update Knowledge Agents: Remove references to deleted documents in your agents
- Upload New Documents: Replace deleted documents if needed
Need Help? Contact support at support@k-v.ai