---
title: API reference
description: Every memlane REST endpoint with its method, path, and operationId, each with a page where you can try it.
---

Base URL: `https://api.memlane.sh`. Authenticate with `Authorization: Bearer om_...` or `X-API-Key: om_...` on every endpoint except the ones that work without one: device connect, creating a space (which the service refuses: use device connect), accepting an invite, and using a recovery code. MCP clients can also [sign in with OAuth](/docs/guides/oauth); the REST API takes keys.

Every endpoint has its own page with a playground that sends real requests, code samples, and its request and response fields. Click an operationId below to open one.

To try the API, get a key first with [device connect](/docs/quickstart): you sign in, pick a memory, and get an `api_key`. Then on any endpoint paste it into the Authorization field, after `Bearer `. Requests go straight from your browser to `https://api.memlane.sh`. The key stays in that browser tab's session storage until you close the tab. There is no page for `embedding_key_set`: [set your OpenAI key in a terminal](/docs/own-openai-key).

- OpenAPI 3.0.3 document: [https://api.memlane.sh/openapi.json](https://api.memlane.sh/openapi.json)

The `operationId` values are stable. Tool generators that import the OpenAPI document (for example [Guild](/docs/guides/guild)) use them as tool names.

## Connect

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| POST | `/v1/connect` | `connect_start` | Start connecting an agent. Returns a link and a short code to show the person, and a `device_code`. No auth. Rate limited per IP. |
| POST | `/v1/connect/token` | `connect_token` | Poll with the `device_code`. 400 `authorization_pending` until the person signs in, picks a memory, and approves; then the agent's own `api_key`, once. No auth. |

## Space

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| POST | `/v1/spaces` | `space_create` | Create a memory space and get its key, with no account. The service refuses it with 403 `account_required` and a pointer to device connect: use `POST /v1/connect`. No auth. Rate limited per IP. |
| GET | `/v1/space` | `space_get` | Settings, usage, limits, `warnings` (limits 80% used or more), and `delete_after`. |
| PATCH | `/v1/space` | `space_update` | Change `name`, `timezone`, or `dream_mode`. Owners only. |
| DELETE | `/v1/space` | `space_delete` | Delete the space and everything in it. Owners only. |
| GET | `/v1/export` | `space_export` | Export everything as JSON. |
| POST | `/v1/space/key` | `space_key_rotate` | Replace your key. Your old one stops working at once; other members' keys don't change, and everything in the space stays. |
| POST | `/v1/space/recovery` | `recovery_create` | A new recovery code, shown once. The old one stops working. Owners only. |
| POST | `/v1/space/recover` | `space_recover` | Use the recovery code when every key is lost: adds a new owner and replaces the code. No auth. Rate limited per IP. See [Keys and recovery](/docs/keys-and-recovery). |
| GET | `/v1/space/embeddings` | `embedding_settings_get` | Show which embeddings this space uses. Never returns the key. |
| PUT | `/v1/space/embeddings` | `embedding_key_set` | Use your own OpenAI key. See [Your own OpenAI key](/docs/own-openai-key). |
| DELETE | `/v1/space/embeddings` | `embedding_key_delete` | Delete your OpenAI key and go back to the default embeddings. |

## Members

See [Share a memory box](/docs/sharing). Owner-only operations return `403 forbidden` to other members.

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| GET | `/v1/space/members` | `member_list` | The agents in this space, with the app each last connected from. You are marked `you: true`. |
| PATCH | `/v1/space/members/{member_id}` | `member_update` | Rename yourself (`me`); owners rename anyone and change roles. |
| DELETE | `/v1/space/members/{member_id}` | `member_remove` | Owners remove a member; `me` leaves. Other keys keep working. |
| POST | `/v1/space/invites` | `invite_create` | Owners: a one-time code and a prompt for the agent you invite. |
| GET | `/v1/space/invites` | `invite_list` | Owners: open invites. |
| DELETE | `/v1/space/invites/{invite_id}` | `invite_revoke` | Owners: revoke an open invite. |
| POST | `/v1/invites/accept` | `invite_accept` | Join with a code and get your own key. No auth. Rate limited per IP. |

## Context and batch

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| GET | `/v1/context` | `context_get` | Everything an agent needs at the start of a run, in one call. |
| POST | `/v1/batch` | `batch_apply` | Apply up to 50 writes atomically. |

## Memories

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| POST | `/v1/memories` | `memory_remember` | Remember a fact. Identical facts are returned, not duplicated. |
| GET | `/v1/memories` | `memory_recall` | Recall by words (`q`), `subject`, `tier`, `tag`, `author`, or `pinned`. Without `q`, lists every fact with `total` and `next_cursor`. |
| GET | `/v1/memories/{id}` | `memory_get` | Get one fact. |
| PATCH | `/v1/memories/{id}` | `memory_update` | Change a fact. |
| DELETE | `/v1/memories/{id}` | `memory_delete` | Delete one fact. |
| POST | `/v1/memories/import` | `memory_import` | Import up to 500 facts at once, as `facts` or as `text` with one fact per line. Facts already stored are skipped. |
| POST | `/v1/memories/extract` | `memory_extract_job` | Remember from a conversation: get a job for your model. |
| POST | `/v1/memories/extract/result` | `memory_extract_submit` | Store the facts your model extracted, in one transaction. |
| POST | `/v1/forget` | `memory_forget` | Remove matching facts, records, journal text, actions, KV values, and events. Supports `dry_run`. |

## Journal

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| PUT | `/v1/journal/{date}` | `journal_put` | Write the entry for a date (`YYYY-MM-DD`). `merge: true` appends. |
| GET | `/v1/journal` | `journal_list` | List entries newest first (`from`, `to`, `kind`, `limit`). |

## Records

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| POST | `/v1/collections/{collection}/records` | `record_put` | Create a record, or update the one with the same `key`, keeping fields you leave out. |
| GET | `/v1/collections/{collection}/records` | `record_query` | Query by `status`, `key`, `due_before`. Page with `cursor`. |
| GET | `/v1/collections/{collection}/records/{id}` | `record_get` | Get one record. |
| PATCH | `/v1/collections/{collection}/records/{id}` | `record_update` | Update with shallow merge and optional `expected_version`. |
| DELETE | `/v1/collections/{collection}/records/{id}` | `record_delete` | Delete a record. |

## Actions

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| POST | `/v1/actions` | `action_propose` | Propose an action that needs approval. Returns a short id (A1). |
| GET | `/v1/actions` | `action_list` | List actions, newest first. Default: open ones. |
| GET | `/v1/actions/{id}` | `action_get` | Get one action. |
| PATCH | `/v1/actions/{id}` | `action_update` | Merge into an action's `meta`. Nothing else can be changed. |
| POST | `/v1/actions/{id}/transition` | `action_transition` | Compare-and-set status change (`from`, `to`, optional `receipt`). |

## KV and events

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| GET | `/v1/kv/{ns}` | `kv_list` | List keys in a namespace. |
| GET | `/v1/kv/{ns}/{key}` | `kv_get` | Get one value. |
| PUT | `/v1/kv/{ns}/{key}` | `kv_set` | Set a value. Optional compare-and-set with `expected_version`. |
| DELETE | `/v1/kv/{ns}/{key}` | `kv_delete` | Delete a value. |
| POST | `/v1/events` | `event_append` | Append to the capped event log. |
| GET | `/v1/events` | `event_list` | List events newest first (`kind`, `since`, `before_id`). |
| GET | `/v1/activity` | `activity_list` | Who did what, newest first, by id only (`member`, `op`, `since`, `before_id`). Kept 30 days. |

## Dreaming

| Method | Path | operationId | Summary |
| --- | --- | --- | --- |
| POST | `/v1/dream` | `dream_start` | Start a dream now (optional `mode`). |
| GET | `/v1/dream/runs` | `dream_runs` | List recent runs and their reports. |
| POST | `/v1/dream/runs/{id}/undo` | `dream_undo` | Undo every change a run made (within 7 days). |
| GET | `/v1/dream/jobs/next` | `dream_job_next` | Client mode: get the waiting job (`start_if_due=true` to start one). |
| POST | `/v1/dream/jobs/{id}/result` | `dream_job_submit` | Client mode: submit your model's JSON result. |

## Service endpoints

These are not part of the OpenAPI document:

| Method | Path | Purpose |
| --- | --- | --- |
| GET | `/` | Service name, version, and links. |
| GET | `/health` | `{"ok": true}` |
| GET | `/openapi.json` | The OpenAPI 3.0.3 document. |
| GET | `/docs` | Redirects to this page. |
| POST | `/mcp` | The MCP endpoint (Streamable HTTP). On `https://mcp.memlane.sh` it is served at the root. Four tools are listed by default, twelve with `?tools=chat` (for chat apps), and all 43 with `?tools=all`. See [MCP tools](/docs/mcp-tools). |

## Conventions

- Request and response bodies are JSON. Times are ISO 8601 with an offset (`2026-11-05T09:00:00Z`). Dates are `YYYY-MM-DD`.
- Creates return `201`. Idempotent repeats (same fact, same record key, same action key) return `200` with `"created": false`.
- Errors are `{"error": {"code", "message", "details"?}}`. Status codes are listed in [Concepts](/docs/concepts#errors).
- Ids are prefixed: `sp_` (space), `mem_` (memory), `rec_` (record), `dr_` (dream run). Actions use short ids per space (`A1`).
- Browsers can only call the API from https://memlane.sh (for the playground on these pages) and from `localhost`. Call it from your server or agent everywhere else, so your key stays out of web pages.
