Endpoint
- Method:
POST - URL:
/v1/memories/ - Content-Type:
application/json
Required headers
| Header | Required | Description |
|---|---|---|
Authorization: Bearer <MEM0_API_KEY> | Yes | API key scoped to your workspace. |
Accept: application/json | Yes | Ensures a JSON response. |
Request body
Provide at least one message or direct memory string. Most callers supplymessages so Mem0 can infer structured memories as part of ingestion.
Common fields
| Field | Type | Required | Description |
|---|---|---|---|
user_id | string | No* | Associates the memory with a user. Provide when you want the memory scoped to a specific identity. |
messages | array | No* | Conversation turns for Mem0 to infer memories from. Each object should include role and content. |
memory | string | No* | Direct memory text when you do not need inference. |
metadata | object | Optional | Custom key/value metadata (e.g., {"topic": "preferences"}). |
infer | boolean (default true) | Optional | Set to false to skip inference and store the provided text as-is. |
async_mode | boolean (default true) | Optional | Controls asynchronous processing. Most clients leave this enabled. |
output_format | string (default v1.1) | Optional | Response format. v1.1 wraps results in a results array. |
* Provide eithermessagesormemoryto describe what you are storing. For scoped memories, includeuser_id. You can also attachagent_id,app_id,run_id,project_id, ororg_idto refine ownership.
Response
Successful requests return an array of events queued for processing. Each event includes the generated memory text and an identifier you can persist for auditing.Graph relationships
Add Memories can enrich the knowledge graph on write. Setenable_graph: true to create entity nodes and relationships for the stored memory. Use this when you want downstream get_all or search calls to traverse connected entities.
Authorizations
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Body
An array of message objects representing the content of the memory. Each message object typically contains 'role' and 'content' fields, where 'role' indicates the sender either 'user' or 'assistant' and 'content' contains the actual message text. This structure allows for the representation of conversations or multi-part memories.
The unique identifier of the agent associated with this memory.
The unique identifier of the user associated with this memory.
The unique identifier of the application associated with this memory.
The unique identifier of the run associated with this memory.
Additional metadata associated with the memory, which can be used to store any additional information or context about the memory. Best practice for incorporating additional information is through metadata (e.g. location, time, ids, etc.). During retrieval, you can either use these metadata alongside the query to fetch relevant memories or retrieve memories based on the query first and then refine the results using metadata during post-processing.
String to include the specific preferences in the memory.
1String to exclude the specific preferences in the memory.
1Whether to infer the memories or directly store the messages.
Controls the response format structure. v1.0 (deprecated) returns a direct array of memory objects: [{...}, {...}]. v1.1 (recommended) returns an object with a 'results' key containing the array: {"results": [...]}. The v1.0 format will be removed in future versions.
A list of categories with category name and its description.
Defines project-specific guidelines for handling and organizing memories. When set at the project level, they apply to all new memories in that project.
Whether the memory is immutable.
Whether to add the memory completely asynchronously.
The timestamp of the memory. Format: Unix timestamp
The date and time when the memory will expire. Format: YYYY-MM-DD
The unique identifier of the organization associated with this memory.
The unique identifier of the project associated with this memory.
The version of the memory to use. The default version is v1, which is deprecated. We recommend using v2 for new applications.