Update memory
Update text and/or metadata.
textchange → supersede (create a new ACTIVE fact pointing back at the old one viasupersedes); fact-only operation.metadatachange → merge onto the existing payload in place (works for any type).- Both → text supersede; the new revision carries the merged metadata. The old revision keeps its original metadata.
Trying to set an entity id / type / created_at via
metadata surfaces 422 immutable_field.
Documentation Index
Fetch the complete documentation index at: https://docs.mem.xtrace.ai/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
Long-lived org API key. Alternative: Authorization: Bearer <key>.
Required alongside the API key (no key→org reverse index).
Headers
Path Parameters
Body
PATCH /v1/memories/{id} — update text and/or metadata.
Metadata is merged onto the existing payload, not replaced.
Immutable fields (type, entity ids, created_at) cannot be
changed via this endpoint; attempting to set them surfaces
422 immutable_field.
New fact text. When provided, supersedes the existing fact: a new ACTIVE row is created pointing back at the old one via supersedes, the old row's tag2 flips to superseded. Fact-only — sending text on an artifact or episode row returns 422. Empty / whitespace-only values return 422 empty_text_field.
Customer metadata to merge onto the row. Keys present here replace same-named keys on the existing row; keys absent here are left untouched (no key deletion via PATCH). Setting an immutable field (entity ids, type, created_at) returns 422 immutable_field; setting an internal storage key (tag1-tag5, kb_type, etc.) returns 422 reserved_field.
Response
Successful Response
Unified memory resource — facts, artifacts, episodes marshal to
this shape. type is the discriminator; details is the
type-specific extension.
The mem0-parity invariant: text is always a short readable
preview, regardless of type (fact statement / artifact summary /
episode summary).
Stable UUID for this memory row.
Memory subtype. fact = a single semantic claim extracted from a turn; artifact = a structured object (code, doc, image) referenced by the conversation; episode = a session-scoped summary of a stretch of turns.
fact, artifact, episode Short readable preview. For facts: the claim statement. For artifacts: a summary or title (full body lives in details.full_content, opt-in via include=full_content). For episodes: a summary of the session.
Constant discriminator for the resource type.
"memory"User scope this row belongs to.
Agent scope, if any.
Conversation anchor.
App scope, if any.
Free-form customer-supplied metadata that was on the row at write time. Each key here is independently indexed and filterable on search.
Optional category labels from xmem's extraction pipeline.
Vector-similarity score. Present only on search responses; null on list / get-by-id / patch / ingest result rows.
ISO-8601 timestamp of original ingest.
ISO-8601 timestamp of the last metadata patch / supersede.
Per-row fact details — sits under Memory.details when
Memory.type == "fact". Mirrors the SoT shape, not xmem's raw
Fact shape: e.g. xmem's source_artifact_id → artifact_id.
- FactDetails
- ArtifactDetails
- EpisodeDetails