Keys and recovery
How openmemory keys work, why each app should have its own, how to see which app each member uses, and how a recovery code gets you back in when every key is lost.
A space is reached with a key (om_...), and each key belongs to one member of the space. Your account holds your spaces and is the first way back in. This page covers how to keep keys safe and what to do when one is lost.
Keys
- A key is shown once, when it is made. The server stores only its SHA-256 hash, so it can't show it again, and a stolen database contains no keys.
- Send it as
Authorization: Bearer om_...orX-API-Key: om_.... - Keys don't expire. If one may have been seen by someone else, replace it with
POST /v1/space/key: the old one stops working at once and nothing else changes. - Keep keys in an environment variable or a secret store. Never put one in a memory, a commit, or a chat.
Apps that support OAuth don't need a key at all: they sign in and renew their own access.
One key per app
Give every app its own key, through an invite (invite_create, see Share a memory box) or OAuth sign-in. Then:
- every fact shows which app wrote it,
- removing one app (
member_remove) leaves every other key working, - a leaked key is one app's problem, not every app's.
Pasting the same key into several apps works, but they act as one member: you can't tell them apart or disconnect one of them.
Which app each member uses
member_list (GET /v1/space/members) shows, for each member:
| Field | What it says |
|---|---|
client | The app it last connected from, as the app reported it: name, version, seen_at. MCP clients name themselves when they connect; REST callers by their User-Agent. Updated when it changes, otherwise at most once an hour. |
oauth | Set when the member was created by an app's OAuth sign-in: client_id, client_name, and domain. |
client is self-reported: any program can call itself anything, so treat it as a label. oauth.domain is stronger: it is set when the app's client id is a URL on that domain (a Client ID Metadata Document), so the domain vouches for the app.
Lost every key
Sign in to your account and connect any app or agent to the memory again (device connect or OAuth sign-in): you pick it from your account, so no key is needed. Forgot your password? Use your account recovery code at openmemory.sh/forgot-password.
Recovery codes
A space's own recovery code is a second way back in, and a way to add a memory made before accounts to your account.
Spaces made before accounts came with a recovery code (omr_...), shown once next to the first key. Owners of any space can make one with recovery_create:
{ "space_id": "sp_...", "member_id": "mb_...", "api_key": "om_...", "recovery_code": "omr_...", "next": "..." }Store it apart from your keys, for example in a password manager. Never in a memory. If every key is lost, it gets you back in:
curl -s -X POST https://api.openmemory.sh/v1/space/recover \
-H 'content-type: application/json' \
-d '{"code": "omr_..."}'{ "space_id": "sp_...", "member_id": "mb_...", "name": "owner-2", "role": "owner", "api_key": "om_...", "recovery_code": "omr_...", "next": "..." }- It adds a new owner with a new key. Other members' keys keep working.
- The code works once. The response has the space's new code, also shown once.
- It works even when the space has as many members as it may.
- If the lost key could be in someone else's hands, remove that old member afterwards (
member_list, thenmember_remove). - The OAuth sign-in page takes the recovery code too, to reconnect an app.
- Guessing is limited per IP address, like accepting invites.
Spaces made before recovery codes existed have none: GET /v1/space shows recovery_code_set: false. An owner makes one with POST /v1/space/recovery (MCP: recovery_create). Making a new one ends the old one, so do that too if a code may have been seen.
If the space has your own OpenAI key, the recovery code can open it, the way each member's key can, so meaning search keeps working for the new owner.
A second owner
Another way back in: invite a second agent as an owner (invite_create with "role": "owner"). If one owner's key is lost, the other can invite you again and remove the lost member.
Related
Share a memory box
Give several agents one memory, each with its own key. Invite with a one-time code, see which agent wrote each fact, and remove one agent without touching the others.
Dreaming
Nightly memory consolidation. Housekeeping without an LLM, then a model stage that runs on your agent's model (client mode) or on Workers AI (server mode). Bounded, safe for user-stated facts, and undoable for 7 days.