Back to Mem0

Add Memories

docs/api-reference/memory/add-memories.mdx

2.0.12.7 KB
Original Source

Extract and store memories from a conversation using the V3 additive pipeline. The endpoint uses single-pass ADD-only extraction — one LLM call, no UPDATE/DELETE. Memories accumulate over time; nothing is overwritten.

Endpoint

  • Method: POST
  • URL: /v3/memories/add/
  • Content-Type: application/json

Processing is asynchronous. The response returns an event_id you can poll via GET /v1/event/{event_id}/.

Required headers

HeaderRequiredDescription
Authorization: Token <MEM0_API_KEY>YesAPI key scoped to your workspace.
Accept: application/jsonYesEnsures a JSON response.

Request body

Provide conversation messages for Mem0 to extract memories from. At least one entity ID (user_id, agent_id, app_id, or run_id) is required so the memory is scoped to a session. Entity IDs are accepted at the top level.

<CodeGroup> ```json Basic request { "user_id": "alice", "messages": [ { "role": "user", "content": "I moved to Austin last month." } ], "metadata": { "source": "onboarding_form" } } ``` </CodeGroup>

Common fields

FieldTypeRequiredDescription
messagesarrayYesConversation turns for Mem0 to extract memories from. Each object should include role and content.
user_idstringNo*Associates the memory with a user.
agent_idstringNo*Associates the memory with an agent.
run_idstringNo*Associates the memory with a run.
app_idstringNo*Associates the memory with an app.
metadataobjectOptionalCustom key/value metadata (e.g., {"topic": "preferences"}).
inferboolean (default true)OptionalSet to false to skip inference and store the provided text as-is.

* At least one entity ID (user_id, agent_id, app_id, or run_id) is required.

<Tip> Need more details? See [all request parameters](#body-messages) below for complete field descriptions, types, and constraints. </Tip>

Response

The request is queued for background processing. The response contains an event_id for tracking status.

<CodeGroup> ```json 200 response { "message": "Memory processing has been queued for background execution", "status": "PENDING", "event_id": "evt-uuid" } ```
json
{
  "error": "400 Bad Request",
  "details": {
    "message": "Invalid input data. Please refer to the memory creation documentation at https://docs.mem0.ai/platform/quickstart#4-1-create-memories for correct formatting and required fields."
  }
}
</CodeGroup> <Info> Poll the event status via `GET /v1/event/{event_id}/`. Status will be `SUCCEEDED` or `FAILED` once processing completes. </Info>