Skip to main content
Mem0 is a dynamic memory store that gives you full control over your data. Along with storing memories, it gives you the ability to retrieve, export, and migrate your data whenever you need. This cookbook shows you how to retrieve and export your data for inspection, migration, or compliance.

Setup

Your API key needs export permissions to download memory data. Check your project settings on the dashboard if export operations fail with authentication errors.
Let’s add some sample memories to work with:

Getting All Memories

Use get_all() with filters to retrieve everything for a specific user:
Output:
Expected output: get_all() retrieved Dev’s complete memory record. This method returns everything matching your filters: no semantic search, no ranking, just raw retrieval. Perfect for exports and audits.
You can filter by metadata to get specific types:
Output:

Searching Memories

When you need semantic search instead of retrieving everything, use search():
Output:
Search works across all memory fields and ranks by relevance. Use it when you have a specific question; use get_all() when you need everything.

Exporting to Structured Format

For migrations or compliance, you can export memories into a structured schema using Pydantic-style JSON schemas.

Step 1: Define the schema

Step 2: Create export job

Output:
Export initiated: Status is “processing”. Large exports may take a few seconds. Poll with get_memory_export() until status changes to “completed” before downloading data.

Step 3: Download the export

Output:
You can also retrieve exports by filters:

Adding Export Instructions

Guide how Mem0 resolves conflicts or formats the export:
Always check export status before downloading. Call get_memory_export() in a loop with a short delay until status == "completed". Attempting to download while still processing returns incomplete data.

Platform Export

You can also export memories directly from the Mem0 platform UI:
  1. Navigate to Memory Exports in your project dashboard
  2. Click Create Export
  3. Select your filters and schema
  4. Download the completed export as JSON
This is useful for one-off exports or manual data reviews.
Exported data expires after 7 days. Download and store exports locally if you need long-term archives. After expiration, you’ll need to recreate the export job.

What You Built

A complete memory export system with multiple retrieval methods:
  • Bulk retrieval (get_all) - Fetch all memories matching filters for comprehensive audits
  • Semantic search - Query-based lookups with relevance scoring
  • Structured exports - Pydantic-schema exports for migrations and compliance
  • Export instructions - Guide conflict resolution and data formatting
  • Platform UI exports - One-off manual downloads via dashboard
This covers data portability, GDPR compliance, system migrations, and manual reviews.

Summary

Use get_all() for bulk retrieval, search() for specific questions, and create_memory_export() for structured data exports with custom schemas. Remember exports expire after 7 days: download them locally for long-term archives.

Build a Mem0 Companion

Learn core memory patterns including temporary vs permanent data handling.

Control Memory Ingestion

Ensure only verified insights make it into your export pipeline.
Using Mem0? Star us on GitHub to help more developers discover memory for AI apps.