POST
/
v2
/
memories
/
search

The v2 search API is powerful and flexible, allowing for more precise memory retrieval. It supports complex logical operations (AND, OR) and comparison operators for advanced filtering capabilities. The comparison operators include:

  • 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

Authorizations

Authorization
string
header
required

API key authentication. Prefix your Mem0 API key with 'Token '. Example: 'Token your_api_key'

Body

application/json
query
string
required

The query to search for in the memory.

filters
object
required

A dictionary of filters to apply to the search. Available fields are: user_id, agent_id, app_id, run_id, created_at, updated_at, categories, keywords. Supports logical operators (AND, OR) and comparison operators (in, gte, lte, gt, lt, ne, contains, icontains).

top_k
integer
default:
10

The number of top results to return.

fields
string[]

A list of field names to include in the response. If not provided, all fields will be returned.

rerank
boolean
default:
false

Whether to rerank the memories.

Whether to search for memories based on keywords.

filter_memories
boolean
default:
false

Whether to filter the memories.

threshold
number
default:
0.3

The minimum similarity threshold for returned results.

org_id
string | null

The unique identifier of the organization associated with the memory.

project_id
string | null

The unique identifier of the project associated with the memory.

Response

200 - application/json
id
string
required

Unique identifier for the memory

memory
string
required

The content of the memory

user_id
string
required

The identifier of the user associated with this memory

created_at
string
required

The timestamp when the memory was created

updated_at
string
required

The timestamp when the memory was last updated

metadata
object | null

Additional metadata associated with the memory

categories
string[]

Categories associated with the memory