API referenceOverview

API reference

Every Mnemosyne server serves its own OpenAPI 3.1 document:

GET http://your-instance:3939/openapi.json

Routes 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_xxx

An 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

ResourcePathWhat it does
RememberPOST /rememberWrites a memory. The optional kind field selects the primitive.
RecallPOST /recallHybrid 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/decisionsList, create, read and patch decisions.
Episodes/episodesList, create and read episodes; /episodes/{id}/timeline.
Entities/entitiesList, create, read and patch entities; /entities/{id}/facts.
Relations/relationsBinary edges with one of 9 locked verbs; /relations/traverse.
Hyperedges/hyperedgesRelations with more than two members.
GraphGET /graphTyped nodes and relations; /graph/traverse, /graph/path, /graph/stats.
TimelineGET /timelineRecent fact-lifecycle events.
Sessions/session/*Start a session, append turns, collapse or discard it.
Tasks and events/tasks, /eventsTask state machine and the immutable event log.
Procedural/reasoning, /strategies, /workflows, /skillsReasoning chains and reusable know-how.
CitationsGET /facts/{id}/citations, GET /citationsThe sources behind a memory.
Review/review, /conflictsThe review queue and conflicting pairs.
Reminders/remindersProspective memory.
Webhooks/webhooksSigned outbound notifications.
Export and importGET /export/jsonl, POST /importThe workspace as gzip JSONL, and back.
AuditGET /auditThe operation log.
Keys/admin/keys, /admin/scoped-keysCreate, list, rotate and revoke API keys, and the scoped-scheme keys.
Agent policies/admin/agent-policies, /admin/agent-policyList, read, write and delete each agent’s RBAC policy.
ErasurePOST /admin/erasureGDPR crypto-erasure: destroys the encryption keys of a user or an actor.
HealthGET /healthCognitive vitals of the workspace.

The full list, grouped by area, is in Routes by area.

Request headers

HeaderEffect
Idempotency-KeyOn POST, PATCH, PUT and DELETE, replays the stored response for a repeated request.
Mnemosyne-VersionPins a date-based API version. The current one is 2026-06-16; every response echoes it.
X-Request-IdSets 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).