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
| Name | Required | Description |
|---|---|---|
X-API-Key | Yes | Your MemLayer API key (ml_live_xxx) |
Content-Type | Yes | application/json |
Path Parameters
Body
Must match the
user_id of the memory being updated. Used to verify ownership.Must match the
agent_id of the memory being updated. Used to verify ownership.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.
Replacement metadata object. This is a full replacement — not a merge. Omit to leave metadata unchanged.
New importance score. Range: 0.0–1.0. Omit to leave importance unchanged.
Resets or sets the expiry window in days from now. Range: 1–3650. Omit to leave the existing TTL unchanged.
Response
Success — 200
Returns the full updatedMemoryOut object.
The memory UUID — unchanged by the update.
The updated memory text (or the original text if
new_content was not provided).User this memory belongs to.
Agent associated with this memory.
One of
episodic, semantic, or summary. Not changed by PATCH.Updated importance score, or the original if not changed.
Updated metadata object, or the original if not changed.
Always
null in update responses.Always
null in update responses.ISO 8601 timestamp of original creation — not changed by PATCH.
ISO 8601 timestamp of most recent retrieval.
Updated expiry timestamp if
ttl_days was provided, otherwise unchanged.Errors
| Code | Meaning |
|---|---|
401 | Invalid or missing X-API-Key |
403 | Account suspended |
404 | Memory not found — check the memory_id and ownership fields |
422 | Validation error — check field types and constraints |
Notes
Embedding is regenerated automatically
Embedding is regenerated automatically
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.Memory ID is always preserved
Memory ID is always preserved
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.Partial updates — only send what you want to change
Partial updates — only send what you want to 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: