> ## Documentation Index
> Fetch the complete documentation index at: https://mem0-feature-memo-claude-plugin-v1.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Set up your Mem0 Platform account, install the SDK, and store your first memory in under five minutes.

In about five minutes you will get an API key, store your first memory, and search it back. Follow along in Python, JavaScript, cURL, or the terminal.

<Note>
  **Are you an AI agent?** See [Sign up as an agent](/platform/agent-signup): create a working API key in four commands, with no email or dashboard.
</Note>

## Prerequisites

* Mem0 Platform account (<a href="https://app.mem0.ai?utm_source=oss&utm_medium=platform-quickstart" rel="nofollow">Sign up here</a>)
* API key (<a href="https://app.mem0.ai/dashboard/settings?tab=api-keys&subtab=configuration" rel="nofollow">Get one from dashboard</a>)
* Python 3.10+, Node.js 18+, or cURL. The CLI needs either Node.js 18+ or Python 3.10+.

## Store your first memory

<Steps>
  <Step title="Install">
    Pick a tab and use the same one for every step below.

    <CodeGroup>
      ```bash Python theme={null}
      pip install mem0ai
      ```

      ```bash JavaScript theme={null}
      npm install mem0ai
      ```

      ```bash cURL theme={null}
      # Nothing to install. cURL ships with macOS and most Linux distributions.
      ```

      ```bash CLI theme={null}
      npm install -g @mem0/cli
      # or, if you prefer Python: pip install mem0-cli
      ```
    </CodeGroup>
  </Step>

  <Step title="Set your API key">
    <CodeGroup>
      ```python Python theme={null}
      from mem0 import MemoryClient

      client = MemoryClient(api_key="your-api-key")
      ```

      ```javascript JavaScript theme={null}
      import MemoryClient from 'mem0ai';
      const client = new MemoryClient({ apiKey: 'your-api-key' });
      ```

      ```bash cURL theme={null}
      export MEM0_API_KEY="your-api-key"
      ```

      ```bash CLI theme={null}
      mem0 init --api-key "your-api-key"
      ```
    </CodeGroup>
  </Step>

  <Step title="Add a memory">
    <CodeGroup>
      ```python Python theme={null}
      messages = [
          {"role": "user", "content": "I'm a vegetarian and allergic to nuts."},
          {"role": "assistant", "content": "Got it! I'll remember your dietary preferences."}
      ]
      client.add(messages, user_id="user123")
      ```

      ```javascript JavaScript theme={null}
      const messages = [
          {"role": "user", "content": "I'm a vegetarian and allergic to nuts."},
          {"role": "assistant", "content": "Got it! I'll remember your dietary preferences."}
      ];
      await client.add(messages, { userId: "user123" });
      ```

      ```bash cURL theme={null}
      curl -X POST https://api.mem0.ai/v3/memories/add/ \
        -H "Authorization: Token $MEM0_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [
            {"role": "user", "content": "Im a vegetarian and allergic to nuts."},
            {"role": "assistant", "content": "Got it! Ill remember your dietary preferences."}
          ],
          "user_id": "user123"
        }'
      ```

      ```bash CLI theme={null}
      mem0 add "I'm a vegetarian and allergic to nuts." --user-id user123
      ```
    </CodeGroup>

    Mem0 pulls the individual facts out of the conversation and stores each one separately:

    ```json theme={null}
    {
      "results": [
        {"id": "0f2c1b6e-9a3d-4b18-8f77-1c2d3e4f5a6b", "memory": "Is a vegetarian", "event": "ADD"},
        {"id": "14e1b28a-2014-40ad-ac42-69c9ef42193d", "memory": "Allergic to nuts", "event": "ADD"}
      ]
    }
    ```
  </Step>

  <Step title="Search memories">
    <CodeGroup>
      ```python Python theme={null}
      results = client.search("What are my dietary restrictions?", filters={"user_id": "user123"})
      print(results)
      ```

      ```javascript JavaScript theme={null}
      const results = await client.search("What are my dietary restrictions?", { filters: { user_id: "user123" } });
      console.log(results);
      ```

      ```bash cURL theme={null}
      curl -X POST https://api.mem0.ai/v3/memories/search/ \
        -H "Authorization: Token $MEM0_API_KEY" \
        -H "Content-Type: application/json" \
        -d '{
          "query": "What are my dietary restrictions?",
          "filters": {"user_id": "user123"}
        }'
      ```

      ```bash CLI theme={null}
      mem0 search "What are my dietary restrictions?" --user-id user123
      ```
    </CodeGroup>

    Both facts come back, ranked by how well they match the question:

    ```json theme={null}
    {
      "results": [
        {
          "id": "14e1b28a-2014-40ad-ac42-69c9ef42193d",
          "memory": "Allergic to nuts",
          "user_id": "user123",
          "agent_id": null,
          "app_id": null,
          "run_id": null,
          "categories": ["health"],
          "metadata": {},
          "created_at": "2025-10-22T04:40:22.864647-07:00",
          "updated_at": "2025-10-22T04:40:22.864647-07:00",
          "expiration_date": null,
          "score": 0.87
        },
        {
          "id": "0f2c1b6e-9a3d-4b18-8f77-1c2d3e4f5a6b",
          "memory": "Is a vegetarian",
          "user_id": "user123",
          "agent_id": null,
          "app_id": null,
          "run_id": null,
          "categories": ["food_preferences"],
          "metadata": {},
          "created_at": "2025-10-22T04:40:22.864647-07:00",
          "updated_at": "2025-10-22T04:40:22.864647-07:00",
          "expiration_date": null,
          "score": 0.81
        }
      ]
    }
    ```

    Pass these memories to your model as context, and it answers with what it already knows about the user instead of asking again.
  </Step>
</Steps>

<Tip>
  Rather than calling `add` and `search` yourself, you can hand Mem0 to your agent as a set of tools and let it decide when to save and look things up. See [Mem0 MCP](/platform/mem0-mcp).
</Tip>

## What's next?

You stored and searched your first memory. Start with scoping, since every call you make from here needs it:

<CardGroup cols={2}>
  <Card title="Scope memories to users and agents" icon="users" href="/platform/features/entity-scoped-memory">
    What `user_id` actually does, plus the `agent_id`, `app_id`, and `run_id` fields that came back empty above.
  </Card>

  <Card title="How Mem0 works" icon="diagram-project" href="/core-concepts/how-it-works">
    Why one sentence became two memories, and how Mem0 decides what to keep.
  </Card>

  <Card title="Update and delete memories" icon="database" href="/core-concepts/memory-operations/add">
    The operations beyond add and search, for when stored facts change or go stale.
  </Card>

  <Card title="Use Mem0 with your agent framework" icon="plug" href="/integrations">
    Wire memory into LangChain, CrewAI, LangGraph, or the OpenAI Agents SDK.
  </Card>
</CardGroup>

<Note>
  Something not working? The [FAQs and troubleshooting](/platform/faqs) page covers the common setup errors.
</Note>
