Delete Source
import requests
url = "https://api.hydradb.com/knowledge/delete_knowledge"
payload = {
"tenant_id": "tenant_1234",
"ids": ["HydraDoc1234", "HydraDoc4567"],
"sub_tenant_id": "sub_tenant_4567"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tenant_id: 'tenant_1234',
ids: ['HydraDoc1234', 'HydraDoc4567'],
sub_tenant_id: 'sub_tenant_4567'
})
};
fetch('https://api.hydradb.com/knowledge/delete_knowledge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.hydradb.com/knowledge/delete_knowledge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tenant_id": "tenant_1234",
"ids": [
"HydraDoc1234",
"HydraDoc4567"
],
"sub_tenant_id": "sub_tenant_4567"
}
'{
"success": true,
"message": "Delete completed",
"results": [],
"deleted_count": 1
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}Knowledge & Memories
Delete Knowledge
Permanently delete one or more knowledge sources by ID.
POST
/
knowledge
/
delete_knowledge
Delete Source
import requests
url = "https://api.hydradb.com/knowledge/delete_knowledge"
payload = {
"tenant_id": "tenant_1234",
"ids": ["HydraDoc1234", "HydraDoc4567"],
"sub_tenant_id": "sub_tenant_4567"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
tenant_id: 'tenant_1234',
ids: ['HydraDoc1234', 'HydraDoc4567'],
sub_tenant_id: 'sub_tenant_4567'
})
};
fetch('https://api.hydradb.com/knowledge/delete_knowledge', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.hydradb.com/knowledge/delete_knowledge \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tenant_id": "tenant_1234",
"ids": [
"HydraDoc1234",
"HydraDoc4567"
],
"sub_tenant_id": "sub_tenant_4567"
}
'{
"success": true,
"message": "Delete completed",
"results": [],
"deleted_count": 1
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}{
"detail": {
"success": true,
"message": "Error occurred",
"error_code": "<string>"
}
}When to use it
- Cleanup – remove outdated documents
- Right-to-deletion – fulfill GDPR/privacy requests for specific items
- Reprocessing – delete then re-ingest after changing metadata schema or content
DELETE /memories/delete_memory. To remove an entire tenant, use DELETE /tenants/delete.
This operation is irreversible. Deleted sources cannot be recovered.
Endpoint
- Auth: Bearer token
- Idempotency: Re-sending a previously-deleted ID returns
deleted: falsefor that item, but the request as a whole still returns200. - Async: No
Why POST and not DELETE? This endpoint accepts a JSON body with an array of IDs. Some HTTP infrastructure strips bodies from
DELETE requests, so HydraDB uses POST to ensure the bulk payload is reliably transmitted.Example
curl -X POST 'https://api.hydradb.com/knowledge/delete_knowledge' \
-H "Authorization: Bearer <your_api_key>" \
-H "Content-Type: application/json" \
-d '{
"tenant_id": "my_first_tenant",
"ids": ["doc_12345", "doc_67890"]
}'
const response = await client.data.delete({
tenant_id: "my_first_tenant",
ids: ["doc_12345", "doc_67890"]
});
response = client.data.delete(
tenant_id="my_first_tenant",
ids=["doc_12345", "doc_67890"],
)
Request parameters
| Name | Type | Required | Description |
|---|---|---|---|
tenant_id | string | Yes | The tenant the sources belong to. |
ids | string[] | Yes | One or more source_id values to delete (minimum 1). |
sub_tenant_id | string | No | Sub-tenant scope. If omitted, the default sub-tenant is used. |
Response
{
"success": true,
"message": "Delete completed",
"results": [
{
"id": "doc_12345",
"deleted": true,
"error": null
},
{
"id": "doc_67890",
"deleted": false,
"error": "Source not found"
}
],
"deleted_count": 1
}
| Field | Description |
|---|---|
success | true if the request was processed (regardless of per-item outcomes). |
results[] | One entry per requested ID. |
results[].id | The source ID that was processed. |
results[].deleted | true if the source was found and deleted, false otherwise. |
results[].error | Error message if deleted: false. |
deleted_count | Total number of sources successfully deleted. |
Behavior notes
Partial success is possible. A request can return
success: true while some individual items fail. Always inspect results[] to confirm each deletion outcome – don’t rely on the top-level success flag alone.Cascade scope. Deleting a knowledge source removes its chunks, embeddings, and any graph entities/relations exclusively associated with it. Entities shared with other sources are retained.
Related endpoints
- Browse before deleting: List data – confirm what you’re about to remove
- Delete a single memory: Delete memory
- Delete an entire tenant: Delete tenant
Errors
Common codes:400 INVALID_PARAMETERS, 404 TENANT_NOT_FOUND, 422 VALIDATION_ERROR. See Error Responses for the full list.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Was this page helpful?
