Skip to main content
Permanently removes every memory stored for a user_id and agent_id pair in a single call. This is the right endpoint for GDPR right-to-erasure requests, account deletions, and full agent resets. The confirm=true parameter is required — it must be explicitly set to prevent accidental wipes from misconfigured clients.
This action is irreversible. All memories for the specified user-agent pair are permanently deleted and cannot be recovered. There is no undo. Double-check your user_id and agent_id before calling this endpoint in production.

Request

Headers

NameRequiredDescription
X-API-KeyYesYour MemLayer API key (ml_live_xxx)

Query Parameters

user_id
string
required
Delete all memories belonging to this user.
agent_id
string
required
Delete all memories associated with this agent. Memories for the same user_id under a different agent_id are unaffected.
confirm
boolean
required
Must be true. The request is rejected with HTTP 400 if confirm is false or omitted. This safeguard prevents accidental bulk deletions.
curl -X DELETE \
  "https://memlayer.online/memories?\
user_id=user_123&agent_id=support_bot&confirm=true" \
  -H "X-API-Key: ml_live_xxx"

Response

Success — 200

deleted
integer
Total number of memories permanently removed. 0 if the user-agent pair had no memories stored.
message
string
Human-readable summary including the count of deleted memories.
{
  "deleted": 47,
  "message": "Deleted 47 memories."
}

Errors

CodeMeaning
400confirm was false or not provided — nothing was deleted
401Invalid or missing X-API-Key
403Account suspended
422Validation error — check parameter types
400 response when confirm is false:
{
  "detail": "Set confirm=true to wipe all memories."
}

Notes

This endpoint only deletes memories for the exact user_id + agent_id combination you provide. If the same user has memories across multiple agents (e.g. support_bot and sales_agent), each pair must be wiped separately. Memories from other users are never affected.
When a user requests deletion of their data, iterate over all agent IDs associated with that user and call this endpoint for each:
agent_ids = ["support_bot", "sales_agent", "onboarding_bot"]

for agent_id in agent_ids:
    result = client.forget_all(user_id=user_id, agent_id=agent_id)
    print(f"Deleted {result.deleted} memories for agent {agent_id}")
If you want more control, use GET /memories to inspect what will be deleted, then call DELETE /memories/ for each memory individually. This is slower but lets you keep specific memories if needed.