Mem0 icon

Mem0

Interact with the Mem0 API - intelligent memory layer for AI

Memory → Semantic Search

AI-generated

Summary

Search memories semantically using a query, optionally filtered and paged.

Inputs

  • query (required) — Text for semantic search in memories. Mem0 will find memories with similar meaning, not just exact matches.
  • options — Search options such as number of results, reranking, fields to return, and metadata filters.
  • userId — Unique user identifier to associate with the memory. Used to filter and organize memories by user.
  • agentId — Identifier of the AI agent/assistant that is 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.
  • authType — Choose between Mem0 cloud or your own instance.

Output shape

array of memory objects returned by the search

Fields returned can be limited via options.fields; empty array if no matches.

Examples

Example 1: Basic semantic search for a user query

query='What are the user interface preferences?' options.topK=5

Example 2: Advanced search with metadata filter and reranking

query='customer feedback' metadata.entries.key=category metadata.entries.value=support rerank=true

Example 3: Search across multiple users using userId filter

query='NLP techniques' userId='user_123' options.topK=3

Links

Discussion