Add memories
Python
# 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") messages = [ {"role": "user", "content": "<user-message>"}, {"role": "assistant", "content": "<assistant-response>"} ] client.add(messages, user_id="<user-id>", version="v2")
[ { "id": "<string>", "data": { "memory": "<string>" }, "event": "ADD" } ]
API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'
Successful memory creation
The response is of type object[].
object[]
Was this page helpful?