Store memories from a conversation, like mem0's add
add_memoryStore memories from a conversation, like mem0's add: an AI model extracts durable facts about the user from the messages (or, with infer=false, stores each message as is), embeds them and saves them privately under your memory_key (a secret string you generate; required). Identical facts are stored once. Needs at least one of user_id, agent_id, app_id, run_id. Memories are kept for 365 days. Returns {event_id, status, results:[{id, memory, event: ADD|NONE}]}. Price: $0.008 a call (3 free calls a day without an API key).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| infer | No | Default true: extract facts with the model. false: store each message verbatim (up to 10 messages of 300 characters) | |
| app_id | No | Entity: the app (1-128 characters) | |
| run_id | No | Entity: the session or run (1-128 characters) | |
| user_id | No | Entity: the user the memories are about (1-128 characters) | |
| agent_id | No | Entity: the agent the memories belong to (1-128 characters) | |
| excludes | No | Optional: what not to extract | |
| includes | No | Optional: what to focus on when extracting | |
| messages | Yes | Conversation turns, each {role: user|assistant|system, content: string}; up to 6000 bytes as JSON. A plain string is also accepted (one user message). | |
| metadata | No | Custom key/value metadata stored with every memory (up to 2000 bytes as JSON) | |
| memory_key | Yes | Your secret: a random string of 16-256 characters that you generate once and keep (also accepted as the X-Memory-Key header). Memories are stored and searched only under its hash, so nobody who lacks it can read them, whatever user_id they send. Lose it and the memories are unreachable. | |
| expiration_date | No | Optional YYYY-MM-DD: the memory is hidden from search and listing after that day (unless show_expired is true) | |
| custom_instructions | No | Optional extra extraction instructions (with includes and excludes, up to 800 bytes together) |