Build with it
REST API
Every operation over HTTP, from any language.
Everything the engine does is available over HTTP, so any language can use Memnest. Start a server with Docker or the CLI, create a key, and call it.
Authentication
curl -H "Authorization: Bearer $MEMNEST_KEY" localhost:8787/v1/memories?containerTag=user:123
Keys look like mnk_<id>_<secret> and are stored only as argon2id hashes. A key created with --container can reach that container and no other: the scope is resolved in middleware, and handlers never read a container tag from the request. /healthz is the only unauthenticated route.
Endpoints
| Method | Path | |
|---|---|---|
POST | /v1/documents | Add a document (202; extraction runs later) |
GET / DELETE | /v1/documents/:id | Document with chunks / tombstone it |
POST | /v1/search | { query, options?, include? } → { memories, chunks, trace } |
GET | /v1/profile/:containerTag | Cached profile; POST …/rebuild to build now |
GET / POST | /v1/memories | List (limit, after, kind, latestOnly, includeForgotten) / write directly |
GET | /v1/memories/:id | One memory |
GET | /v1/memories/:id/lineage | Its lineage graph |
POST | /v1/memories/:id/forget | Soft delete |
GET | /v1/graph/:containerTag | Graph snapshot for a visualisation |
DELETE | /v1/containers/:containerTag | Hard delete |
GET | /v1/runs | Extraction runs, newest first |
GET | /v1/events | Server-sent events: job status |
GET | /healthz | Liveness, unauthenticated |
Add and search
curl -X POST localhost:8787/v1/documents -H "Authorization: Bearer $MEMNEST_KEY" -H 'content-type: application/json' \
-d '{"containerTag":"user:123","customId":"chat-42","content":[{"role":"user","content":"We moved payments to MySQL."}]}'
curl -X POST localhost:8787/v1/search -H "Authorization: Bearer $MEMNEST_KEY" -H 'content-type: application/json' \
-d '{"containerTag":"user:123","query":"which database?","options":{"tokenBudget":200}}'From Python
import os, httpx BASE = "http://localhost:8787" HEADERS = {"Authorization": f"Bearer {os.environ['MEMNEST_KEY']}"} def recall(container: str, query: str, budget: int = 400) -> list[str]: r = httpx.post(f"{BASE}/v1/search", headers=HEADERS, json={ "containerTag": container, "query": query, "options": {"tokenBudget": budget}, "include": ["memories"], }) r.raise_for_status() return [m["memory"]["content"] for m in r.json()["memories"]] def remember(container: str, conversation_id: str, turns: list[dict]) -> None: httpx.post(f"{BASE}/v1/documents", headers=HEADERS, json={ "containerTag": container, "customId": conversation_id, "content": turns, }).raise_for_status()
That is the whole loop in any language: /v1/search before the model call, /v1/documents after it.
Watching jobs
curl -N localhost:8787/v1/events -H "Authorization: Bearer $MEMNEST_KEY"
Streams ready, job and ping events for the worker in that server's process, so a UI can show extraction finishing.
Notes
- There is no CORS. Call the API from your backend, not from a browser on another origin. The dashboard is served from the API's own origin.
- Cookie-authenticated writes (the dashboard's session) also need an
x-memnest-csrfheader. Bearer keys do not. - Not included yet: rate limiting, and per-key permissions finer than container scope. Put a proxy in front if you need them.