client.context.delete(
type="knowledge",
database="acme_corp",
collection="team_docs",
ids=["policy_main", "runbook_deploy"],
)
await client.context.delete({
type: "knowledge",
database: "acme_corp",
collection: "team_docs",
ids: ["policy_main", "runbook_deploy"],
});
curl -X DELETE 'https://api.hydradb.com/context' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
-H "Content-Type: application/json" \
-d '{
"database": "acme_corp",
"collection": "team_docs",
"ids": ["policy_main", "runbook_deploy"],
"type": "knowledge"
}'
{
"success": true,
"data": {
"success": true,
"message": "Successfully deleted 2 source(s)",
"results": [
{ "id": "policy_main", "deleted": true },
{ "id": "runbook_deploy", "deleted": true }
],
"deleted_count": 2
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"success": true,
"message": "Successfully deleted 1 memory source(s)",
"results": [
{ "id": "mem_user_alex_tone", "deleted": true }
],
"deleted_count": 1,
"user_memory_deleted": 1
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
Context
Delete Context
Delete knowledge or memories by their IDs.
DELETE
/
context
client.context.delete(
type="knowledge",
database="acme_corp",
collection="team_docs",
ids=["policy_main", "runbook_deploy"],
)
await client.context.delete({
type: "knowledge",
database: "acme_corp",
collection: "team_docs",
ids: ["policy_main", "runbook_deploy"],
});
curl -X DELETE 'https://api.hydradb.com/context' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
-H "Content-Type: application/json" \
-d '{
"database": "acme_corp",
"collection": "team_docs",
"ids": ["policy_main", "runbook_deploy"],
"type": "knowledge"
}'
{
"success": true,
"data": {
"success": true,
"message": "Successfully deleted 2 source(s)",
"results": [
{ "id": "policy_main", "deleted": true },
{ "id": "runbook_deploy", "deleted": true }
],
"deleted_count": 2
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"success": true,
"message": "Successfully deleted 1 memory source(s)",
"results": [
{ "id": "mem_user_alex_tone", "deleted": true }
],
"deleted_count": 1,
"user_memory_deleted": 1
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
Delete one or more sources by ID.
A knowledge batch is not deleted while any requested source is still indexing. Check Ingestion Status before retrying.
type selects where to delete from: knowledge (the default), memory, or all to delete matching IDs from both.
Send database, collection, ids, and type as top-level fields in the request body. Include the same collection used at ingestion. Omitting it targets the default collection.
client.context.delete(
type="knowledge",
database="acme_corp",
collection="team_docs",
ids=["policy_main", "runbook_deploy"],
)
await client.context.delete({
type: "knowledge",
database: "acme_corp",
collection: "team_docs",
ids: ["policy_main", "runbook_deploy"],
});
curl -X DELETE 'https://api.hydradb.com/context' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2" \
-H "Content-Type: application/json" \
-d '{
"database": "acme_corp",
"collection": "team_docs",
"ids": ["policy_main", "runbook_deploy"],
"type": "knowledge"
}'
{
"success": true,
"data": {
"success": true,
"message": "Successfully deleted 2 source(s)",
"results": [
{ "id": "policy_main", "deleted": true },
{ "id": "runbook_deploy", "deleted": true }
],
"deleted_count": 2
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": true,
"data": {
"success": true,
"message": "Successfully deleted 1 memory source(s)",
"results": [
{ "id": "mem_user_alex_tone", "deleted": true }
],
"deleted_count": 1,
"user_memory_deleted": 1
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
Status codes
By default the call can return200 even when nothing was deleted. Check data.deleted_count for the number deleted and data.results[] for each ID’s outcome.
Strict status codes
SendX-HydraDB-Delete-Status: strict to receive error statuses when deletion fails.
| Status | Code | Meaning |
|---|---|---|
200 | None | At least one source was deleted. Check results[] for each ID. |
404 | NOT_FOUND | Nothing matched the supplied IDs. |
409 | SOURCE_PROCESSING | A source is still indexing. Retry after indexing completes. |
500 | INTERNAL_ERROR | Deletion failed. Retry the request. |
Related resources
- Before this: List Context: find the IDs to delete
- After this: Ingest Context: ingest replacement content
- Related: Delete Database: remove the entire database
- Related: Context: Overview
Authorizations
Headers
Body
application/json
Delete request
Response
OK
Show child attributes
Show child attributes
Example:
{
"collection": "team_docs",
"database": "acme_corp",
"latency_ms": 12.3,
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"source_type": "file",
"sub_tenant_id": "sub_tenant_4567",
"tenant_id": "tenant_1234",
"warnings": [
{
"code": "acl_ignored_by_connector_enforcement",
"collections": ["team_docs", "engineering"],
"message": "This connector enforces ACL, so the request's acl was ignored."
}
]
}
Was this page helpful?
