POST
/
v1
/
memories
/
search
# To use the Python SDK, install the package:
# pip install mem0ai

from mem0 import MemoryClient
client = MemoryClient(api_key="your_api_key", org_id="your_org_id", project_id="your_project_id")

query = "Your search query here"

results = client.search(query, user_id="<user_id>", output_format="v1.0")
print(results)
[
  {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "memory": "<string>",
    "user_id": "<string>",
    "metadata": {},
    "categories": [
      "<string>"
    ],
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
]

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.

Minimum length: 1
agent_id
string | null

The agent ID associated with the memory.

user_id
string | null

The user ID associated with the memory.

app_id
string | null

The app ID associated with the memory.

run_id
string | null

The run ID associated with the memory.

metadata
object | null

Additional metadata associated with the memory.

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.

output_format
string | null

The search method supports two output formats: v1.0 (default) and v1.1.

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.

filter_memories
boolean
default:
false

Whether to properly filter the memories according to the input.

categories
string[]

A list of categories to filter the memories by.

Whether to only search for memories based on metadata.

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