DocsHTTP API
DocsReference
HTTP API
The Memora HTTP API: authentication and scopes, vault, search and graph, privacy, keys and tools, settings, OAuth, realtime events and status codes.
On this page
- Authentication
- API key scopes
- CSRF
- Locked instance
- Vault not configured
- Limits and other gates
- Health and discovery
- Auth
- Pages
- Static assets
- Vault
- Version history
- Images
- Search and graph
- Privacy
- API keys, tools, and access
- Settings
- OAuth
- Logs and activity
- Realtime
- Local stop
- ai_activity events
- UI layout
- Pins
- Mnemo (built-in agent)
- Status codes
The memora binary serves the HTTP API, the MCP endpoint, the OAuth endpoints, the web UI, and the WebSocket on one port. This document lists the HTTP endpoints.
Authentication#
The Auth column in the tables below uses these levels:
- None: reachable without credentials.
- Session: requires the
memora_sesscookie set by a successful login. - Key (
scope): an API key sent asAuthorization: Bearer <key>orX-API-Key: <key>that carries the named scope. - Session or key (
scope): either of the above. - Session only: an API key is not enough. API keys get
401(or403where noted). - +CSRF: the same-origin check described below applies.
API key scopes#
A key carries any of the scopes mcp, read, write, and admin. New keys get mcp, read, and write unless other scopes are requested. The scope a route needs is decided by its path and method:
| Scope | Routes |
|---|---|
mcp | /mcp |
admin | /api/tools, /api/keys and /api/keys/*, /api/access and /api/access/*, /api/logs/settings, /api/settings/server, /api/oauth/clients and /api/oauth/clients/*, /api/privacy and /api/privacy/*, /api/trash/delete, /api/trash/empty; deleting for good with /api/delete |
read | Every other GET or HEAD under /api/ |
write | Every other method under /api/ |
A key without the needed scope gets 403 {error, required_scope}. A missing key gets 401; for /mcp the 401 carries a WWW-Authenticate header, Bearer resource_metadata="<base>/.well-known/oauth-protected-resource", so OAuth capable clients can start sign-in. An invalid key gets 401 and is logged; an IP that keeps presenting invalid keys is put on a cooldown (429).
/api/auth/* never accepts an API key: without a valid session it answers 401.
API keys see the vault through their privacy rules (see Privacy): notes and folders hidden from a key behave as if they do not exist. A browser session sees everything.
CSRF#
Write endpoints that accept a session check the request origin whenever a session cookie is present: Origin (or, without it, Referer) must match the request Host (or an X-Forwarded-Host sent by a trusted proxy), and Sec-Fetch-Site: cross-site is refused. A failed check is 403 {"error":"origin mismatch"}. Requests without a session cookie (API-key clients) pass, since a browser cannot attach an API key on its own.
The public auth forms (/api/auth/login, /api/auth/verify, /api/auth/bootstrap, /api/auth/reset) also refuse a foreign or null Origin when no cookie exists yet. A request with neither Origin nor Referer (curl, the CLI) passes.
Locked instance#
While the instance is LOCKED, /api/* and /mcp answer 423 {error, locked: true, hint} except for /api/auth/state, /api/auth/verify, /api/auth/login, /api/auth/logout, /api/auth/bootstrap, and /api/auth/reset. Other pages redirect to /login?locked=1; static assets, /login, /logout, /healthz, and /favicon.ico are still served. /api/auth/login itself answers 423 while locked.
Vault not configured#
Until a vault folder is configured, /mcp and every /api/* route except /api/auth/*, /api/settings*, /api/config, /api/keys*, /api/tools, /api/access*, and /api/ui/* answer 409 {"error":"vault not configured", "needs_vault":true}.
Limits and other gates#
- Requests for a host outside the configured domain list get a bare
404. - Access rules (see
/api/access) can block a caller:403 {"error":"access denied by stack rule", ip}. - Per-IP rate limits answer
429with aRetry-Afterheader and{error, limited, cooldown, retry_after}. Login, code check, setup, reset, profile, password, and username changes have a stricter limit and a cooldown after repeated failed attempts. Requests from the machine itself and/healthzare not limited. - A request that takes longer than 30 seconds is answered with
408. - A password hashing pool that is busy answers
503withRetry-After: 2. GETanswers under/api/(except/api/auth/*) are gzip-compressed when the request sendsAccept-Encoding: gzip. Pages, writes, sign-in,/mcpand server-sent events are never compressed.
Responses are JSON unless stated otherwise. Errors are {"error": "..."}. Vault errors map to 404 for not-found (including paths hidden from the caller) and 400 for bad input.
Health and discovery#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /healthz | None | {ok, server} for unauthenticated callers from other machines. A signed-in browser or a caller on the same machine gets {ok, server, version, vault_configured, vault, armed, locked, base_url, base_url_configured}. |
| GET | /.well-known/mcp.json | None | The MCP discovery card: {name, version, description, mcp, auth, capabilities, tools, resources}. tools lists the full catalog with enabled per tool. |
| GET | /tools | None | An HTML rendering of the tool catalog. A signed-in browser gets the app shell instead. |
| POST | /mcp | Key (mcp), or Session (+CSRF) | MCP over streamable HTTP (JSON-RPC in, JSON-RPC out). See MCP.md. A session has full access; a key is limited by its tool grant. Notifications get 202 with no body. Malformed JSON is 400 with a JSON-RPC error. Other methods get 405 with Allow: POST. |
Auth#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/auth/state | None | {bootstrap, realm, min_password_len, gateway, armed, locked, setup_hint, ready, checks:{vault, state}, code_required, cooldown, vault_configured}. Adds signed_out (password_changed or signed_out_remotely) when the browser's session was ended on purpose, and mode, expires_in, ttl while a setup or reset window is open. |
| POST | /api/auth/verify | None (+CSRF) | Checks the setup code shown on the server before the setup or reset form is shown. Body: {code}. Returns {ok, mode, expires_in, user}. 403 when no window is open or the instance is not ready. A wrong code answers 403 {error, burned:false} and counts against the caller IP's budget of 3 wrong codes (then 429); after 50 wrong codes in one window the window closes and the code is void: 403 {error, burned:true}. |
| POST | /api/auth/login | None (+CSRF) | {ok, user, expires_in, redirect} and sets the session cookie. Body: {username, password}. 400 when a field is missing, 401 on bad credentials, 403 if the account is disabled, 423 if locked, 429 during a cooldown of the caller IP (there is no account-wide lockout; see DEPLOYMENT.md, Failed sign-ins). |
| POST | /api/auth/logout | None (+CSRF) | {ok:true}. Ends the session named by the cookie, if any, and clears the cookie. |
| POST | /api/auth/bootstrap | None (+CSRF) | Creates the owner account. Body: {code, username, password}. Returns {ok, user, redirect, persisted} and sets a session cookie. The username is stored lowercase. 400 for an invalid username or password length; 403 unless a window is open, the code is right, the instance is ready, and no account exists. |
| POST | /api/auth/reset | None (+CSRF) | Sets a new password for the single account, and may rename it. Body: {code, username, password}. Returns {ok, user, persisted}. Signs out every session. 400 for invalid input; 403 unless a window is open, the code is right, and an account exists. |
| POST | /api/auth/profile | Session only (+CSRF) | With password in the body, changes the password exactly like POST /api/settings/password (body {current, password, confirm}). Otherwise sets display_name (at most 48 characters) and returns {ok, changed, persisted, user, password_changed:false}; with no display_name it returns {ok, changed:false}. |
| GET | /api/auth/me | Session only | {authenticated, user, enabled, expires_in}. 401 without a session. |
| GET | /api/auth/events | Session only | Recent entries of the security activity log, newest first: {events:[{at, event, ip, user, detail, actor, actor_kind, actor_id}], count}. user is the stored actor (key:<id> for API-key calls); actor is the display name (the key's current name, falling back to its id; the username for the browser), actor_kind is agent or user (null when there is no actor). Query: limit (default 200, max 2000), q. |
Pages#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /login | None | The sign-in page. A signed-in browser is redirected to / unless the instance is locked or the query has oauth (the OAuth consent card). |
| POST | /logout | None (+CSRF) | Ends the session, clears the cookie, and redirects to /login. With a session cookie the request must be same-origin (403 otherwise); other methods get 405. The web UI uses POST /api/auth/logout. |
| GET | /, /index.html | Session | The web app shell. Without a session: 302 to /login. 503 when the UI assets are not installed. |
| GET | App routes (see below) | Session | The same app shell as /. Without a session: 302 to /login?r=<path>, so sign-in returns to the page. |
App routes are the web app's client-side pages: /brain, /nodes, /graph, /canvas, /tags, /activity, /agents, /access, /settings, /overview, /welcome, /trash, /mnemo, the older names /home, /vault, /logs, /keys, and /node/ or /node/<percent-encoded vault path>. The path is never used to read a file; a path holding NUL or another control character (raw or percent-encoded) is 400. /tools is an app route for a signed-in browser and the public tool catalog otherwise.
HTML pages are sent with Cache-Control: no-cache, no-store, must-revalidate and a per-response CSP nonce.
Any other GET that asks for HTML (Accept: text/html), is outside /api/, /mcp, /oauth, and /.well-known, and has no file extension in its last segment gets the app shell (which shows its "page not found" view). Every other unmatched request is 404 {"error":"not found"}.
Static assets#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /assets/{name} | None | Static UI assets (whitelisted filenames only, else 404). |
| GET | /app.js, /app.css, /login.css | None | The UI bundle and styles. Revalidated on every load (Cache-Control: no-cache, ETag). |
| GET | /favicon.svg | None | The icon. |
| GET | /favicon.ico | None | 204 with no body. |
| GET | /manifest.webmanifest, /sw.js, /robots.txt, /offline.html, /icon-192.png, /icon-512.png, /icon-maskable-512.png, /apple-touch-icon.png | None | PWA files and robots.txt. Images and the manifest are cached for 5 minutes; code is revalidated on every load. |
Vault#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/tree | Session or key (read) | Notes grouped by folder: {folder: [{path, name, folder, mtime, title, board?}]} (board: true marks a Kanban board); title is what the app shows (front matter title, else the first # heading, else the file name with _ as spaces). |
| GET | /api/folders | Session or key (read) | Every folder the caller may see, empty and nested ones included ({folders:[path]}); dot folders such as .Trash are left out. |
| GET | /api/note | Session or key (read) | {path, name, content, html, tags, frontmatter, backlinks, size, mtime}. Query: path (400 when empty). |
| GET | /api/vault/file | Session or key (read) | The raw bytes of one image file in the vault (PNG, JPEG, GIF, WebP, AVIF, BMP, ICO; never SVG). Query: path (vault-relative). The file content must match its type. At most 10 MiB (413). Sent with an ETag (304 on If-None-Match), Cache-Control: private, max-age=300, and a sandbox CSP. 400 invalid path, 403 path not allowed, 404 not found, 415 not an image. |
| GET | /api/folder-meta | Session or key (read) | Folder metadata keyed by folder name. Query: folder (optional). |
| POST | /api/save | Session or key (write, +CSRF) | {ok, path}. Body: {path, content}. Overwrites the note. |
| GET | /api/kanban | Session or key (read) | A board note (see KANBAN.md): {path, version, lanes, archive, counts, settings} as MCP kanban_get_board, each card also with html (its text rendered as the reader renders notes). Query: path. 400 when the note is not a board. |
| GET | /api/kanban/boards | Session or key (read) | Every board the caller may see, most recently changed first: {count, boards:[{path, title, lanes:[{title, cards}], cards, done, archived, version, mtime, style, due, date_colors, embedded_in, linked_from}]}; due holds the due date of every open card that has one (as MCP kanban_list_boards). Query: folder (optional; includes subfolders). |
| GET | /api/kanban/due | Session or key (read) | Open cards with a due date across the boards the caller may see, as MCP kanban_due: {today, days, counts, overdue, due_today, upcoming}. Query: today (YYYY-MM-DD; the web app sends the reader's own day), days (default 7), range (overdue, today, upcoming or all), folder. |
| POST | /api/kanban | Session or key (write, +CSRF) | One board edit. Body: {path, version?, op}, op one of {type:"add_card", lane, text, position?, checked?}, {type:"move_card", card, lane, position?}, {type:"update_card", card, text?, checked?}, {type:"archive_card", card}, {type:"restore_card", card, lane?}, {type:"delete_card", card}, {type:"add_lane", title, position?}, {type:"rename_lane", lane, title}, {type:"move_lane", lane, position}, {type:"delete_lane", lane} (lane is a position from 0 or a title; delete_lane only for a lane without cards or text). Returns the board after the edit with ok, changed and card; a change is saved like /api/save (history) and publishes node_updated. 409 {error, board} when version is not the board's current one (nothing written; board is the current board). |
| POST | /api/create | Session or key (write, +CSRF) | {ok, path}. Body: {title, folder?, content?}. |
| POST | /api/rename | Session or key (write, +CSRF) | {ok, path} with the new path. Body: {path, name}. |
| POST | /api/move | Session or key (write, +CSRF) | {ok, path} with the new path. Body: {path, folder?}. |
| POST | /api/delete | Session or key (write; admin to delete for good, +CSRF) | {ok:true}. Body: {path, mode?}. Deletes the note for good (no trash); with version history on, its earlier versions are erased from the history too, so nothing can bring it back. Because that cannot be undone, an API key needs the admin scope for it (403 {error, required_scope: "admin"} otherwise, as MCP delete_memory with permanent); the owner's browser session may. mode: "trash" (what the web app sends) moves it to .Trash instead, remembering where it was and who deleted it: {ok, trashed, to}. |
| GET | /api/trash | Session or key (read) | Notes in .Trash the caller may see, newest first: {items: [{name, path, original, deleted, by, title}]} (by = {id, name, kind}, null when unknown). Nothing is removed automatically. |
| POST | /api/trash/restore | Session or key (write, +CSRF) | Body: {name, into?}. Back to where the note was deleted from (or into the folder into); a taken name gets -1, -2 ...: {ok, path, from, renamed?}. 404 when the name is not in the trash. |
| POST | /api/trash/delete | Session or key (admin, +CSRF) | Body: {name}. Deletes one trash entry for good: {ok, deleted, name, history?}. With version history on, the note is also erased from the history (every earlier version under every name it had, its trash record and its path in commit messages), and history is {erased, ms, commits}. Other notes keep their versions; their revision ids change. |
| POST | /api/trash/empty | Session or key (admin, +CSRF) | Deletes every trash entry the caller may see, for good: {ok, count, names, history?}, erasing them from the version history in one rewrite (as /api/trash/delete). |
| POST | /api/folder | Session or key (write, +CSRF) | {ok, path}. Body: {name}. |
| POST | /api/folder/rename | Session or key (write, +CSRF) | {ok, from, to, notes}. Body: {folder, name}. |
| POST | /api/folder/move | Session or key (write, +CSRF) | Moves a folder and everything in it. {ok, from, to, notes}. Body: {folder, into}; into empty or Root means the top level. |
| POST | /api/folder/move-contents | Session or key (write, +CSRF) | Moves everything inside a folder into another one, then removes the emptied folder. Name clashes get a -N suffix. {ok, from, to, moved}. Body: {folder, into}; into empty or Root means the top level. |
| POST | /api/delete-folder | Session or key (write, +CSRF) | Deletes a folder. Body: {folder, into?, mode?}. By default its notes move to the folder's parent (the top level for a top-level folder), keeping the sub folder structure below it, and wikilinks are rewritten: {ok, deleted_folder, moved_to, moved, links_updated} (moved lists the new paths; moved_to_root repeats it when they went to the top level). into names another existing folder for the notes (Root = top level). mode: "trash" moves every note to .Trash instead (restorable from the Trash page, /api/trash/restore, or the MCP tools list_trash / restore_trash): {ok, deleted_folder, mode, count, trashed}. Other files in the folder are deleted. |
| POST | /api/folder-meta | Session or key (write, +CSRF) | {ok, folder}. Body: {folder, color?, icon?, desc?}. |
The three folder operations also publish a folder_changed realtime event so open browsers reload their tree.
Version history#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/history?path=&limit= | Session or key (read) | A note's revisions, newest first (the vault's git history, following renames): {path, total, versions: [{rev, date, author, message, version, total, path?, owner}]}. version counts from 1 (the oldest) to total (the current one); owner is true when the signed-in owner made the change. limit defaults to 100 (at most 500). |
| GET | /api/note-at?path=&rev= | Session or key (read) | The note as it was at one revision (a rev from /api/history, snap-<label>, HEAD~1, HEAD@{<date>}): {path, rev, content, html}, html rendered like /api/note. |
| GET | /api/diff?path=&a=&b= | Session or key (read) | Unified diff of the note from revision a to b, or to the note as it is now when b is left out: {path, from, to, changed, diff}. |
| POST | /api/history/restore | Session or key (write, +CSRF) | Body: {path, rev}. Gives the note its content from rev again as a new revision (restoring version 3 of 5 makes version 6; nothing is lost): {ok, path, rev, changed, version, total} (changed false when the note already had that content). |
The four history routes answer 409 {error, history: false} while version history is off (the vault folder is not a git repository; see CONFIGURATION.md) and 404 for a path that is not in the vault or its history, or is hidden from the calling key. Web writes (save, create, rename, move, delete, restore) are committed with the caller as the author: the owner's username for the browser, the key's name for an API key.
Images#
Images live in the folder of the note that shows them, and a note shows one with  (path: names a file in the note's own folder). Saving a note that points with path:Other/Folder/pic.png to an image elsewhere copies that image beside the note and rewrites the link, so notes never point across folders. Images follow their note: a move carries them, the Trash keeps them in .Trash/.assets/<entry>/ until the note is restored (to the same or another folder) or deleted for good, and a deleted folder takes its images along. An image that another note of the same folder still shows is copied or kept instead.
| Method | Path | Auth | Returns |
|---|---|---|---|
| POST | /api/vault/image?note=<path>&name=<file> | Session or key (write, +CSRF) | The raw image bytes as the body (PNG, JPEG, WebP or GIF, checked by content). Stored beside the note; identical bytes reuse the existing file, a taken name gets -1, -2 ...: {ok, path, name, bytes, url, markdown} (markdown is the line to put in the note). 400 for another file type, a size above the upload limit, or a missing note. |
| POST | /api/vault/image/delete | Session or key (write, +CSRF) | Body: {path}. Deletes one image file (the version history keeps it): {ok, deleted}. |
| GET | /api/vault/images?folder=<folder> | Session or key (read) | The images of that one folder (not its sub folders or parents): {folder, images: [{path, name, folder, bytes, mtime, url, used_in: [{note, title, heading}]}]}. heading is the section that shows the image (null before the first heading). |
| GET | /api/vault/images?note=<path> | Session or key (read) | {note, folder, images, folder_images}: the images the note shows, and every image of its folder. |
| GET | /api/vault/storage | Session or key (read) | {notes, note_bytes, images, image_bytes, total_bytes, max_image_bytes}. |
Search and graph#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/search | Session or key (read) | {q, count, hits:[{path, name, folder, score, snippet}]}, at most 20 hits. Query: q. Supports tag:x and #x. |
| GET | /api/stats | Session or key (read) | {notes, links, folders}. |
| GET | /api/graph | Session or key (read) | {nodes:[{id, path, folder, color, degree, tags}], links:[{source, target}]}. tags holds inline #tags plus frontmatter tags (as the note view reports them). Realtime node_* events' node payload carries tags too. |
| GET | /api/aliases | Session or key (read) | {aliases:[{alias, key_id, key_name, first_seen, last_seen, connections, actor, actor_kind}]}: one record per API key that sent MCP initialize, kept in memory until the server restarts. key_name and actor are the key's current name (fallback: the id). |
| GET | /api/actors | Session or key (read) | {actors:[{actor, alias, display, events, tools, last_ip, last_ts, seen_minutes_ago}], count}. seen_minutes_ago is -1 when the actor has no events. |
Privacy#
Privacy rules hide notes or folders from chosen agents (API keys). A rule has a kind (node or folder), a path, a mode (deny: hidden from the listed keys; allow_only: hidden from every key except the listed ones), and a list of keys. Folder rules apply to everything inside the folder.
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/privacy | Session or key (admin) | {count, rules:[{id, kind, path, mode, keys:[{id, name, color}], created_at, updated_at}], agents:[{id, name, color, enabled, builtin?}]}. The first agent is always Mnemo (id mnemo, builtin: true): rules may list mnemo to keep a note, folder or picture from Mnemo and its sub-agents. |
| GET | /api/privacy/path | Session or key (admin) | The privacy state of one path: {path, kind, own, own_rules, inherited, agents:[{id, name, color, enabled, can_see, hidden_by}], private}. own is {mode, keys} or null. Query: path, kind (optional; defaults to folder when the path is a folder on disk, else node). |
| PUT | /api/privacy/path | Session or key (admin, +CSRF) | Replaces the rule on a path. Body: {path, kind?, mode, keys}. mode defaults to deny; keys is a list of key ids (or unique key names). deny with no keys removes the rule. Returns the same shape as GET. |
| DELETE | /api/privacy/path | Session or key (admin, +CSRF) | Removes the rule on a path. Query: path, kind (optional). Returns the same shape as GET. |
Changes are written to the activity log and publish a privacy_changed realtime event.
API keys, tools, and access#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/keys | Session or key (admin) | {count, keys:[{id, name, enabled, scopes, tools, prefix, created, color, revealable, uses, last_ip, used_tools}]}. tools is "*" or a list of tool names; revealable says whether the secret can be shown again; used_tools lists recently used tools and routes. |
| POST | /api/keys | Session or key (admin, +CSRF) | Creates a key. Body: {name?, tools?, scopes?, color?}. tools is "*" or a list of tool names; scopes a list of scope names (an empty list means the defaults). Returns {ok, id, key, name, prefix, persisted, color, tools, scopes}. The raw key is returned once. 400 for an unknown tool or scope. |
| POST | /api/keys/roll | Session or key (admin, +CSRF) | New secret for an existing id. Body: {id}. Returns {ok, id, key, prefix, persisted}. 404 for an unknown id. |
| POST | /api/keys/reveal | Session only (+CSRF) | Shows the secret of a key created or rolled from the dashboard again. Body: {id, current} where current is the owner's password. Returns {ok, id, key}. 403 for a wrong password; 429 after 5 wrong passwords (5 minute pause); 404 {error:"not_stored", message} when the secret is not stored (for example keys created by the CLI or by OAuth). |
| POST | /api/keys/update | Session or key (admin, +CSRF) | Body: {id, name?, enabled?, tools?, scopes?, color?}. color as "" or null clears it. Returns {ok, id, name, enabled, color, tools, scopes, persisted}. 400 for an unknown tool or scope, 404 for an unknown id. |
| POST | /api/keys/delete | Session or key (admin, +CSRF) | {ok, id, persisted}. Moves the key to the trash. Body: {id}. |
| POST | /api/keys/restore | Session or key (admin, +CSRF) | {ok, id, persisted}. Restores a deleted key. Body: {id}. 404 when no deleted key has that id. |
| GET | /api/tools | Session or key (admin) | {tools:[{name, category, description, enabled}]}: the MCP tool catalog with the global on/off switch of each tool. |
| POST | /api/tools | Session or key (admin, +CSRF) | Switches a tool on or off for every caller. Body: {name, enabled}. Returns {ok, name, enabled}. 400 for an unknown tool. |
| GET | /api/access | Session or key (admin) | {default_allow, rules, count}. |
| POST | /api/access/test | Session or key (admin) | {action, would_lock_out_caller} for the given address or domain. Body: {ip?, domain?}. |
| POST | /api/access/rules | Session or key (admin, +CSRF) | {ok, count, persisted}. Body: {op, kind, value, action}. op is add (default) or remove. kind is ip, range, cidr, domain, or all; value is required unless kind is all. action is allow or block (default block). remove deletes every rule matching the given kind and value; 404 when none match. |
| GET | /api/config | Session or key (read) | {realm, min_password_len, session_ttl, vault, version, gateway, update}. update is the cached release check: {current, latest, available, url, checked_at, state, repo, stars}, state one of ok, none (no release published), error, disabled, pending; stars is the repository's GitHub star count from the same check (null until known). |
Settings#
All settings endpoints need a signed-in browser, except /api/settings/server, which also takes an API key with the admin scope.
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/settings | Session only | {user, vault_configured, vault, vault_suggested, vault_writable, stats, min_password_len, expires_in, session_ttl, session_max_age, state_dir}. stats is {notes, links, folders} or null without a vault. |
| POST | /api/settings/password | Session only (+CSRF) | Body: {current, password, confirm}. Returns {ok, user, password_changed, revoked_sessions, persisted}. Every other session is signed out. 400 for a short, mismatched, or unchanged password; 403 for a wrong current password (counts toward the login cooldown). |
| POST | /api/settings/username | Session only (+CSRF) | Renames the account. Body: {username, current}. Returns {ok, user, changed} (plus persisted when changed). The username is stored lowercase. Sessions stay signed in. 400 for an invalid username, 403 for a wrong password. |
| POST | /api/settings/vault | Session only (+CSRF) | Sets the vault folder and switches the running server to it. Body: {path, create?}. path must be absolute, without .., writable, not a system folder, and not overlap the state folder; with create a missing folder is created (its parent must exist). Returns {ok, vault, created, stats}. 400 with a message when the folder is refused. |
| POST | /api/settings/server | Session or key (admin, +CSRF) | Body: {realm?, session_ttl?, session_max_age?} (at least one). Sets the server name (1-64 characters), how long a browser may stay idle before it must sign in again (300 to 2592000 seconds) and the longest sign-in (0 for no limit, else at least session_ttl). Returns {realm, session_ttl, session_max_age}; open sessions follow the new limits at once. 400 for a value out of range. |
| GET | /api/settings/sessions | Session only | {sessions:[{id, current, source, alias, ip, user_agent, created_at, last_seen, expires_in}], count}: live browser sessions. API keys are not sessions and never appear here. |
| POST | /api/settings/sessions/revoke | Session only (+CSRF) | Signs other browsers out. Body: {id} or {others:true}. Returns {ok, revoked}. 400 for the current session (use logout), 404 when the session has already ended. |
| POST | /api/settings/sessions/rename | Session only (+CSRF) | Names a device. Body: {id, alias}; an empty alias clears it. Returns {ok, alias}. |
| GET | /api/settings/sessions/activity | Session only | {events, count, ip, since}: activity log entries from that session's IP address since it signed in, API-key entries left out, newest first, at most 200. Query: id. |
| GET | /api/settings/media | Session or key | {max_image_mb, max_image_bytes}: the largest image upload (5 MB by default). | | POST | /api/settings/media | Session or key (admin, +CSRF) | Body: {max_image_mb} (0.1 to 50). Applies at once to the app, the HTTP API and MCP upload_image. |
Session id values are the short ids returned by GET /api/settings/sessions (a unique prefix also works). An ambiguous or malformed id is 400.
OAuth#
Memora is an OAuth 2.1 authorization server for remote MCP clients. Only the authorization code flow with PKCE (S256) is supported. The access token is a new API key named after the client, with the default scopes (mcp, read, write) and every tool; it appears on the Agents page like any other key and is revoked by deleting or disabling that key. URLs in the metadata use MEMORA_BASE_URL when it is set, else the scheme and host of the request.
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /.well-known/oauth-protected-resource, /.well-known/oauth-protected-resource/mcp | None | Protected resource metadata (RFC 9728): {resource, authorization_servers, bearer_methods_supported, scopes_supported, resource_name}. |
| GET | /.well-known/oauth-authorization-server, /.well-known/oauth-authorization-server/mcp, /.well-known/openid-configuration | None | Authorization server metadata (RFC 8414): issuer, the authorization, token, and registration endpoints, supported response types (code), grant types (authorization_code, refresh_token), PKCE methods (S256), token endpoint auth methods, scopes_supported (mcp), and client_id_metadata_document_supported: true. |
| POST | /oauth/register | None | Dynamic client registration (RFC 7591). Body: {redirect_uris, client_name?}. redirect_uris holds 1 to 10 URIs, each HTTPS or plain HTTP on localhost, 127.0.0.1, or [::1], without a fragment. Returns 201 {client_id, client_name, redirect_uris, client_id_issued_at, token_endpoint_auth_method, grant_types, response_types}. 400 {error, error_description} for invalid metadata or when 500 clients are registered. 429 past 10 registrations from one IP (then one per minute). A client that has not completed an authorization within an hour is removed; it can register again. |
| GET | /oauth/authorize | None | 302 to /login?oauth=1&<query>, where the sign-in page shows a consent card (after sign-in when needed). |
| POST | /oauth/token | None | Form-encoded or JSON body. grant_type=authorization_code with code, code_verifier, client_id (or HTTP Basic), and optional redirect_uri; or grant_type=refresh_token with refresh_token and optional client_id. Returns {access_token, token_type:"Bearer", refresh_token, scope:"mcp"}. Codes are single use and expire after 10 minutes. A refresh gives the same key a new secret and a new refresh token. Errors are 400 {error, error_description} (invalid_request, invalid_grant, unsupported_grant_type). |
| GET | /api/oauth/request | None | What the consent card shows for an authorization request. Query: the /oauth/authorize query. Returns {ok:true, client:{id, name, kind}, redirect_host, signed_in, user} or {ok:false, error, error_description, redirect}. |
| POST | /api/oauth/approve | Session only (+CSRF) | Body: {query, allow} where query is the authorization request query. Returns {ok:true, redirect}: the client's redirect URI with a code when allow is true, else with error=access_denied. An invalid request returns {ok:false, error, error_description, redirect}. 401 without a session. |
| GET | /api/oauth/clients | Session or key (admin) | {clients:[{client_id, name, redirect_uris, kind, created_at, fetched_at}], connections:[{key_id, client_id}]}. kind is dcr (registered), cimd (metadata document), or manual (added by the owner). |
| POST | /api/oauth/clients | Session or key (admin, +CSRF) | Registers a client by hand. Body: {name?, redirect_uris}. Returns {ok, client}. 400 for invalid redirect URIs. |
| POST | /api/oauth/clients/delete | Session or key (admin, +CSRF) | Forgets a client and its refresh tokens. Body: {client_id}. Returns {ok, deleted}. Keys issued to the client stay until they are deleted. |
A client_id may also be an HTTPS URL of a client metadata document. The server fetches it (public addresses only, no redirects, at most 64 KiB), checks that its client_id matches the URL, and caches it for 24 hours.
Logs and activity#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/logs | Session or key (read) | {range, count, events}, newest first, each event with a local time. Query: range (for example 1d, 7d, today, yesterday, all; default 1d), days (used when range is absent, at most 7), since and until (unix seconds; override range), limit (default 400, max 2000), actor, q. |
| GET | /api/logs/settings | Session or key (admin) | {max_mb, max_days, stats:{bytes, lines, oldest, newest, max_bytes, max_days}} for the vault event log. |
| POST | /api/logs/settings | Session or key (admin, +CSRF) | Body: {max_mb?, max_days?} (1 to 512 MB; 0 to 3650 days, 0 meaning no age limit). Returns the same shape as GET. The log is trimmed to the new limits at once. 400 for out-of-range values. |
| GET | /api/events | Session or key (read) | {events, count}: the vault event log (.events.jsonl), oldest first, the newest limit entries. Query: since (unix seconds), folder, actor (the key name for agents), limit (default 100, max 2000). |
Realtime#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /ws | Session only | WebSocket upgrade. The Origin must be same-origin (403 otherwise). 503 when too many clients are connected. |
| POST | /_bus | Loopback only | Publishes a JSON object (at most 64 KiB) into the event stream. Returns {ok:true}. 403 for callers that are not on the same machine, that come through a proxy (any forwarding header) or that are a web page (an Origin or Sec-Fetch-* header), 400 for a body that is not a JSON object, 413 for a body or event that is too large. |
On connect the server sends a hello event with the client count, replays the last 40 stored events (each marked replay: true), then streams live events. When a client leaves, the others get a presence event with the new count. Messages from the client are ignored; the server pings every 30 seconds and closes a connection that has been silent for 75 seconds.
Local stop#
| Method | Path | Auth | Returns |
|---|---|---|---|
| POST | /_stop | Loopback and stop token | Stops the server gracefully, like Ctrl+C (open requests finish, buffered usage is written). Returns {ok:true} and exits shortly after. 403 unless the caller is on the same machine, not behind a proxy (any forwarding header), and sends the X-Memora-Stop-Token header. Also accepted while the instance is locked. |
At startup, once the port is bound, the server writes a fresh random token to <state>/stop.token (readable by the server's user only on Linux and macOS) and removes it on exit. memora-cli stop reads that file and calls /_stop first on every OS; only if that fails does it fall back to SIGTERM (Linux, macOS) or taskkill (Windows, where a server started without a console ignores a polite taskkill). Anyone who can read the state folder can stop the server; they can already read its database.
ai_activity events#
Every MCP tools/call publishes a start and an end event sharing call_id:
{"type":"ai_activity","phase":"start","call_id":"c1a2b3c4d5e6-0","actor":"research-bot",
"actor_kind":"agent","actor_id":"k_1a2b3c4d","action":"read_memory","label":"Plan/Index.md",
"paths":["Plan/Index.md"],"_ts":1760600000.12}
{"type":"ai_activity","phase":"end","call_id":"c1a2b3c4d5e6-0","actor":"research-bot",
"actor_kind":"agent","actor_id":"k_1a2b3c4d","action":"read_memory","label":"Plan/Index.md",
"paths":["Plan/Index.md"],"ok":true,"ms":2,"_ts":1760600000.12}actor: the API key's name (fallback: key id) withactor_kind: "agent"; for a browser session the username withactor_kind: "user".actor_idis the key id (or the username). Node events (node_created, ...) from the call carry the sameactor.action: the tool name.for(optional): who the agent acted for and how it was asked. Mnemo, the built-in agent (actor: "Mnemo",actor_id: "mnemo"), sets it:owner · chat,owner · console,<who> · @mnemo in <note>.paths: vault-relative note paths from the arguments (path,paths,from,to,old_path,new_path,intoofmerge_memory,source/targetoffind_path) plus note paths found in the result (search hits, the created or moved note), at most 20, each at most 512 bytes (longer paths are dropped). Whole-vault overviews (get_graph,list_memory, logs, ...) add no result paths.- Read-only tools publish
startafter running (so it carries the result paths), immediately followed byend; mutating tools publishstartbefore running andendafter, with the result paths added. endaddsok,ms, and on failureerror(at most 200 characters).labelis at most 160 characters._tsis the publish time in unix seconds.endevents are realtime only: they are not written to.events.jsonlor the replay buffer.
UI layout#
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/ui/layout/{name} | Session only | {name, data, updated_at}; data and updated_at are null if never saved. |
| PUT | /api/ui/layout/{name} | Session only (+CSRF) | {ok:true, updated_at}. Body: {data: <any JSON>}. |
name is [a-z0-9_-]{1,40} (else 400). API keys get 403. data is stored as serialized JSON of at most 512 KiB (413 above); the request body limit is 600 KiB. Names starting with srv- are reserved for server settings (403). Layouts are stored in the ui_layout table of memora.db. The web UI uses them for canvas (card positions and frames) and graph (pinned positions).
Pins#
The owner's pinned notes and folders (the sidebar's Pinned list), shared by every browser and device of the instance.
| Method | Path | Auth | Returns |
|---|---|---|---|
| GET | /api/pins | Session only | {count, pins:[{kind, path, position, missing}]} in display order. |
| PUT | /api/pins | Session only (+CSRF) | Same as GET. Body: {pins:[{kind, path}]}, the whole ordered list (reorder, remove). |
| POST | /api/pins/pin | Session only (+CSRF) | Same as GET. Body: {kind, path, position?}. Pins an existing note or folder at position (default: the end), or moves its pin there; 404 if it does not exist. |
| POST | /api/pins/unpin | Session only (+CSRF) | Same as GET plus removed. Body: {kind, path}. |
kind is note or folder. path is vault-relative as the tree shows it (notes end in .md): absolute paths, .., empty or hidden segments, \, control characters and paths over 1024 characters get 400, as do more than 200 pins. API keys get 403 (agents use the MCP tools list_pins, pin and unpin). Bodies are limited to 256 KiB for PUT and 8 KiB for pin/unpin (413). missing is true when the path no longer exists, for example after a rename outside Memora; such a pin is kept until it is removed.
Renames, moves and deletes done by Memora (HTTP or MCP) rewrite or drop pins in the same database transaction, including pins on notes and folders inside a moved folder; moving an item to the trash or deleting it removes its pin, and deleting a folder removes every pin under it. Every change publishes a pins_changed realtime event with no other data; open browsers reload the list. Pins are stored in the pin table of memora.db.
Mnemo (built-in agent)#
Mnemo is the notes agent built into Memora. Every route needs the signed-in browser session (API keys get 403, writes need CSRF); the console's /mnemo uses a short local session. Mnemo's data lives in assistant.sqlite3 beside memora.db (file mode 0600): providers with their API keys sealed (ChaCha20-Poly1305, the same key as the server's other secrets), models, preferences, chats and messages. A key is never returned; providers carry a four-character key_hint.
| Method | Path | Returns |
|---|---|---|
| GET | /api/assistant/state | {name, ready, providers, models, prefs, tools, own_tools, defaults}. ready is true when a model can answer. tools is the fixed list of Memora tools Mnemo may use, own_tools its own tools (pictures, chats, docs, plans, sub-agents); either can be switched off per agent with tools_off_main / tools_off_sub. Each model has thinks: it can think, so the chat offers a thinking level (Claude 3.7 and later by name; any other model, router aliases included, until its provider refuses both the effort and the thinking fields). think_levels, where known from the model's family, lists the levels it takes (a level it lacks is sent as the nearest one it has); without it every level is offered. A level other than auto is sent as output_config.effort (Anthropic), reasoning.effort (Responses API, OpenAI-compatible servers) or reasoning_effort (OpenAI chat and OpenAI-style routers), and left out for a model that refuses it. |
| POST | /api/assistant/providers | Adds or changes a provider. Body: {id?, kind?, label?, api_style?, base_url?, api_key?, enabled?}. Up to 20 providers, several of the same type allowed. id is the owner's own (1-32 characters of a-z, 0-9, -; made from label when left out; it cannot change, since models are keyed id/model). kind is openai, anthropic or custom (any OpenAI-compatible server, which needs base_url, its /v1 address); api_style is chat or responses (OpenAI and compatible) or messages (Anthropic). For an existing id, fields left out keep their value, so {id, enabled: false} switches a provider off (its models leave the model pickers). Leaving api_key out keeps the saved key; "" removes it. Returns the state plus saved (the id). |
| POST | /api/assistant/providers/test | Body: {id}. Lists the provider's models as a connection check: {ok, models, ms} or {ok: false, error}. |
| POST | /api/assistant/providers/delete | Body: {id}. Removes the provider, its key and its models. |
| POST | /api/assistant/models/fetch | Body: {provider}. Reads the provider's model list (GET <base>/models, every page for Anthropic) with the limits it reports: the context window from max_input_tokens, context_length, context_window, max_context_length or max_model_len, and the reply limit from max_tokens or max_completion_tokens. Pinned models stay; unpinned ones the provider no longer lists go. Returns the state plus fetched. 502 when the provider refuses. |
| POST | /api/assistant/models | Body: {provider, model, label?, context_window?, max_output?, pinned?, hidden?}. Adds a model by hand or changes it; null clears a limit. The app sets only pinned, hidden and new models; limits normally come from the provider. |
| POST | /api/assistant/models/delete | Body: {provider, model}. |
| POST | /api/assistant/prefs | Any of default_model (provider/model), system_prompt (up to 4000 characters), temperature (0-2), max_output_tokens (64-200000), context_tokens (2000-2000000, for models without a window), max_steps (1-30 tool rounds per reply), launcher (the floating button), thinking (auto, off, low, medium or high: how hard models that can think do so; auto leaves it to the model), fallback_models (up to 5 provider/model keys: when a reply's model fails after its retries, Mnemo carries on with the next one, streamed as fallback {from, model, reason}; with none left the error stands and the owner tries again), roles ({vision, image, tts, stt}, each a provider/model key or empty: the model that reads images, makes images, reads aloud and listens), voice (for reading aloud: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse), subagents (only null, to clear the named sub-agents of 2.2.0; sub-agents need no setup), learn_me (default true: Mnemo may keep notes about the owner), intro_done (the one-time "tell Mnemo about you" card was answered or skipped), ui_lang (the language of the owner's screen, e.g. Indonesian, sent by the web app; Mnemo's suggestions are written in it), tools_off_main and tools_off_sub (up to 200 tool names switched off for Mnemo itself and for its sub-agents; a call to one is refused, and they are left out of the tools the model sees), confirm_subagents (default true: before sub-agents run, the step becomes an ask_owner question naming them, their models and a rough token range; they run once the owner said yes to that question; the yes holds until sub-agents ran on it and the owner wrote again); null resets one. |
| GET | /api/assistant/sessions | {sessions: [{id, title, scope, model, pinned, archived, created_at, updated_at, messages, running, seen}]}. archived chats are listed (and searchable) but the web app keeps them out of its main chat list. messages counts the owner's and Mnemo's messages (not tool results); ?about=<path> lists only the chats about that note or folder (kept for it, with it attached, or naming it in a tool call). seen is how many of them the owner has read on any device (the unread count is messages - seen). The first list after 2.1.5 counts every existing chat as read. |
| POST | /api/assistant/sessions | Body: {scope?, model?, title?, fleeting?}. A fleeting chat is left out of lists, search and Mnemo's look-back tools and is deleted (with the pictures sent in it) by .../delete when the owner leaves, or after 30 minutes idle. scope is global, note:<path> or folder:<path>. Returns {session}. |
| GET | /api/assistant/sessions/{id} | {session, messages: [{id, role, content, tool_calls, tool_call_id, tool_name, meta, created_at}], context}. context is {used, window, reserved_output, compact_at, compactions, model} for the model the chat would use now (approximate tokens), or null without a usable model. A message with meta.compact: true is a summary that stands in for every message before meta.keep_from. |
| POST | /api/assistant/sessions/{id}/branch | Body: {message_id} (the first message of a version). Shows that version at its point in the chat: the chat's active path changes on the server, so the model, live sync (reload) and later turns follow it. Returns {messages}. 409 while the chat answers. Versions come from /rerun and from /chat with edit. |
| GET | /api/assistant/search | Query q (every word must appear, any case), limit (default 60, at most 200). {query, hits: [{chat, title, scope, message_id, role, snippet, at}]}, newest first: the owner's messages and Mnemo's replies whose text or chat title holds the words; message_id is null for a chat matched by its title alone. |
| POST | /api/assistant/sessions/{id}/rerun | Body: {message_id?, model?} (default: the last of the owner's messages). Runs that message's turn again: the earlier reply is kept as a version beside the new one (switch with /branch), then the reply streams as for /chat. 400 when message_id is not one of the owner's messages in the chat, 409 while it answers. |
| POST | /api/assistant/sessions/{id}/steer | Body: as for /chat. Send this message now: the reply running is cut where it is at once (what it wrote so far is kept, meta.stopped), whatever it was doing (compacting, waiting on a model, falling back, running a tool), and Mnemo answers this message as a new turn right away; the cut reply writes nothing more. With no reply running it goes at once. /stop cuts the same way and then sends the next queued message. {ok, queue}. (Older chats may hold meta.steer messages from before 2.1.9.) |
| GET | /api/assistant/sessions/{id}/queue | {items: [{id, text, attach, at}], held}: messages waiting for the reply running. They go out one by one, on the server, as each reply ends (finished, stopped or cut), whichever device queued them. A failed reply pauses the queue (held) until a message is sent now or the queue resumes. Kept in memory: a restart empties it. |
| POST | /api/assistant/sessions/{id}/queue | Body: as for /chat. Queue a message (it goes at once when no reply runs). {id, queue}. |
| POST | /api/assistant/sessions/{id}/queue/{qid} | Body: {op: del | up | down | move | send, to?} (to the new place for move). send puts it first and sends it now, cutting the reply running. {qid} may also be clear (drop every queued message) or resume (let a paused queue go on). Answers with the queue. |
| GET | /api/assistant/sessions/{id}/watch | What happens in the chat from now on, as server-sent events, so every device with it open stays in step: hello {running}, user {message, via, client} (a message stored from any device or out of the queue; client is the id the sender put in its request), running, idle {outcome} (done, stopped, failed), queue {items, held}, queue_error {message}, compacted, reload (turns were replaced: read the chat again). |
| GET | /api/assistant/sessions/{id}/live | The reply running in the chat as server-sent events: every event since it began, then live, until it ends. 204 when none is running. |
| GET | /api/assistant/sessions/{id}/export | The chat as a Markdown file (text/markdown, a download): each message with its time, Mnemo's steps, what it showed, compaction summaries. |
| GET | /api/assistant/skills | {folder: "Skills", skills: [{name, path, description}]}: the owner's skills (notes in Skills/). A message starting /name sends that skill's steps with it (meta.skill). |
| GET | /api/assistant/suggestions | {own, ai}: the owner's suggestions and Mnemo's (from recent notes; written again in the background when older than 12 hours, or when ?lang= names a screen language other than the one they were written in). |
| POST | /api/assistant/suggestions | Body {own: [text]} (up to 30): the owner's own suggestions. |
| POST | /api/assistant/suggestions/refresh | Mnemo writes its suggestions again now. {own, ai, fresh}. |
| POST | /api/assistant/sessions/prune | Delete many chats: body {ids}, {older_than_days} (1 to 3650; not active for that long) or {all: true}, with keep_pinned (default true, used with age or all). Chats answering right now are skipped. {deleted, skipped}. |
| POST | /api/assistant/sessions/{id}/seen | Body: {messages}. The owner has read the chat up to messages (capped at what it holds; never goes back). {ok, seen}. |
| POST | /api/assistant/sessions/{id}/stop | End the reply running in the chat; what it wrote so far is kept (meta.stopped) and the next queued message goes out. {stopped}. |
| POST | /api/assistant/sessions/{id}/compact | Fold the older turns into a summary now (the chat's model writes it; the last turn stays as it is). {ok: true, messages, tokens, summary, context}, or {ok: false, reason, context} when there is nothing older yet. 409 while the chat is answering. |
| POST | /api/assistant/sessions/{id} | Body: {title?, model?, pinned?, archived?}. A chat keeps its model (set when it is created, from the request or the default model at that time); a reply uses it while it is listed and its provider can answer, else the default model, then the fallback models, then the first pinned or visible one. When a fallback model takes over a reply, the chat's model becomes that model and the reply's stored message carries meta.fallback_from. |
| POST | /api/assistant/sessions/{id}/delete | Deletes the chat and its messages (notes are not touched). |
| POST | /api/assistant/sessions/{id}/chat | Body: {text, model?, attach?, tz?, tz_offset?, answer?, edit?} (answer {to, approve?, other?} answers one of Mnemo's questions by its call id; approve is set when the tapped option approves a change; edit is the id of one of the owner's messages on the shown version: the chat forks there and this message starts a new version beside it, 400 otherwise) (tz an IANA zone name and tz_offset minutes east of UTC, from the browser, for Mnemo's current_time). attach lists up to 8 items {kind, path}: note (its text, up to 8000 characters), folder (the notes in it, up to 200) or image (path is an id from /api/assistant/uploads). A snapshot of them is stored with the message (meta.attach, meta.context) and stays in the chat's context. Replies as server-sent events, one JSON object per data: line: start {model, context}, ask {id, question, options: [{label, description, approve}], allow_other} (Mnemo's ask_owner: the reply ends and waits for the answer), steered {text}, compacting and compacted {messages, tokens} (the chat was near full and its older messages were folded into a summary first), thinking {delta} (the model's thinking, where the provider shows it), text {delta}, tool_start {id, name, args}, tool_end {id, name, ok, summary, ms}, notice {text}, error {message}, done {input_tokens, output_tokens, title, context}. 409 while the chat is already answering (queue it instead). Also compact_text {delta} (the summary as it is written, before compacted {messages, tokens, summary}) and fallback {from, model, reason, detail} (the model failed: reason in a few words, detail the provider's error; the next fallback model answers and becomes the chat's model). A model out of quota, refused or not found is not retried. A body may carry client (any short id) so the sender can tell its own message in /watch. The reply runs on the server: closing the stream does not stop it (watch it again with /live, end it with /stop); GET /api/assistant/sessions and GET /api/assistant/sessions/{id} say running meanwhile. |
| POST | /api/assistant/uploads?name=<file> | The raw bytes of a PNG, JPEG, WebP or GIF (the Images upload limit applies): {id, name, bytes, url}. The image waits in assistant-uploads/ in the state folder for a week. Attached to a chat message, it goes to the model as an image (OpenAI image_url, Responses input_image, Anthropic image blocks; the newest 3 images of the chat, each up to 4.5 MB, older ones by name; a model that refuses images gets their names instead), and Mnemo's place_image tool can put it beside a note through MCP upload_image. |
| GET | /api/assistant/uploads/{id} | The staged image, for the chat's thumbnails. |
| GET | /api/storage/health | How full notes, images and chats are: {at, kinds: [{kind, used_bytes, count, room_bytes, room, limit_mb, percent, level, message}], warnings, disk, limits}. Each kind is measured against its own room: the owner's limit (room: "limit") or its use plus the free space on its disk ("disk"). level is ok, almost (90% or more) or full (99% or more), with a message saying what to do. Measured every 5 minutes; ?fresh=1 measures now. While a kind is almost full, MCP tool results carry storage: [{kind, level, percent, message, tell_owner}] (image tools: images; other tools: notes and images). |
| POST | /api/storage/health | Body: {notes_mb?, images_mb?, chats_mb?} (1 to 10000000, or 0/null for none). Sets the limits and returns the report. |
| GET | /api/vault/images/all | Every image in the vault, {images: [{path, name, folder, bytes, mtime, url, used_in: [{note, heading}]}], bytes, chat_images}; chat_images (owner only) lists the pictures staged for Mnemo chats, [{id, url, name, bytes, chats: [{id, title}]}]. Staged pictures are kept while a chat or a queued message uses them, and removed a week after nothing does. |
| GET | /api/assistant/memory | What Mnemo knows about the owner: {items: [{id, text, kind, by, at}], learn}, one plain list (kind is empty for new notes; notes from before 3.0.0 keep style, about or prefers); by is mnemo (learned) or owner. Up to 80 notes of up to 300 characters. Each message the owner sends carries them (meta.owner, left out of what the chat shows) when they changed since the previous one in that chat; never in a fleeting chat. |
| POST | /api/assistant/memory | Body: {text} (kind optional). Add a note (by: owner): {item}. |
| POST | /api/assistant/memory/{id} | Body: {text?, kind?}. Edit a note: {item}. |
| POST | /api/assistant/memory/{id}/delete | Delete a note: {ok}. |
| POST | /api/assistant/speak | Body: {text} (up to 4096 characters). The text read aloud by the roles.tts model with voice (OpenAI-compatible audio/speech): the audio bytes. 400 with no such model. |
| POST | /api/assistant/transcribe | The recording as the raw body (Content-Type its audio type, up to 25 MB): {text}, written out by the roles.stt model (OpenAI-compatible audio/transcriptions). 400 with no such model. |
Mnemo runs its tools through the MCP server under the name Mnemo (actor id mnemo), so every call shows in Activity and respects tools switched off on the Tools page. It has one tool of its own, place_image {upload, note, name?, alt?, append?}, which hands a staged chat image to upload_image (and is off when that tool is off).
Thinking: Anthropic models are asked for adaptive thinking with summaries (models that refuse the field are asked without it from then on), OpenAI GPT-5 and o-series models on the Responses API for reasoning summaries, and OpenAI-compatible servers stream reasoning_content or reasoning on their own. A Claude reply that carried thinking is stored block for block (meta.raw) and sent back verbatim, and each chat keeps the system prompt it started with (meta.system on its first message), so the model's earlier thinking stays valid. Thinking from before a compaction is not replayed, and when the API refuses a replayed thinking block the request is sent again without it. Permission (POST /api/assistant/prefs {permission: "ask" | "auto" | "read"}, default ask): Read only refuses every change to notes; in Auto sub-agents run without the token question; in Ask first mode a tool call that would change notes is refused until the owner's latest message approves (an answer with approve: true, or an @mnemo: request from a note); Auto lets changes through and runs up to 40 steps a reply (25 otherwise; max_steps overrides, up to 60). Besides place_image it has describe_image (the roles.vision model looks at a vault picture), generate_image (the roles.image model makes one, OpenAI-compatible images/generations; staged for the chat as an upload, kept in a note when note is given), delegate (one task to a sub-agent under any short name; its model is the owner's switch on its card, else the model argument when the owner asked for one (an exact provider/model, or the model id without its provider, or a label, any case; the tool lists the default model, the fallbacks and every usable model; a name that matches no model, or several, is refused with the close ones), else the default model and the fallbacks, and a failing model hands over to the next fallback (sub phase fallback {from, to, reason}); several in one step run at the same time; a sub-agent runs its own loop of up to 16 steps with the vault tools, cannot ask the owner or delegate, follows the permission mode, and answers {agent, model, answer, steps, input_tokens, output_tokens, context, window, follow_up, log}; follow_up: true goes on with the same sub-agent's earlier conversation in the chat; a sub-agent may ask the reply's own model a question with ask_mnemo; while it works the stream carries sub {id, agent, model, phase, ...} events, phase one of start {follow_up, window}, step {step}, text {delta}, tool {name, args}, tool_end {name, ok, summary}, ask {question}, answer {answer}, usage {input_tokens, output_tokens, context, window}, done {steps}, error {message}; tool_end of delegate, describe_image and generate_image carries the result as output), remember_owner, update_owner_memory and forget_owner_memory (its notes about the owner; not offered when learning is off or in a fleeting chat), ask_owner (a question with 2 to 5 options and Other), current_time (date, time, weekday and the owner's time zone), update_plan ({steps: [{text, status}]}, 1 to 12 steps, status pending, in_progress or done: the plan the web app shows as a live checklist above the message box; not offered to sub-agents), search_docs and read_docs (Memora's own documentation, from mnemo-docs.json the web build writes next to the assets; answers link /docs/<page>#<heading>), show_items (cards in the reply for notes, folders, images or the vault; tool_end carries the checked items as shown) and tools of its own over its chats: list_chats (newest first, optionally by title), search_chats (every word, newest first) and read_chat (one chat's messages, 60 at a time with page), for when the owner refers to an earlier conversation; and over the pages it wrote (```html / ```svg blocks in its replies, named by their <title>; the same title again is a newer version): list_artifacts (across chats or in one) and read_artifact (a page's source, the latest version unless version is given), so it reworks a page instead of starting over and can reuse one from another chat. Pages live in their chat's messages and are deleted with it. It may use 54 tools for reading and looking after notes, folders, tags, links, pins, history and the Trash; it never gets delete_memory, bulk_delete, delete_folder, export or import, admin or web tools. A line with @mnemo: <request> in a note (outside code; a struck ~~@mnemo: …~~ is done) is a request to Mnemo: a few seconds after the owner saves the note (POST /api/save or /api/create), or after an agent's tool call changes it (Mnemo's own changes from a chat or the console too; not those it makes while answering a request), Mnemo runs it in the note's chat (one per note, titled @mnemo · <note>, scope note:<path>; every later request in the note joins it, unless it is answering right now; each request's message holds it as written, meta.mention says {path, line, by} and meta.attach names the note), then saves the note with the request struck through and its reply quoted under it. Activity events of Mnemo's tool calls carry for ("owner · chat", "owner · console", "<who> · @mnemo in <note>"). A chat keeps its whole conversation for its model: when its history fills all the tokens it may use (the model's context minus the room kept for the reply), the chat's model folds the older turns into a summary (stored as a message with meta.compact, sent in front of the kept turns) before the next reply, keeping the last one or two turns as they are. Only if that fails are the oldest turns left out (a reply and its tool results always stay together).
Status codes#
| Code | Meaning |
|---|---|
| 200 | Success. |
| 201 | OAuth client registered. |
| 202 | MCP notification accepted. |
| 204 | /favicon.ico. |
| 302 | Redirect (pages to /login without a session, /login to / when signed in, logout to /login, locked instance to /login?locked=1, /oauth/authorize to the consent page). |
| 304 | Not modified (/api/vault/file, static assets). |
| 400 | Bad request, for example a missing required field or an invalid value. |
| 401 | Missing or invalid credentials, or a session-only endpoint called without a session. |
| 403 | Blocked by an access rule, a CSRF origin mismatch, a missing key scope, a wrong password or setup code, or an endpoint that needs an open setup or reset window. |
| 404 | Note, key, session, rule, or route not found; also any request for a host outside the domain list. |
| 405 | /mcp called with a method other than POST. |
| 408 | The request took longer than 30 seconds. |
| 409 | No vault configured (needs_vault: true), or a state conflict. |
| 413 | Body, layout, image, or event too large. |
| 415 | /api/vault/file path is not an image. |
| 423 | Instance is LOCKED. |
| 429 | Rate limit or failed-attempt cooldown (Retry-After header). |
| 500 | Internal error, for example the state database failed. |
| 503 | UI assets are not installed, the password hashing pool is busy, or too many realtime clients. |