## Update a memory (creates new version) `memories.update_memory(MemoryUpdateMemoryParams**kwargs) -> MemoryUpdateMemoryResponse` **patch** `/v4/memories` Update a memory by creating a new version. The original memory is preserved with isLatest=false. ### Parameters - `container_tag: str` Container tag / space identifier. Required to scope the operation. - `new_content: str` The new content that will replace the existing memory - `id: Optional[str]` ID of the memory entry to operate on - `content: Optional[str]` Exact content match of the memory entry to operate on. Use this when you don't have the ID. - `forget_after: Optional[str]` ISO 8601 datetime string. The memory will be auto-forgotten after this time. Pass null to clear an existing expiry. Omit to inherit from the previous version. - `forget_reason: Optional[str]` Optional reason for the scheduled forgetting. Cleared automatically when forgetAfter is set to null. - `metadata: Optional[Dict[str, Union[str, float, bool, Sequence[str]]]]` Optional metadata. If not provided, inherits from the previous version. - `str` - `float` - `bool` - `Sequence[str]` - `temporal_context: Optional[TemporalContext]` Structured temporal metadata. Merged into the metadata JSON column. If omitted, existing temporalContext is preserved. - `document_date: Optional[str]` Date the document was authored - `event_date: Optional[Sequence[str]]` Dates of events referenced in the memory ### Returns - `class MemoryUpdateMemoryResponse: …` Response after updating a memory - `id: str` ID of the newly created memory version - `created_at: str` When this memory version was created - `forget_after: Optional[str]` When this memory will be auto-forgotten, or null if no expiry - `forget_reason: Optional[str]` Reason for the scheduled forgetting, or null - `memory: str` The content of the new memory version - `parent_memory_id: Optional[str]` ID of the memory this version updates - `root_memory_id: Optional[str]` ID of the first memory in this version chain - `version: float` Version number of this memory entry ### Example ```python import os from supermemory import Supermemory client = Supermemory( api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted ) response = client.memories.update_memory( container_tag="user_123", new_content="John now prefers light mode", ) print(response.id) ``` #### Response ```json { "id": "mem_xyz789", "createdAt": "createdAt", "forgetAfter": "forgetAfter", "forgetReason": "forgetReason", "memory": "John now prefers light mode", "parentMemoryId": "mem_abc123", "rootMemoryId": "mem_abc123", "version": 2 } ```