Skip to main content

GET /memory/history/

Retrieve the complete change history for a specific memory. This endpoint provides a changelog of all modifications made to the memory over time, useful for tracking how memories evolve.

Path Parameters

memory_id
string
required
The unique identifier of the memory whose history you want to retrieve.

Response

success
boolean
Indicates whether the request was successful.
history
array
Array of history entries showing all changes to the memory.

Example Request

curl http://localhost:8000/memory/history/mem_abc123

Example Response

{
  "success": true,
  "history": [
    {
      "id": "hist_001",
      "memory_id": "mem_abc123",
      "prev_value": null,
      "new_value": "User prefers TypeScript for new projects",
      "event": "ADD",
      "timestamp": "2025-03-01T10:00:00Z",
      "is_deleted": false
    },
    {
      "id": "hist_002",
      "memory_id": "mem_abc123",
      "prev_value": "User prefers TypeScript for new projects",
      "new_value": "User prefers TypeScript over JavaScript for new projects",
      "event": "UPDATE",
      "timestamp": "2025-03-02T15:30:00Z",
      "is_deleted": false
    }
  ]
}

Use Cases

Audit Trail

Track how user preferences and facts change over time for debugging or compliance.

Memory Evolution

Understand how AI’s understanding of user preferences has evolved through interactions.

Rollback Support

View previous versions to potentially restore earlier memory states.

Quality Control

Review memory updates to ensure AI is correctly refining its understanding.

Understanding Memory Versioning

Mem0 maintains a complete history of all changes to memories:
  • ADD events: Initial memory creation
  • UPDATE events: Modifications to existing memories (typically refinements or corrections)
  • DELETE events: Soft deletes (memory marked as deleted but history preserved)
Memory history is useful for understanding how the system learns from user interactions. Each update typically represents the AI refining its understanding based on new context.
Source: backend/main.py:356-365

Build docs developers (and LLMs) love