---
title: "Migrate from Open Source to Platform"
description: "Migrate your Mem0 Open Source implementation to Mem0 Platform for managed infrastructure and advanced features."
icon: "cloud-arrow-up"
versionFrom: "Open Source"
versionTo: "Platform"
---

## Overview

| Scope                 | Effort         | Downtime                     |
| --------------------- | -------------- | ---------------------------- |
| Infrastructure & Code | Low (~30 mins) | None (Parallel run possible) |

<Note>
  Using Mem0 Open Source with **hosted Qdrant**? You can migrate your existing memories to Mem0 Platform with a one-line script below.
</Note>

<Info>
  **Why migrate to Platform?**

  - **Time to Market**: Set up in 5 minutes vs 30+ minutes for OSS configuration
  - **Enterprise Ready**: Audit logs, workspace governance, and dedicated support
  - **Advanced Features**: Webhooks, memory export, analytics dashboard, custom categories
  - **Multi-tenancy**: Organizations, projects, and team management out of the box
  - **Zero Infrastructure**: No vector database, LLM provider, or maintenance overhead
  - **Enhanced Search**: Reranking, keyword expansion, and advanced filters
  - **Production Grade**: Auto-scaling, high availability, dedicated support
</Info>

### Plan

1. **Sign up**: Create an account on <a href="https://app.mem0.ai?utm_source=oss&utm_medium=migration-oss-to-platform" rel="nofollow">Mem0 Platform</a>.
2. **Get API Key**: Navigate to **Settings > API Keys** and generate a new key.
3. **Review Usage**: Identify where you instantiate `Memory` and where you call `search` or `get_all`.

## Migrate with Agent Skill

Paste this prompt into your coding agent. It uses a migration skill to produce a plan; once you review and approve it, the agent implements the changes.

```text
Migrate my project from Mem0 OSS to the Mem0 Platform SDK using the
mem0-oss-to-platform skill in the mem0ai/mem0 repo, at
skills/mem0-oss-to-platform/

Get the skill whichever way is easiest:
- install it: npx skills add https://github.com/mem0ai/mem0 --skill mem0-oss-to-platform
- if the mem0 repo is cloned locally, read it from skills/mem0-oss-to-platform/
- otherwise fetch that folder from github.com/mem0ai/mem0 (SKILL.md + references/)

Then read SKILL.md and begin the migration.
```

## Migrate

### 1. Import Memories Into Platform

If your Mem0 Open Source setup uses **hosted Qdrant** as the vector store, you can import your existing memories to Mem0 Platform with one command:

```bash
curl -fsSL https://raw.githubusercontent.com/mem0ai/mem0/main/scripts/oss-to-platform-migrate.sh | bash
```

<Note>
  This migration script currently supports **hosted Qdrant only**. Support for local Qdrant, pgvector, and other vector stores is coming soon.
</Note>

If you are using a different vector store and want to migrate to Platform, please contact Mem0 support and we’ll send you a custom migration script for your setup.

### 2. Install or Update SDK

Ensure you have the latest version of the SDK, which supports both OSS and Platform clients.

```bash
pip install mem0ai --upgrade
```

### 3. Update Initialization

Switch from the local `Memory` class to the managed `MemoryClient`.

```python Open Source (Old)
from mem0 import Memory

config = {
    "vector_store": {
        "provider": "qdrant",
        "config": {"host": "localhost", "port": 6333}
    },
    "llm": {
        "provider": "openai",
        "config": {"model": "gpt-4"}
    }
}

m = Memory.from_config(config)
```

```python Platform (New)
from mem0 import MemoryClient
import os

# Set MEM0_API_KEY in environment or pass explicitly
client = MemoryClient(api_key="m0-...")
```

<Info icon="check">
  Run `client.get_all(filters={"user_id": "test_connection"})` to verify your API key works. It should return an empty list or valid results.
</Info>

### 4. Update Retrieval Calls (Critical)

<Warning>
  **Critical Change**: Platform uses v2 endpoints that require filtering parameters to be nested inside a `filters` dictionary.
</Warning>

<Note>
  The `limit` parameter has been removed in favor of `top_k` across all SDKs. Update any code using `limit=` to use `top_k=` instead.
</Note>

