Overview
When you delete data in Cognee, the system performs a cleanup operation that removes:- Graph Data: Nodes and edges associated with the data item are removed from the graph database (e.g., Neo4j, FalkorDB).
- Vector Embeddings: Embeddings generated for the data are removed from the vector store (e.g., Qdrant, LanceDB).
- Metadata: Records in the relational database tracking the data item are deleted.
- Storage: Raw files are removed only when Cognee owns the file and no other data item references it.
Shared Nodes: If a node in the graph (like an entity “New York”) is shared by multiple data items, it is only removed when the last data item referencing it is deleted. This ensures the integrity of the remaining graph.
Permissions
Deletion is a privileged operation. To delete data, you must have thedelete permission on the dataset containing the data.
- If you created the dataset, you typically have this permission by default.
- In multi-user environments, administrators can grant or revoke this permission.
Python SDK
The Python SDK is the primary way to manage data programmatically.Delete a Single Data Item
To delete a specific document or text entry, you need itsdata_id and the dataset_id it belongs to.
Delete an Entire Dataset
Removing a dataset deletes all data items contained within it and the dataset container itself.Delete All Data
You can wipe all datasets and data that your user has permission to delete.Development Reset (prune)
For local development and testing, you might want to completely reset the system, including caches and system metadata.
CLI and HTTP API
For command-line usage and HTTP API endpoints, refer to their dedicated documentation pages:CLI Reference
Learn how to delete data using
cognee-cli delete.HTTP API Reference
See
DELETE endpoints and curl examples.DELETE /api/v1/delete is deprecated. Use the datasets endpoints instead.