Skip to content
Get started

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.

ParametersExpand Collapse
container_tag: str

Container tag / space identifier. Required to scope the operation.

maxLength100
new_content: str

The new content that will replace the existing memory

minLength1
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.

formatdatetime
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.

One of the following:
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

formatdatetime
event_date: Optional[Sequence[str]]

Dates of events referenced in the memory

ReturnsExpand Collapse
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

formatdatetime
forget_after: Optional[str]

When this memory will be auto-forgotten, or null if no expiry

formatdatetime
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

Update a memory (creates new version)

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)
{
  "id": "mem_xyz789",
  "createdAt": "createdAt",
  "forgetAfter": "forgetAfter",
  "forgetReason": "forgetReason",
  "memory": "John now prefers light mode",
  "parentMemoryId": "mem_abc123",
  "rootMemoryId": "mem_abc123",
  "version": 2
}
Returns Examples
{
  "id": "mem_xyz789",
  "createdAt": "createdAt",
  "forgetAfter": "forgetAfter",
  "forgetReason": "forgetReason",
  "memory": "John now prefers light mode",
  "parentMemoryId": "mem_abc123",
  "rootMemoryId": "mem_abc123",
  "version": 2
}