POST /memory/add
Add new memories from a conversation. Mem0 automatically extracts and stores relevant facts from the messages. The API can automatically classify the memory type using LLM-based classification.Request Body
Array of message objects representing the conversation.
Unique identifier for the user. All memories are associated with this user ID.
Optional metadata to attach to the memory. You can include custom fields like tags, timestamps, or manually specify
memory_type.Enable automatic memory type classification. When enabled, the API uses GPT-4.1-nano to classify the memory into one of five types: LONG_TERM, SHORT_TERM, EPISODIC, SEMANTIC, or PROCEDURAL.
Response
Indicates whether the operation was successful.
The result from mem0 containing memory IDs and extracted information.
The automatically classified memory type (LONG_TERM, SHORT_TERM, EPISODIC, SEMANTIC, or PROCEDURAL). Only present if
auto_classify is enabled.Example Request
Example Response
Manual Memory Type Override
You can manually specify the memory type by including it in the metadata:Error Responses
Error message describing what went wrong.
Implementation Details
- Source:
backend/main.py:189 - Classification Model: GPT-4.1-nano-2025-04-14
- Default Classification: LONG_TERM (used as fallback on classification errors)
- Memory Extraction: Powered by mem0, which intelligently extracts facts from conversations