Search memories

Semantic search over memories (and relationship edges in raw mode). Optional scope narrows by memory scope tokens (PostgreSQL regex per entry, AND). Use rerank for nodes-only top-k after vector retrieval; use full_scope to list every memory matching scope (skips vector ranking; requires non-empty scope).

POST/api/v1/memories/search

Body Parameters

application/json
querystringrequired

Natural language search query (still required when full_scope is true — used for interpreted synthesis).

knumber

Top hits for vector search / rerank (1–100). Does not cap full_scope listings.

Max length: 5

scopestring[]

Optional scope filter: each entry is a regex; AND semantics vs scope tokens on the memory (and link endpoints for edges). Required non-empty when full_scope is true.

response_formatstring

raw | interpreted | both

Max length: raw

rerankboolean

When true: return only memory nodes — fold edge hits to endpoints, dedupe, sort by score, top k. Ignored when full_scope is true.

Max length: false

full_scopeboolean

When true: skip vector search; return all memories matching scope as nodes only. Ignores rerank. 400 if scope missing or empty.

Max length: false

API Key

Stored locally, never sent to servers

Search memories
const options = {  method: 'POST',  headers: {'X-API-Key': 'mb_live_xxx', 'Content-Type': 'application/json'},  body: JSON.stringify({"query": "What does the user prefer for their IDE?", "k": 5, "response_format": "interpreted", "scope": ["domain.ui"], "rerank": false, "full_scope": false})};fetch('https://api.mem-brain.io/api/v1/memories/search', options)  .then(res => res.json())  .then(res => console.log(res))  .catch(err => console.error(err));
{
"results": [
{
"id": "mem_xyz789",
"content": "User prefers dark mode and uses VSCode",
"score": 0.94,
"tags": [
"type.preference"
]
}
]
}