Skip to main content

PUT /memory/update

Update an existing memory’s content. This endpoint allows you to modify the stored information for a specific memory while preserving its ID and metadata.

Request Body

string
required
The unique identifier of the memory to update.
string
required
The new content for the memory. This will replace the existing memory content.

Response

boolean
Indicates whether the operation was successful.
object
The result from mem0 containing update confirmation and metadata.

Example Request

Example Response

Updating Memory Type

The PUT /memory/update endpoint only updates the memory content (data field). Memory type and other metadata cannot be updated through this endpoint. To change metadata, you need to delete the memory and create a new one with the desired metadata.

Use Cases

Correcting Information Update a memory when you realize the stored information is incorrect:
Refining Details Add more specific information to an existing memory:

Error Responses

string
Error message describing what went wrong.
500 Internal Server Error
Common Error Scenarios
  1. Invalid Memory ID: The provided memory_id doesn’t exist
  2. Empty Data: The data field cannot be empty
  3. Database Connection: Failure to connect to the vector store

Memory History

Mem0 maintains a history of memory changes. To view the history of updates for a memory, use the history endpoint:

Implementation Details

  • Source: backend/main.py:320
  • Vector Update: The update triggers re-embedding of the new content
  • Metadata Preservation: Existing metadata (including memory_type) is preserved
  • Atomic Operation: Updates are atomic to prevent partial modifications