Skip to main content
Permanently removes one specific memory. Both user_id and agent_id must match the stored memory’s owner — you cannot delete a memory that belongs to a different user or agent. Deletion is immediate and irreversible; the memory will not appear in any future search, context, or list response.

Request

Headers

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

Path Parameters

memory_id
string
required
UUID of the memory to delete. Obtained from a store response, search, list, or context call.

Query Parameters

user_id
string
required
Must match the user_id of the memory being deleted. Used to verify ownership.
agent_id
string
required
Must match the agent_id of the memory being deleted. Used to verify ownership.
curl -X DELETE \
  "https://memlayer.online/memories/775263ee-73af-4416-9804-1f274048ae08?\
user_id=user_123&agent_id=support_bot" \
  -H "X-API-Key: ml_live_xxx"

Response

Success — 200

deleted
integer
Number of memories deleted. 1 on success, 0 if the memory was not found or ownership did not match.
message
string
Human-readable summary of the operation result.
Memory deleted:
{
  "deleted": 1,
  "message": "Deleted 1 memory."
}
Memory not found or ownership mismatch:
{
  "deleted": 0,
  "message": "Memory not found."
}
The endpoint returns HTTP 200 in both cases. A deleted: 0 result is not an error — it is safe to call this endpoint even if you are unsure whether the memory still exists.

Errors

CodeMeaning
401Invalid or missing X-API-Key
403Account suspended
404Memory ID not found for the given user_id and agent_id
422Validation error — check parameter types