Memory Operations
Delete Memory
Remove memories from Mem0 either individually, in bulk, or via filters.
Overview
Memories can become outdated, irrelevant, or need to be removed for privacy or compliance reasons. Mem0 offers flexible ways to delete memory:
- Delete a Single Memory: Using a specific memory ID
- Batch Delete: Delete multiple known memory IDs (up to 1000)
- Filtered Delete: Delete memories matching a filter (e.g.,
user_id
,metadata
,run_id
)
This page walks through code example for each method.
Use Cases
- Forget a user’s past preferences by request
- Remove outdated or incorrect memory entries
- Clean up memory after session expiration
- Comply with data deletion requests (e.g., GDPR)
1. Delete a Single Memory by ID
2. Batch Delete Multiple Memories
3. Delete Memories by Filter (e.g., user_id)
You can also filter by other parameters such as:
agent_id
run_id
metadata
(as JSON string)
Key Differences
Method | Use When | IDs Needed | Filters |
---|---|---|---|
delete(memory_id) | You know exactly which memory to remove | ✔ | ✘ |
batch_delete([...]) | You have a known list of memory IDs | ✔ | ✘ |
delete_all(...) | You want to delete by user/agent/run/etc | ✘ | ✔ |
More Details
For request/response schema and additional filtering options, see:
You’ve now seen how to add, search, update, and delete memories in Mem0.
Need help?
If you have any questions, please feel free to reach out to us using one of the following methods: