Skip to main content
Modify the content, importance, metadata, or TTL of an existing memory without changing its identity. When you update new_content, MemLayer automatically re-embeds the new text so the memory immediately reflects its updated meaning in future search and context calls. The memory id is never changed by an update.

Request

Headers

NameRequiredDescription
X-API-KeyYesYour MemLayer API key (ml_live_xxx)
Content-TypeYesapplication/json

Path Parameters

memory_id
string
required
UUID of the memory to update. Obtained from a store response or list call.

Body

user_id
string
required
Must match the user_id of the memory being updated. Used to verify ownership.
agent_id
string
required
Must match the agent_id of the memory being updated. Used to verify ownership.
new_content
string
Replacement text for the memory. Max 10,000 characters. When provided, the memory’s embedding vector is automatically regenerated to reflect the new content. Omit to leave the content unchanged.
metadata
object
Replacement metadata object. This is a full replacement — not a merge. Omit to leave metadata unchanged.
importance
float
New importance score. Range: 0.0–1.0. Omit to leave importance unchanged.
ttl_days
integer
Resets or sets the expiry window in days from now. Range: 1–3650. Omit to leave the existing TTL unchanged.
curl -X PATCH \
  "https://memlayer.online/memories/775263ee-73af-4416-9804-1f274048ae08" \
  -H "X-API-Key: ml_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id":     "user_123",
    "agent_id":    "support_bot",
    "new_content": "User prefers numbered lists and short sentences",
    "importance":  0.9
  }'

Response

Success — 200

Returns the full updated MemoryOut object.
id
string
The memory UUID — unchanged by the update.
content
string
The updated memory text (or the original text if new_content was not provided).
user_id
string
User this memory belongs to.
agent_id
string
Agent associated with this memory.
memory_type
string
One of episodic, semantic, or summary. Not changed by PATCH.
importance
float
Updated importance score, or the original if not changed.
metadata
object
Updated metadata object, or the original if not changed.
score
null
Always null in update responses.
score_detail
null
Always null in update responses.
created_at
string
ISO 8601 timestamp of original creation — not changed by PATCH.
last_accessed
string | null
ISO 8601 timestamp of most recent retrieval.
expires_at
string | null
Updated expiry timestamp if ttl_days was provided, otherwise unchanged.
{
  "id":          "775263ee-73af-4416-9804-1f274048ae08",
  "content":     "User prefers numbered lists and short sentences",
  "user_id":     "user_123",
  "agent_id":    "support_bot",
  "memory_type": "semantic",
  "importance":  0.9,
  "metadata":    {},
  "score":       null,
  "score_detail": null,
  "created_at":    "2026-06-01T10:00:00Z",
  "last_accessed": "2026-06-07T09:00:00Z",
  "expires_at":    null
}

Errors

CodeMeaning
401Invalid or missing X-API-Key
403Account suspended
404Memory not found — check the memory_id and ownership fields
422Validation error — check field types and constraints

Notes

When you supply new_content, MemLayer discards the old embedding vector and generates a fresh one from the new text. No extra API calls needed on your side. The new embedding takes effect immediately — the very next search or context call will rank this memory based on its updated meaning.
PATCH never changes the id field. Any references you’ve stored in your own database (e.g., a foreign key linking a conversation to a memory) remain valid after an update. Only the content, embedding, and mutable fields change.
All body fields except user_id and agent_id are optional. Send only the fields you want to modify. Fields you omit remain exactly as they are:
// Only boost importance — content and metadata untouched
{
  "user_id":   "user_123",
  "agent_id":  "support_bot",
  "importance": 0.95
}