Skip to main content

Remove Memories Safely

Deleting memories is how you honor compliance requests, undo bad data, or clean up expired sessions. Mem0 lets you delete a specific memory, a list of IDs, or everything that matches a filter.
Why it matters
  • Satisfies user erasure (GDPR/CCPA) without touching the rest of your data.
  • Keeps knowledge bases accurate by removing stale or incorrect facts.
  • Works for both the managed Platform API and the OSS SDK.

Key terms

  • memory_id – Unique ID returned by add/search identifying the record to delete.
  • batch_delete – API call that removes up to 1000 memories in one request.
  • delete_all – Filter-based deletion by user, agent, run, or metadata.
  • immutable – Flagged memories that cannot be updated; delete + re-add instead.

How the delete flow works

1

Choose the scope

Decide whether you’re removing a single memory, a list, or everything that matches a filter.
2

Submit the delete call

Call delete, batch_delete, or delete_all with the required IDs or filters.
3

Verify

Confirm the response message, then re-run search or check the dashboard/logs to ensure the memory is gone.

Delete a single memory (Platform)

from mem0 import MemoryClient

client = MemoryClient(api_key="your-api-key")

memory_id = "your_memory_id"
client.delete(memory_id=memory_id)
You’ll receive a confirmation payload. The dashboard reflects the removal within seconds.

Batch delete multiple memories (Platform)

from mem0 import MemoryClient

client = MemoryClient(api_key="your-api-key")

delete_memories = [
    {"memory_id": "id1"},
    {"memory_id": "id2"}
]

response = client.batch_delete(delete_memories)
print(response)

Delete memories by filter (Platform)

from mem0 import MemoryClient

client = MemoryClient(api_key="your-api-key")

# Delete all memories for a specific user
client.delete_all(user_id="alice")
You can also filter by other parameters such as:
  • agent_id
  • run_id
  • 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.

Delete with Mem0 OSS

from mem0 import Memory

memory = Memory()

memory.delete(memory_id="mem_123")
memory.delete_all(user_id="alice")
The OSS JavaScript SDK does not yet expose deletion helpers—use the REST API or Python SDK when self-hosting.

Use cases recap

  • Forget a user’s preferences at their request.
  • Remove outdated or incorrect facts before they spread.
  • Clean up memories after session expiration or retention deadlines.
  • Comply with privacy legislation (GDPR, CCPA) and internal policies.

Method comparison

MethodUse whenIDs requiredFilters
delete(memory_id)You know the exact record✔️✖️
batch_delete([...])You have a list of IDs to purge✔️✖️
delete_all(...)You need to forget a user/agent/run✖️✔️

Put it into practice

See it live