MemDB REST API for storing, searching, and managing agent memories. All endpoints require Bearer token authentication.
All requests (except GET /health) require a Bearer token in the Authorization header.
curl https://api.memdb.ai/health
curl https://api.memdb.ai/product/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id":"agent-1","query":"preferences"}'
No authentication required. Returns service status, Go version, and hostname.
{"code":200,"status":"healthy","go_version":"go1.26","hostname":"memdb-go","service":"memdb-go"}
Store new memories from conversations or raw text. MemDB extracts entities, classifies memory types, deduplicates, and persists asynchronously by default.
| Field | Type | Description |
|---|---|---|
| user_id | string | User/agent identifier |
| messages* | array | Messages: [{"role":"user","content":"..."}] |
| custom_tags | string[] | Tags for filtering: ["preference","style"] |
| async_mode | string | "async" (default) or "sync" |
| mode | string | "raw" (store as-is) or "fast" (LLM extraction). Sync only. |
| session_id | string | Group memories by session |
| info | object | Metadata: {"agent_id":"...", "source_type":"web"} |
curl -X POST https://api.memdb.ai/product/add \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id":"agent-123","messages":[{"role":"user","content":"I prefer bullet points"}],"custom_tags":["preference"]}'
Hybrid search: HNSW vector + tsvector fulltext, merged via RRF, with temporal decay and optional LLM reranking. 1.7ms cached, ~350ms uncached.
| Field | Type | Description |
|---|---|---|
| user_id* | string | User/agent identifier |
| query* | string | Natural language search query |
| top_k | int | Number of memories to return (default: 10) |
| mode | string | "fast" (default), "fine" (LLM filter + recall hint) |
| dedup | string | "no", "sim", or "mmr" |
| include_preference | bool | Include preference memories (default: true) |
| include_skill_memory | bool | Include skill memories (default: true) |
| internet_search | bool | Search web via SearXNG (default: false) |
| filter | object | Structured filter: {"and":[{"created_at":{"gt":"2024-01-01"}}]} |
| relativity | float | Minimum relevance threshold (0 = disabled) |
curl -X POST https://api.memdb.ai/product/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id":"agent-123","query":"How does this user prefer responses?","top_k":5}'
Delete specific memories by ID, or all memories for a user. Instant — no reindex needed.
| Field | Type | Description |
|---|---|---|
| user_id* | string | User/agent identifier |
| memory_ids | string[] | IDs to delete: ["mem_abc","mem_def"] |
| delete_all | bool | Delete all memories for this user |
curl -X POST https://api.memdb.ai/product/delete_memory \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"user_id":"agent-123","memory_ids":["mem_abc123","mem_def456"]}'
Retrieve all memories for a user with pagination. 70× faster than the Python baseline.
| Field | Type | Description |
|---|---|---|
| user_id* | string | User/agent identifier |
| page | int | Page number (default: 1) |
| page_size | int | Results per page (default: 20) |
Retrieve memories matching specific criteria.
| Field | Type | Description |
|---|---|---|
| user_id* | string | User/agent identifier |
| filter | object | Structured filter |
Retrieve a single memory by its ID.
Memory-augmented chat completion. Searches relevant memories and injects them into LLM context.
| Field | Type | Description |
|---|---|---|
| user_id* | string | User/agent identifier |
| messages* | array | Chat messages: [{"role":"user","content":"..."}] |
| system_prompt | string | System prompt override |
| add_message_on_answer | bool | Store exchange after completion (default: false) |
Same as Chat Complete but returns SSE stream for real-time UIs.
Submit feedback on a memory to improve future search ranking.
| Field | Type | Description |
|---|---|---|
| user_id* | string | User/agent identifier |
| memory_id* | string | Memory to rate |
| feedback | string | "positive" or "negative" |