# Mem0 (/integrations/mem0)





{/* MANUAL-CONTENT-START:intro */}

Use [Mem0](https://mem0.ai) to store persistent memories, search them by meaning, and retrieve memory records across workflow runs. Store conversation context or user preferences, then retrieve relevant memories for a later agent step.

{/* MANUAL-CONTENT-END */}

## Use the block [#usage-instructions]

Add, search, and retrieve memories.

## Actions [#actions]

### Add Memories [#add-memories]

Add memories to Mem0 for persistent storage and retrieval

#### Input [#input]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `userId` | string | Yes | User ID associated with the memory (e.g., "user\_123", "[alice@example.com](mailto:alice@example.com)") |
| `messages` | json | Yes | Array of message objects with role and content (e.g., \[\{"role": "user", "content": "Hello"}]) |
| `apiKey` | string | Yes | Your Mem0 API key |

#### Output [#output]

| Parameter | Type | Description |
| - | - | - |
| `message` | string | Status message for the queued memory processing job |
| `status` | string | Processing status returned by Mem0 |
| `event_id` | string | Event ID for polling memory processing status |

### Search Memories [#search-memories]

Search for memories in Mem0 using semantic search

#### Input [#input-1]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `userId` | string | Yes | User ID to search memories for (e.g., "user\_123", "[alice@example.com](mailto:alice@example.com)") |
| `query` | string | Yes | Search query to find relevant memories (e.g., "What are my favorite foods?") |
| `limit` | number | No | Maximum number of results to return (e.g., 10, 50, 100) |
| `apiKey` | string | Yes | Your Mem0 API key |

#### Output [#output-1]

| Parameter | Type | Description |
| - | - | - |
| `searchResults` | array | Array of search results with memory data and similarity scores |
| ↳ `id` | string | Unique identifier for the memory |
| ↳ `memory` | string | The content of the memory |
| ↳ `user_id` | string | User ID associated with this memory |
| ↳ `agent_id` | string | Agent ID associated with this memory |
| ↳ `app_id` | string | App ID associated with this memory |
| ↳ `run_id` | string | Run/session ID associated with this memory |
| ↳ `hash` | string | Hash of the memory content |
| ↳ `metadata` | json | Custom metadata associated with the memory |
| ↳ `categories` | json | Auto-assigned categories for the memory |
| ↳ `created_at` | string | ISO 8601 timestamp when the memory was created |
| ↳ `updated_at` | string | ISO 8601 timestamp when the memory was last updated |
| ↳ `score` | number | Similarity score from vector search |
| `ids` | array | Array of memory IDs found in the search results |

### Get Memories [#get-memories]

Retrieve memories from Mem0 by ID or filter criteria

<ReferenceDetails>
  #### Input [#input-2]

  | Parameter | Type | Required | Description |
  | - | - | - | - |
  | `userId` | string | Yes | User ID to retrieve memories for (e.g., "user\_123", "[alice@example.com](mailto:alice@example.com)") |
  | `memoryId` | string | No | Specific memory ID to retrieve (e.g., "mem\_abc123") |
  | `startDate` | string | No | Start date for filtering by created\_at (e.g., "2024-01-15") |
  | `endDate` | string | No | End date for filtering by created\_at (e.g., "2024-12-31") |
  | `limit` | number | No | Maximum number of results to return (e.g., 10, 50, 100) |
  | `page` | number | No | Page number to retrieve for paginated list results |
  | `apiKey` | string | Yes | Your Mem0 API key |

  #### Output [#output-2]

  | Parameter | Type | Description |
  | - | - | - |
  | `memories` | array | Array of retrieved memory objects |
  | ↳ `id` | string | Unique identifier for the memory |
  | ↳ `memory` | string | The content of the memory |
  | ↳ `user_id` | string | User ID associated with this memory |
  | ↳ `agent_id` | string | Agent ID associated with this memory |
  | ↳ `app_id` | string | App ID associated with this memory |
  | ↳ `run_id` | string | Run/session ID associated with this memory |
  | ↳ `hash` | string | Hash of the memory content |
  | ↳ `metadata` | json | Custom metadata associated with the memory |
  | ↳ `categories` | json | Auto-assigned categories for the memory |
  | ↳ `created_at` | string | ISO 8601 timestamp when the memory was created |
  | ↳ `updated_at` | string | ISO 8601 timestamp when the memory was last updated |
  | `ids` | array | Array of memory IDs that were retrieved |
  | `count` | number | Total number of memories matching the filters |
  | `next` | string | URL for the next page of results |
  | `previous` | string | URL for the previous page of results |
</ReferenceDetails>
