Reference and help
Worker API reference
MemIndex runs a small web service on your computer. Your agents, the viewer and the command line all talk to it. If you are building your own tool, you can call it too.
Find it and sign in
Run npx memindex doctor and read the Worker daemon row for the address. The port is not fixed, so never hard-code it. The service listens on 127.0.0.1 only, unless you change MEMINDEX_WORKER_HOST.
Reading or changing memory needs the install secret, a random value MemIndex creates once in the file worker-secret in your data folder. Send it in the X-Memindex-Secret header. Only your account can read the file. Keep the secret out of command lines, logs and screenshots: a header read from the file does all three.
printf 'X-Memindex-Secret: %s\n' "$(cat ~/.memindex/worker-secret)" | curl -H @- "http://127.0.0.1:<port>/api/stats"
A request without the secret is refused, and the answer says what to do:
{"error":"Unauthorized","message":"Reading memory from the worker needs the install secret. If a tool of yours sent this request, restart it or run npx memindex update: versions before this one did not send it."}
The status of the service itself needs no secret and shows no memory:
$ curl http://127.0.0.1:<port>/api/health
{"status":"ok","version":"1.6.0","dataDir":"~/.memindex","uptime":1,"pid":62124,"initialized":true,"mcpReady":true}
A few routes only answer a caller on the same computer, and changing requests must come from a trusted host and origin. A web page from another origin is refused unless you list it in MEMINDEX_ALLOWED_ORIGINS. See Local security model.
Save a note and read it back
printf 'X-Memindex-Secret: %s\n' "$(cat ~/.memindex/worker-secret)" | curl -H @- -X POST -H "Content-Type: application/json" \
-d '{"text":"Charge in the smallest currency unit.","title":"Charge in cents","project":"shop"}' \
http://127.0.0.1:<port>/api/memory/save
{"success":true,"id":1,"title":"Charge in cents","project":"shop","message":"Memory saved as observation #1"}
text is required, and unknown fields are refused. Fetch notes by ID with POST /api/observations/batch and a body such as {"ids":[1]}. Search with GET /api/search?query=proxy&limit=2&format=json, which returns the matching observations, sessions and prompts. Check totals:
$ printf 'X-Memindex-Secret: %s\n' "$(cat ~/.memindex/worker-secret)" | curl -H @- http://127.0.0.1:<port>/api/stats
{"worker":{"version":"1.6.0","uptime":1,"activeSessions":0,"sseClients":0,"port":47139},"database":{"size":536576,"observations":6,"sessions":2,"summaries":0}}
Routes
Every route except the health and readiness checks needs the install secret. The method in each name says whether it reads (GET), writes (POST) or deletes (DELETE). The service also has routes that restart or stop it, and they only answer the same computer, so they are left out.
Health and status
| Route | What it does |
|---|---|
GET /health |
Returns a minimal liveness answer. |
GET /api/health |
Returns the worker health report. Anyone gets the short form; a caller with the install secret gets the full form. |
GET /api/readiness |
Reports whether the worker finished initialization. |
GET /api/ready |
Streams the startup phases as server-sent events. |
GET /api/version |
Returns the worker version. |
GET /api/stats |
Returns worker and database counts. |
GET /api/processing-status |
Reports whether the worker is processing queued messages. |
Sessions and capture
| Route | What it does |
|---|---|
POST /api/sessions/init |
Starts or continues a session and stores a prompt. |
POST /api/sessions/observations |
Queues one tool call for the observer model. |
POST /api/sessions/summarize |
Queues the end-of-turn summary request. |
POST /api/sessions/session-end |
Marks a session as ended. |
POST /api/spool/nudge |
Asks the worker to drain the hook spool now. |
Read and delete memory
| Route | What it does |
|---|---|
GET /api/observations |
Lists observations, newest first, with pagination. |
GET /api/summaries |
Lists session summaries with pagination. |
GET /api/prompts |
Lists stored prompts with pagination. |
GET /api/observation/:id |
Returns one observation. |
GET /api/observations/by-file |
Returns observations that touched given files. |
POST /api/observations/batch |
Returns many observations by identifier. |
GET /api/session/:id |
Returns one session summary by identifier. |
GET /api/tool-uses |
Lists recorded tool uses with filters. |
GET /api/prompt/:id |
Returns one prompt. |
DELETE /api/observation/:id |
Deletes one observation. |
DELETE /api/summary/:id |
Deletes one summary. |
DELETE /api/prompt/:id |
Deletes one prompt. |
GET /api/projects |
Lists projects and platform sources. |
GET /api/sessions |
Lists sessions with item counts. |
DELETE /api/sessions/:platformSource/:contentSessionId |
Deletes an ended session and all its data. |
Save, import and export
| Route | What it does |
|---|---|
POST /api/memory/save |
Stores one note as an observation. |
POST /api/memory/ingest |
Imports memory files from the Claude Code projects folder. |
POST /api/import |
Imports sessions, summaries, observations and prompts from JSON. |
GET /api/export |
Streams stored data as NDJSON. |
POST /api/memory/import-existing |
Imports data from a MemIndex export file or a SQLite memory database file. |
POST /api/work-state/entries |
Adds an entry to a work state list. |
GET /api/work-state |
Returns the open work state of a project. |
Search and context
| Route | What it does |
|---|---|
GET /api/search |
Searches observations, sessions and prompts. |
POST /api/mem-search |
Runs the guided three-step search: index, context, details. |
GET /api/timeline |
Returns observations around an anchor. |
GET /api/search/observations |
Searches observations only. |
GET /api/search/by-file |
Finds observations by file path. |
GET /api/context/recent |
Returns the most recent sessions of a project. |
GET /api/context/preview |
Renders the session start context of a project. |
GET /api/context/inject |
Returns the context text that a hook injects at session start. |
POST /api/context/semantic |
Returns observations that match a prompt by meaning. |
GET /api/timeline/by-query |
Finds an anchor by search, then returns its timeline. |
Corpora
| Route | What it does |
|---|---|
POST /api/corpus |
Builds a corpus from filtered observations. |
GET /api/corpus |
Lists all corpora. |
GET /api/corpus/:name |
Returns the metadata of one corpus. |
DELETE /api/corpus/:name |
Deletes a corpus. |
POST /api/corpus/:name/rebuild |
Rebuilds a corpus from its stored filter. |
POST /api/corpus/:name/prime |
Loads a corpus into a new model session. |
POST /api/corpus/:name/reprime |
Discards the model session of a corpus and primes a new one. |
POST /api/corpus/:name/query |
Asks a question about a primed corpus. |
Pins and branches
| Route | What it does |
|---|---|
POST /api/pins |
Pins a note on a branch, or for the whole project. |
DELETE /api/pins/:observationId |
Removes the pins on a note. |
GET /api/pins |
Lists the pins that apply on a branch. |
POST /api/pins/unpromote |
Puts pins that were promoted to the whole project back on their original branch. |
POST /api/branches/backfill |
Tags notes that predate branch tracking. |
Settings
| Route | What it does |
|---|---|
GET /api/settings |
Returns all settings with secrets masked. |
POST /api/settings |
Updates settings in settings.json. |
GET /api/settings/dependency-health |
Reports missing or failing dependencies. |