GET
/
v1
/
memories
/
{memory_id}
/
history
# To use the Python SDK, install the package:
# pip install mem0ai

from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key", org_id="your_org_id", project_id="your_project_id")

# Add some message to create history
messages = [{"role": "user", "content": "<user-message>"}]
client.add(messages, user_id="<user-id>")

# Add second message to update history
messages.append({"role": "user", "content": "<user-message>"})
client.add(messages, user_id="<user-id>")

# Get history of how memory changed over time
memory_id = "<memory-id-here>"
history = client.history(memory_id)
[
  {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "memory_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "input": [
      {
        "role": "user",
        "content": "<string>"
      }
    ],
    "old_memory": "<string>",
    "new_memory": "<string>",
    "user_id": "<string>",
    "event": "ADD",
    "metadata": {},
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
]

Authorizations

Authorization
string
header
required

API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'

Path Parameters

memory_id
string
required

The unique identifier of the memory to retrieve

Response

200 - application/json
Successfully retrieved the memory history
id
string
required

Unique identifier for the history entry

memory_id
string
required

Unique identifier of the associated memory

input
object[]
required

The conversation input that led to this memory change

new_memory
string
required

The new or updated state of the memory

user_id
string
required

The identifier of the user associated with this memory

event
enum<string>
required

The type of event that occurred

Available options:
ADD,
UPDATE,
DELETE
created_at
string
required

The timestamp when this history entry was created

updated_at
string
required

The timestamp when this history entry was last updated

old_memory
string | null

The previous state of the memory, if applicable

metadata
object | null

Additional metadata associated with the memory change