Skip to main content
POST
/
v3
/
memories
/
search
cURL
curl -X POST https://api.mem0.ai/v3/memories/search/ \
  -H "Authorization: Token <api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "where does the user live?",
    "filters": {"user_id": "alice"},
    "top_k": 10
  }'
{
  "results": [
    {
      "id": "mem-uuid",
      "memory": "User moved to San Francisco from New York in January 2026",
      "score": 0.82,
      "metadata": {},
      "categories": [
        "location"
      ],
      "created_at": "2026-01-15T10:30:00Z",
      "updated_at": "2026-01-15T10:30:00Z"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs.mem0.ai/llms.txt

Use this file to discover all available pages before exploring further.

Relevance-ranked hybrid search across stored memories. V3 uses multi-signal retrieval — semantic, BM25 keyword, and entity matching scored in parallel and fused. The returned score is a combined [0, 1] value. Entity IDs (user_id, agent_id, app_id, run_id) must be passed inside the filters object — top-level entity IDs are rejected with 400. At least one entity ID is required. The filters object supports complex logical operations (AND, OR, NOT) and comparison operators:
  • in: Matches any of the values specified
  • gte: Greater than or equal to
  • lte: Less than or equal to
  • gt: Greater than
  • lt: Less than
  • ne: Not equal to
  • icontains: Case-insensitive containment check
  • *: Wildcard character that matches everything

Search parameter defaults

ParameterV1/V2V3
top_kSupported (default 10)Supported (1-1000, default 10)
thresholdNo defaultDefault 0.1 (pass 0.0 to disable)
rerankDefault trueDefault false (pass true to enable)
related_memories = client.search(
    query="What are Alice's hobbies?",
    filters={
        "OR": [
            {
              "user_id": "alice"
            },
            {
              "agent_id": {"in": ["travel-agent", "sports-agent"]}
            }
        ]
    },
)
# Using wildcard to match all run_ids for a specific user
all_memories = client.search(
    query="What are Alice's hobbies?",
    filters={
        "AND": [
            {
                "user_id": "alice"
            },
            {
                "run_id": "*"
            }
        ]
    },
)
# Example 1: Using 'contains' for partial matching
finance_memories = client.search(
    query="What are my financial goals?",
    filters={
        "AND": [
            { "user_id": "alice" },
            {
                "categories": {
                    "contains": "finance"
                }
            }
        ]
    },
)

# Example 2: Using 'in' for exact matching
personal_memories = client.search(
    query="What personal information do you have?",
    filters={
        "AND": [
            { "user_id": "alice" },
            {
                "categories": {
                    "in": ["personal_information"]
                }
            }
        ]
    },
)

Body

application/json
query
string
required

Natural-language search query.

Minimum string length: 1
filters
object
required

Entity and metadata filters. Must include at least one entity ID (user_id, agent_id, app_id, or run_id). Supports AND, OR, NOT, and comparison operators (in, gte, lte, gt, lt, contains, icontains, ne).

top_k
integer
default:10

Number of results to return.

Required range: 1 <= x <= 1000
threshold
number
default:0.1

Minimum semantic relevance score. Pass 0.0 to disable filtering.

Required range: 0 <= x <= 1
rerank
boolean
default:false

Apply the managed reranker for better ordering (adds latency).

reference_date

Optional query anchor time for relative temporal interpretation. Accepts Unix epoch, YYYY-MM-DD, or ISO datetime.

Response

Ranked search results.

results
object[]
required