Mem0 icon

Mem0

Interact with the Mem0 API - intelligent memory layer for AI

Memory → Advanced Search

AI-generated

Summary

Advanced Search (searchV2) performs an intelligent semantic search against Mem0 memories using the v2 API. It accepts a natural language query and returns memories with similar meaning, supporting granular filtering, result configuration, and context scoping.

Inputs

  • authType (required) — Choose between Mem0 cloud service at api.mem0.ai or your own self-hosted instance.
  • query (required) — Text for semantic search. Mem0 finds memories with similar meaning, not just exact matches.
  • userId — Unique user identifier to filter and organize memories by user.
  • agentId — Identifier of the AI agent/assistant interacting. Useful for separating memories by different agents.
  • appId — Application or system context identifier. Use to segment memories by different apps.
  • runId — Identifier of the current session/run. Groups memories from the same conversation or interaction.
  • options — Configure search result behavior: topK (max results, default 10), rerank (enable intelligent reranking), fields (comma-separated list of specific fields to include, e.g., id,memory,metadata,created_at).
  • filters — Rule-based filters combined with AND logic. Each rule specifies a field name, comparison operation (equals, notEquals, contains, greaterThan, lessThan), and value. Only available for searchV2.

Output shape

Array of memory objects. Each item typically includes id, memory (content), metadata, and created_at timestamps. Optional field selection via the fields parameter filters the response shape to only include requested fields.

Returned data is the raw Mem0 search result array. If no memories match, an empty array is returned.

Examples

Example 1: Search user memories for preferences

authType: cloud; query: 'What are the user interface preferences?'; userId: 'user_123'; options.topK: 5; options.rerank: true; filters.rules[0].field: 'metadata.preferences'; filters.rules[0].operation: 'contains'; filters.rules[0].value: 'dark mode'

Links

Discussion