POST
/
v2
/
memories
/
search

Mem0 offers two versions of the search API: v1 and v2. Here’s how they differ:

Key difference between v1 and v2 search:

Filters: v2 allows you to apply filters to narrow down search results based on specific criteria. This includes support for complex logical operations (AND, OR) and comparison operators (IN, gte, lte, gt, lt, ne, icontains) for advanced filtering capabilities.

The v2 search API is more powerful and flexible, allowing for more precise memory retrieval.

Authorizations

Authorization
string
header
required

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

Body

application/json
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).

query
string
required

The query to search for in the memory.

fields
string[]

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

org_id
string | null

The unique identifier of the organization associated with the memory.

org_name
string | null

The name of the organization associated with the memory. Will be deprecated soon use org_id instead.

project_id
string | null

The unique identifier of the project associated with the memory.

project_name
string | null

The name of the project associated with the memory. Will be deprecated soon use project_id instead.

rerank
boolean
default:
false

Whether to rerank the memories.

Whether to enable smart search functionality.

threshold
number
default:
0.3

The minimum similarity threshold for returned results.

top_k
integer
default:
10

The number of top results to return.

Response

200 - application/json
created_at
string
required

The timestamp when the memory was created

hash
string
required

A hash of the memory content

id
string
required

Unique identifier for the memory

input
object[]
required

The conversation input that was used to generate this memory

memory
string
required

The content of the memory

updated_at
string
required

The timestamp when the memory was last updated

user_id
string
required

The identifier of the user associated with this memory

metadata
object | null

Additional metadata associated with the memory