diff --git a/docs/core-concepts/memory-operations/delete.mdx b/docs/core-concepts/memory-operations/delete.mdx
index 4e55a4b9a..3b07b0ca9 100644
--- a/docs/core-concepts/memory-operations/delete.mdx
+++ b/docs/core-concepts/memory-operations/delete.mdx
@@ -107,6 +107,12 @@ client = MemoryClient(api_key="your-api-key")
# Delete all memories for a specific user
client.delete_all(user_id="alice")
+
+# Delete all memories for a specific agent
+client.delete_all(agent_id="support-bot")
+
+# Delete all memories for a specific run
+client.delete_all(run_id="session-xyz")
```
```javascript JavaScript
@@ -127,7 +133,48 @@ You can also filter by other parameters such as:
- `metadata` (as JSON string)
- `delete_all` requires at least one filter (user, agent, run, or metadata). Calling it with no filters raises an error to prevent accidental data loss.
+ **Breaking change:** `delete_all` previously wiped all project memories when called with no filters. It now **raises an error** if no filters are provided. Use `"*"` wildcards for intentional bulk deletion (see below).
+
+
+### Wildcard deletes
+
+Setting a filter to `"*"` deletes **all memories** for that entity type across the entire project. This is an intentionally explicit opt-in to bulk deletion.
+
+
+```python Python
+from mem0 import MemoryClient
+
+client = MemoryClient(api_key="your-api-key")
+
+# Delete all memories across every user in the project
+client.delete_all(user_id="*")
+
+# Delete all memories across every agent in the project
+client.delete_all(agent_id="*")
+
+# Full project wipe — all four filters must be explicitly set to "*"
+client.delete_all(user_id="*", agent_id="*", app_id="*", run_id="*")
+```
+
+```javascript JavaScript
+import MemoryClient from 'mem0ai';
+
+const client = new MemoryClient({ apiKey: "your-api-key" });
+
+// Delete all memories across every user in the project
+client.deleteAll({ user_id: "*" })
+ .then(result => console.log(result))
+ .catch(error => console.error(error));
+
+// Full project wipe — all four filters must be explicitly set to "*"
+client.deleteAll({ user_id: "*", agent_id: "*", app_id: "*", run_id: "*" })
+ .then(result => console.log(result))
+ .catch(error => console.error(error));
+```
+
+
+
+ A full project wipe requires **all four** filters set to `"*"`. Setting only some to `"*"` deletes memories only for those entity types, not the entire project.
## Delete with Mem0 OSS
diff --git a/docs/migration/api-changes.mdx b/docs/migration/api-changes.mdx
index c08dc4925..9a97bf0ae 100644
--- a/docs/migration/api-changes.mdx
+++ b/docs/migration/api-changes.mdx
@@ -255,13 +255,28 @@ def delete(
### delete_all() Method
-#### No Breaking Changes
+#### Breaking Change — Empty filter no longer silently deletes everything
+
+**Before:** calling `delete_all()` with no filters silently deleted **all memories in the project**.
+
+**After:**
+- No filters → raises a validation error (prevents accidental full-project wipe).
+- Concrete ID (e.g. `user_id="alice"`) → deletes memories for that entity (unchanged).
+- `"*"` for a filter → deletes all memories for that entity type across the project (new).
+- All four filters set to `"*"` → explicit full project wipe (new, requires opt-in on every parameter).
+
+This change replaces the silent full-project delete (triggered by an empty or missing filter) with a validation error, and introduces `"*"` wildcards as the intentional path for bulk deletion.
+
```python
-# Same signature in both versions
-def delete_all(
- self,
- user_id: str
-) -> dict
+# v0.x — no filter silently wiped all project memories
+m.delete_all() # DANGER: deleted everything
+m.delete_all(user_id="alice") # deleted alice's memories
+
+# v1.x — no filter now raises an error; use "*" for intentional bulk deletes
+m.delete_all() # ERROR: at least one filter required
+m.delete_all(user_id="alice") # unchanged
+m.delete_all(user_id="*") # NEW — delete all users' memories
+m.delete_all(user_id="*", agent_id="*", app_id="*", run_id="*") # NEW — full project wipe
```
## Platform Client (MemoryClient) Changes
diff --git a/docs/openapi.json b/docs/openapi.json
index dfbf87b0c..1da505361 100644
--- a/docs/openapi.json
+++ b/docs/openapi.json
@@ -1180,7 +1180,7 @@
"tags": [
"memories"
],
- "description": "Delete memories.",
+ "description": "Delete memories by filter. At least one filter is required — previously omitting all filters silently deleted everything; now it returns a validation error.",
"operationId": "memories_delete",
"parameters": [
{
@@ -1189,7 +1189,7 @@
"schema": {
"type": "string"
},
- "description": "Filter memories by user ID."
+ "description": "Filter by user ID. Pass `*` to delete memories for all users."
},
{
"name": "agent_id",
@@ -1197,7 +1197,7 @@
"schema": {
"type": "string"
},
- "description": "Filter memories by agent ID."
+ "description": "Filter by agent ID. Pass `*` to delete memories for all agents."
},
{
"name": "app_id",
@@ -1205,7 +1205,7 @@
"schema": {
"type": "string"
},
- "description": "Filter memories by app ID."
+ "description": "Filter by app ID. Pass `*` to delete memories for all apps."
},
{
"name": "run_id",
@@ -1213,7 +1213,7 @@
"schema": {
"type": "string"
},
- "description": "Filter memories by run ID."
+ "description": "Filter by run ID. Pass `*` to delete memories for all runs."
},
{
"name": "metadata",
@@ -1263,15 +1263,15 @@
"x-code-samples": [
{
"lang": "Python",
- "source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\nclient = MemoryClient(api_key=\"your_api_key\", org_id=\"your_org_id\", project_id=\"your_project_id\")\n\n# Delete all memories for a specific user\nclient.delete_all(user_id=\"\")"
+ "source": "# To use the Python SDK, install the package:\n# pip install mem0ai\n\nfrom mem0 import MemoryClient\nclient = MemoryClient(api_key=\"your_api_key\", org_id=\"your_org_id\", project_id=\"your_project_id\")\n\n# Delete all memories for a specific user\nclient.delete_all(user_id=\"\")\n\n# Delete all memories for every user in the project (wildcard)\nclient.delete_all(user_id=\"*\")\n\n# Full project wipe — all four filters must be explicitly set to \"*\"\nclient.delete_all(user_id=\"*\", agent_id=\"*\", app_id=\"*\", run_id=\"*\")\n\n# NOTE: Calling delete_all() with no filters raises a validation error.\n# At least one filter is required to prevent accidental data loss."
},
{
"lang": "JavaScript",
- "source": "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\n// Delete all memories for a specific user\nclient.deleteAll({ user_id: \"\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
+ "source": "// To use the JavaScript SDK, install the package:\n// npm i mem0ai\n\nimport MemoryClient from 'mem0ai';\nconst client = new MemoryClient({ apiKey: \"your-api-key\" });\n\n// Delete all memories for a specific user\nclient.deleteAll({ user_id: \"\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));\n\n// Delete all memories for every user in the project (wildcard)\nclient.deleteAll({ user_id: \"*\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));\n\n// Full project wipe — all four filters must be explicitly set to \"*\"\nclient.deleteAll({ user_id: \"*\", agent_id: \"*\", app_id: \"*\", run_id: \"*\" })\n .then(result => console.log(result))\n .catch(error => console.error(error));"
},
{
"lang": "cURL",
- "source": "curl --request DELETE \\\n --url https://api.mem0.ai/v1/memories/ \\\n --header 'Authorization: Token '"
+ "source": "# Delete memories for a specific user\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=' \\\n --header 'Authorization: Token '\n\n# Delete memories for all users (wildcard)\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=*' \\\n --header 'Authorization: Token '\n\n# Full project wipe — all four filters must be set to *\ncurl --request DELETE \\\n --url 'https://api.mem0.ai/v1/memories/?user_id=*&agent_id=*&app_id=*&run_id=*' \\\n --header 'Authorization: Token '"
},
{
"lang": "Go",
@@ -5570,26 +5570,26 @@
},
"DeleteMemoriesInput": {
"type": "object",
- "description": "Input for deleting memories associated with a specific user, agent, app, or run.",
+ "description": "Filters for bulk memory deletion. At least one field is required. Pass \"*\" for a field to delete all memories for that entity type. Set all four to \"*\" for a full project wipe.",
"properties": {
"user_id": {
"type": "string",
- "description": "The unique identifier of the user whose memories should be deleted.",
+ "description": "User ID to delete memories for. Pass \"*\" for all users.",
"nullable": true
},
"agent_id": {
"type": "string",
- "description": "The unique identifier of the agent whose memories should be deleted.",
+ "description": "Agent ID to delete memories for. Pass \"*\" for all agents.",
"nullable": true
},
"app_id": {
"type": "string",
- "description": "The unique identifier of the application whose memories should be deleted.",
+ "description": "App ID to delete memories for. Pass \"*\" for all apps.",
"nullable": true
},
"run_id": {
"type": "string",
- "description": "The unique identifier of the run whose memories should be deleted.",
+ "description": "Run ID to delete memories for. Pass \"*\" for all runs.",
"nullable": true
}
},
diff --git a/docs/platform/features/async-client.mdx b/docs/platform/features/async-client.mdx
index 14f34dfeb..4ad32dc02 100644
--- a/docs/platform/features/async-client.mdx
+++ b/docs/platform/features/async-client.mdx
@@ -123,6 +123,10 @@ await client.deleteAll({ user_id: "alice" });
+
+ At least one filter (`user_id`, `agent_id`, `app_id`, or `run_id`) is required — calling `delete_all` with no filters raises an error to prevent accidental data loss. You can pass `"*"` as a value to delete all memories for a given entity type (e.g., `user_id="*"` removes memories for every user). A full project wipe requires all four filters set to `"*"`.
+
+
### History
Get the history of a specific memory asynchronously.