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).
/api/v1/memories/searchBody Parameters
application/jsonquerystringrequiredNatural language search query (still required when full_scope is true — used for interpreted synthesis).
knumberTop 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_formatstringraw | interpreted | both
Max length: raw
rerankbooleanWhen 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_scopebooleanWhen 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
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" ] } ]}