| Method | Open Source | Platform |
| ------ | ----------- | -------- |
| `search()` | `m.search(query, user_id="alex")` | `client.search(query, filters={"user_id": "alex"})` |
| `get_all()` | `m.get_all(user_id="alex")` | `client.get_all(filters={"user_id": "alex"})` |
| `add()` | `m.add(memory, user_id="alex")` | `client.add(memory, user_id="alex")` |
| `delete()` | `m.delete(memory_id)` | `client.delete(memory_id)` |
| `delete_all()` | `m.delete_all(user_id="alex")` | `client.delete_all(user_id="alex")` |

Note: `add()` and `delete()` methods remain unchanged. The `update()` method is not available in Platform - use delete + add pattern instead.

<AccordionGroup>
  <Accordion title="Search Memories">
    <CodeGroup>
    ```python Open Source (Old)
    # Basic search with user filter
    results = m.search("user's preferences", user_id="alex")

    # Search with multiple filters
    results = m.search("meeting notes", user_id="alex", agent_id="assistant")
    ```

    ```python Platform (New)
    # Basic search with user filter in filters dict
    results = client.search("user's preferences", filters={"user_id": "alex"})

    # Search with multiple filters
    results = client.search("meeting notes", filters={
        "AND": [
            {"user_id": "alex"},
            {"agent_id": "assistant"}
        ]
    })
    ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Get All Memories">
    <CodeGroup>
    ```python Open Source (Old)
    # Get all memories for a user
    memories = m.get_all(user_id="alex", top_k=10)

    # Get memories with pagination
    memories = m.get_all(user_id="alex", top_k=5, offset=10)
    ```

    ```python Platform (New)
    # Get all memories for a user
    memories = client.get_all(filters={"user_id": "alex"}, top_k=10)

    # Get memories with pagination
    memories = client.get_all(filters={"user_id": "alex"}, top_k=5, offset=10)
    ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Add Memories">
    <CodeGroup>
    ```python Open Source (Old)
    # Add a simple memory
    m.add("Loves coffee", user_id="alex")

    # Add memory with metadata
    m.add("Completed marathon", user_id="alex", metadata={"category": "achievement"})
    ```

    ```python Platform (New)
    # Add a simple memory (no change)
    client.add("Loves coffee", user_id="alex")

    # Add memory with metadata (no change)
    client.add("Completed marathon", user_id="alex", metadata={"category": "achievement"})
    ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Delete Memories">
    <CodeGroup>
    ```python Open Source (Old)
    # Delete specific memory
    m.delete(memory_id="mem_123")

    # Delete all memories for user
    m.delete_all(user_id="alex")
    ```

    ```python Platform (New)
    # Delete specific memory (no change)
    client.delete(memory_id="mem_123")

    # Delete all memories for user (no change)
    client.delete_all(user_id="alex")
    ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Update Memory">
    <CodeGroup>
    ```python Open Source (Old)
    # Update memory content
    m.update(memory_id="mem_123", new_memory="Updated content")
    ```

    ```python Platform (New)
    # Update memory (not available in Platform)
    # Use delete + add pattern instead
    client.delete(memory_id="mem_123")
    client.add("Updated content", user_id="alex")
    ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

## Platform-Exclusive Features

The Platform introduces powerful capabilities not available in OSS:

<AccordionGroup>
  <Accordion title="Organizations & Multi-tenancy">
    <Info>
      **Why it matters**: Manage multiple teams and projects with hierarchical access control.
    </Info>
    ```python
    # Create an organization
    org = client.organizations.create(name="Acme Corp")

    # Create projects within the organization
    project = client.projects.create(
        name="Customer Support Bot",
        org_id=org.id
    )

    # Add team members
    client.organizations.add_member(
        org_id=org.id,
        email="team@acme.com",
        role="admin"
    )
    ```
  </Accordion>

  <Accordion title="Webhooks for Real-time Events">
    <Info>
      **Why it matters**: Instantly react to memory changes in your application. Build features like notifications, audit logs, or sync with external systems.
    </Info>
    ```python
    # Create webhook for memory events
    webhook = client.webhooks.create(
        project_id="proj_123",
        name="Memory Events",
        url="https://your-app.com/webhooks/mem0",
        events=["memory_add", "memory_delete"]
    )

    # Webhook payload example:
    # {
    #   "event": "memory_add",
    #   "memory_id": "mem_456",
    #   "user_id": "user_789",
    #   "memory": "User prefers dark mode",
    #   "timestamp": "2024-01-15T10:30:00Z"
    # }
    ```
  </Accordion>

  <Accordion title="Memory Export">
    <Info>
      **Why it matters**: Export your data for compliance, analytics, or migration with custom schemas and filters.
    </Info>
    ```python
    # Export memories with custom schema
    export_job = client.memories.export(
        filters={
            "AND": [
                {"user_id": "user_123"},
                {"created_at": {"gte": "2024-01-01"}}
            ]
        },
        output_format="json",
        schema={
            "memory": str,
            "categories": list[str],
            "timestamp": str
        }
    )

    # Download when ready
    if client.memories.get_export(export_job.id).status == "completed":
        data = client.memories.download_export(export_job.id)
    ```
  </Accordion>

  <Accordion title="Enhanced Search">
    <Info>
      **Why it matters**: Get better search results with AI-powered reranking and keyword expansion.
    </Info>
    ```python
    # Search with reranking for better results
    results = client.search(
        "user preferences",
        filters={"user_id": "alex"},
        rerank=True,  # Platform exclusive
        top_k=5
    )

    # Search with keyword expansion
    results = client.search(
        "coffee order",
        filters={"user_id": "alex"},
        keywords=["latte", "espresso", "cappuccino"],
        expand_keywords=True
    )
    ```
  </Accordion>

  <Accordion title="Custom Categories">
    <Info>
      **Why it matters**: Use domain-specific categories instead of generic ones for better organization.
    </Info>
    ```python
    # Set custom categories for your project
    client.projects.update_categories(
        project_id="proj_123",
        categories=[
            "Customer Preferences",
            "Product Feedback",
            "Support Issues",
            "Feature Requests"
        ]
    )

    # Memories will use these categories
    client.add(
        "User wants dark mode in dashboard",
        user_id="alex",
        categories=["Customer Preferences"]
    )
    ```
  </Accordion>

  <Accordion title="Events API for Analytics">
    <Info>
      **Why it matters**: Track all memory operations for audit trails, usage analytics, and debugging.
    </Info>
    ```python
    # Get audit trail of all memory operations
    events = client.events.list(
        filters={
            "AND": [
                {"user_id": "alex"},
                {"event_type": "memory_add"},
                {"timestamp": {"gte": "2024-01-01"}}
            ]
        },
        top_k=100
    )

    # Monitor usage patterns
    for event in events:
        print(f"{event.timestamp}: {event.event_type} - {event.memory_id}")
    ```
  </Accordion>
</AccordionGroup>

## Summary of Changes

| Feature | Open Source | Platform | Action Required |
| ------- | ----------- | -------- | --------------- |
| **Initialization** | `Memory.from_config(config)` | `MemoryClient(api_key)` | Replace config object with API key |
| **Search Method** | `m.search(query, user_id="x")` | `client.search(query, filters={"user_id": "x"})` | Move filtering params into `filters` dict |
| **Get All Method** | `m.get_all(user_id="x")` | `client.get_all(filters={"user_id": "x"})` | Move filtering params into `filters` dict |
| **Add Method** | `m.add(memory, user_id="x")` | `client.add(memory, user_id="x")` | No change |
| **Delete Method** | `m.delete(memory_id)` | `client.delete(memory_id)` | No change |
| **Delete All** | `m.delete_all(user_id="x")` | `client.delete_all(user_id="x")` | No change |
| **Update Method** | `m.update(memory_id, new_memory)` | Use delete + add pattern | Replace with delete then add |
| **Config** | Local vector store + LLM config | Managed cloud infrastructure | Remove local config setup |

## Rollback plan

If you encounter issues, you can revert immediately by switching your import back.

1.  **Revert Code**: Change `MemoryClient` back to `Memory`.
2.  **Restore Config**: Uncomment your local vector store and LLM configuration.
3.  **Verify**: Ensure your local vector database is still running and accessible.

## Next Steps

- <a href="https://app.mem0.ai?utm_source=oss&utm_medium=migration-oss-to-platform" rel="nofollow">Platform Dashboard</a> - Monitor usage and manage settings.
- [Webhooks Setup](/platform/features/webhooks) - Configure real-time event notifications.
- [Organizations & Projects](/api-reference/organizations-projects) - Set up multi-tenancy for your team.

<CardGroup cols={2}>
  <Card
    title="Platform Features"
    description="Explore capabilities exclusive to the Platform."
    icon="sparkles"
    href="/platform/overview"
  />
  <Card
    title="API Reference"
    description="Deep dive into the Platform API endpoints."
    icon="code"
    href="/api-reference/memory/add-memories"
  />
</CardGroup>
