API reference
Every Mnemosyne server serves its own OpenAPI 3.1 document:
GET http://your-instance:3939/openapi.jsonRoutes are mounted at the root: there is no /v1 prefix. The server also
serves a Scalar reference UI at /docs. Both are
registered on the authenticated router, so they need the Authorization
header like any other route.
The code registers 202 OpenAPI routes. This page summarises them.
Authentication
Every request carries one header:
Authorization: Bearer mns_live_xxxAn API key is bound to one workspace, and the workspace comes from the key.
User tokens (uk_...) can name a workspace they belong to with the
X-Workspace-Id header.
Create the first key with the script in the Docker stack, from the repo’s
docker/ folder:
docker compose exec server node scripts/create-api-key.cjs --label "my laptop"After that you can create keys from the dashboard, with the CLI
(mnemo keys create --label "CI agent" --scopes memory:read,memory:write),
or with POST /admin/keys. With "federation": true, POST /admin/keys
issues an mk_fed_ key for a federation peer: its scopes must be exactly
["memory:federation"], and it is a workspace key, never a test key (see
Running federation).
Workspaces are isolated in Postgres with forced row-level security.
The local Docker stack connects to Postgres as the database owner, which bypasses row-level security. Workspaces are not isolated from each other there. The production overlay provisions a restricted role and turns the isolation on.
Resource families
| Resource | Path | What it does |
|---|---|---|
| Remember | POST /remember | Writes a memory. The optional kind field selects the primitive. |
| Recall | POST /recall | Hybrid retrieval, also at a past instant with asOf. Variants: /recall/hot, /recall/unified, /recall/explain. |
| Facts | /facts, /facts/{id} | List, read, patch, pin, forget and restore. Facts are created through /remember. |
| Decisions | /decisions | List, create, read and patch decisions. |
| Episodes | /episodes | List, create and read episodes; /episodes/{id}/timeline. |
| Entities | /entities | List, create, read and patch entities; /entities/{id}/facts. |
| Relations | /relations | Binary edges with one of 9 locked verbs; /relations/traverse. |
| Hyperedges | /hyperedges | Relations with more than two members. |
| Graph | GET /graph | Typed nodes and relations; /graph/traverse, /graph/path, /graph/stats. |
| Timeline | GET /timeline | Recent fact-lifecycle events. |
| Sessions | /session/* | Start a session, append turns, collapse or discard it. |
| Tasks and events | /tasks, /events | Task state machine and the immutable event log. |
| Procedural | /reasoning, /strategies, /workflows, /skills | Reasoning chains and reusable know-how. |
| Citations | GET /facts/{id}/citations, GET /citations | The sources behind a memory. |
| Review | /review, /conflicts | The review queue and conflicting pairs. |
| Reminders | /reminders | Prospective memory. |
| Webhooks | /webhooks | Signed outbound notifications. |
| Export and import | GET /export/jsonl, POST /import | The workspace as gzip JSONL, and back. |
| Audit | GET /audit | The operation log. |
| Keys | /admin/keys, /admin/scoped-keys | Create, list, rotate and revoke API keys, and the scoped-scheme keys. |
| Agent policies | /admin/agent-policies, /admin/agent-policy | List, read, write and delete each agent’s RBAC policy. |
| Erasure | POST /admin/erasure | GDPR crypto-erasure: destroys the encryption keys of a user or an actor. |
| Health | GET /health | Cognitive vitals of the workspace. |
The full list, grouped by area, is in Routes by area.
Request headers
| Header | Effect |
|---|---|
Idempotency-Key | On POST, PATCH, PUT and DELETE, replays the stored response for a repeated request. |
Mnemosyne-Version | Pins a date-based API version. The current one is 2026-06-16; every response echoes it. |
X-Request-Id | Sets the request id. The server generates one when it is absent and returns it in the response and in error bodies. |
Idempotency
A replayed response carries Idempotent-Replayed: true. Reusing a key while
the first request is still running returns 409 conflict. Reusing a key with
a different method, path or body returns 422 unprocessable_entity. The Redis
and Postgres stores keep a key for 72 hours.
Errors
Every error has a code and a human-readable message. The list is in
Error codes.
Status
Alpha, on the 3.6.x line. The API can still change within 3.x. There is no
CI today: releases pass a local gate (FULL=1 bash scripts/full-sweep.sh).