response = client.databases.delete_collection(
database="my_first_database",
collection="engineering",
)
const response = await client.databases.deleteCollection({
database: "my_first_database",
collection: "engineering",
});
curl -X DELETE 'https://api.hydradb.com/databases/collections?database=my_first_database&collection=engineering' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
{
"success": true,
"data": {
"database": "my_first_database",
"collection": "engineering",
"status": "deletion_scheduled",
"message": "Collection deregistered. Background cleanup is in progress."
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "DATABASE_NOT_FOUND",
"message": "Database not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
Databases
Delete Collection
Permanently remove one collection and all of its data from a database.
DELETE
/
databases
/
collections
response = client.databases.delete_collection(
database="my_first_database",
collection="engineering",
)
const response = await client.databases.deleteCollection({
database: "my_first_database",
collection: "engineering",
});
curl -X DELETE 'https://api.hydradb.com/databases/collections?database=my_first_database&collection=engineering' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
{
"success": true,
"data": {
"database": "my_first_database",
"collection": "engineering",
"status": "deletion_scheduled",
"message": "Collection deregistered. Background cleanup is in progress."
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "DATABASE_NOT_FOUND",
"message": "Database not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
This action is irreversible. Deleting a collection removes all knowledge, memories, embeddings, and graph data stored under that collection. The parent database and its other collections are not affected. There is no soft-delete and no recovery window.
response = client.databases.delete_collection(
database="my_first_database",
collection="engineering",
)
const response = await client.databases.deleteCollection({
database: "my_first_database",
collection: "engineering",
});
curl -X DELETE 'https://api.hydradb.com/databases/collections?database=my_first_database&collection=engineering' \
-H "Authorization: Bearer <your_api_key>" \
-H "API-Version: 2"
Query parameters
| Name | Description |
|---|---|
| Identifier of the database that owns the collection. | |
| Identifier of the collection to delete. |
{
"success": true,
"data": {
"database": "my_first_database",
"collection": "engineering",
"status": "deletion_scheduled",
"message": "Collection deregistered. Background cleanup is in progress."
},
"error": null,
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 12.3
}
}
{
"success": false,
"data": null,
"error": {
"code": "DATABASE_NOT_FOUND",
"message": "Database not found"
},
"meta": {
"request_id": "9d13aef4-02f4-4e73-8c62-4c2601d04f9d",
"latency_ms": 4.8
}
}
While cleanup is running
Deletion is asynchronous: a200 means cleanup was accepted, not that it finished. From the moment the API accepts the call, the collection is fenced:
- Every ingest, query, and read addressed to it returns
404, so nothing can write into a collection that is being purged. Sibling collections in the same database, and the database itself, are unaffected and keep serving normally. - Ingestion already in flight for this collection is cancelled before any store is purged, so a job that started before the delete cannot repopulate it afterwards.
- The collection disappears from List Collections once its records are dropped, which happens before the slower vector, graph, and object-store cleanup completes.
DELETE returning 200 is not a completion signal either.
To reuse the collection name:
- Ingest the new context. While cleanup is running, the API returns
404. Retry later. - Writes succeed only after cleanup finishes in every store. A successful write also creates the collection, so use it to ingest context rather than to check deletion status.
Behavior notes
- Repeat calls are the retry path: Deleting the same collection again is idempotent. A duplicate call while cleanup is still running joins the delete in progress rather than starting a second one. If a cleanup fails part-way, the collection stays fenced and re-issuing the same
DELETEre-runs it. - In-flight ingestion cancelled by deletion is reported as failed.
- Dashboard: Owners can also expand a database on the Databases page and delete a collection from the inline list.
Errors
Common codes:400 INVALID_INPUT (database or collection is missing), 404 DATABASE_NOT_FOUND (a database that is itself being deleted returns 404 NOT_FOUND), 401 UNAUTHORIZED, 503 SERVICE_UNAVAILABLE (an earlier failed deletion of this collection is still releasing its lock; the collection stays fenced, so retry in a few seconds), and 500 INTERNAL_ERROR (transient; retry the same DELETE). See Error Responses for the full list.
Related resources
- Before this: List Collections: find the collection ID
- Alternative: Delete Context: remove specific knowledge or memories without deleting the collection
- Larger scope: Delete Database: remove the entire database
- Read more: Concepts: Multi tenancy
Authorizations
Send your API key as Authorization: Bearer <your_api_key>.
Query Parameters
Database identifier
Example:
"acme_corp"
Collection identifier
Example:
"team_docs"
Response
OK
Show child attributes
Show child attributes
Example:
{
"collection": "team_docs",
"database": "acme_corp",
"message": "Success",
"status": "completed",
"sub_tenant_id": "sub_tenant_4567",
"tenant_id": "tenant_1234"
}
Error details on failure, or null on success.
Show child attributes
Show child attributes
Example:
null
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",
"message": "This connector enforces ACL, so the request's acl was ignored."
}
]
}
Whether the request succeeded.
Example:
true
Was this page helpful?
