{"openapi":"3.0.3","info":{"title":"Memlane","version":"0.11.0","description":"Memory for agents: facts with keyword and meaning recall, a journal, typed records, an approval ledger, KV, events, and nightly dreaming. Get a key with device connect (POST /v1/connect, then POST /v1/connect/token), then send it as a bearer token."},"servers":[{"url":"https://api.memlane.sh"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Your space key (om_...). Get one with POST /v1/connect."},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"ConnectStarted":{"type":"object","properties":{"device_code":{"type":"string","description":"Keep this. Poll connect_token with it. Never show it to anyone."},"user_code":{"type":"string","description":"Show this to the person, e.g. WDJB-MJHT."},"verification_uri":{"type":"string","description":"Where the person approves: they sign in and enter the code."},"verification_uri_complete":{"type":"string","description":"The same page with the code filled in. Show this link."},"expires_in":{"type":"integer","description":"Seconds until the codes expire."},"interval":{"type":"integer","description":"Seconds to wait between polls."},"next":{"type":"string"}},"required":["device_code","user_code","verification_uri","verification_uri_complete","expires_in","interval","next"]},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{"type":"object","additionalProperties":{"nullable":true}}},"required":["code","message"]}},"required":["error"]},"Connected":{"type":"object","properties":{"space_id":{"type":"string"},"member_id":{"type":"string","description":"You, a member of your own in the memory the person picked."},"name":{"type":"string"},"role":{"type":"string","enum":["owner","member"]},"api_key":{"type":"string","description":"Shown once. Store it where the person approves; never print it in chat."},"next":{"type":"string"}},"required":["space_id","member_id","name","role","api_key","next"]},"NewSpace":{"type":"object","properties":{"space_id":{"type":"string"},"member_id":{"type":"string","description":"You, the space's first member and owner."},"api_key":{"type":"string","description":"Shown once. Store it; it cannot be recovered."},"recovery_code":{"type":"string","description":"Shown once. If every key is lost, space_recover with this code adds a new owner. Store it apart from the key, for example in a password manager."},"next":{"type":"string"}},"required":["space_id","member_id","api_key","recovery_code","next"]},"Space":{"type":"object","properties":{"space_id":{"type":"string"},"name":{"type":"string","description":"The space's name, as people see it in their dashboard."},"timezone":{"type":"string"},"dream_mode":{"$ref":"#/components/schemas/DreamMode"},"created_at":{"type":"string"},"last_seen_at":{"type":"string"},"last_dream_at":{"type":"string","nullable":true},"delete_after":{"type":"string","description":"The space is deleted if unused until then."},"meaning_search":{"type":"boolean","description":"Whether recall can also search by meaning on this server."},"embeddings":{"type":"string","description":"Which embeddings this space uses: default, or openai with your own key."},"members":{"type":"integer","description":"How many members (agents with their own key) the space has."},"shared":{"type":"boolean","description":"True when the space has more than one member."},"recovery_code_set":{"type":"boolean","description":"Whether the space has a recovery code. If not, an owner can make one with recovery_create."},"usage":{"type":"object","additionalProperties":{"type":"number"},"description":"How much the space holds: memories, records, open_actions, journal, kv, events, members, open_invites. Compare with limits."},"limits":{"type":"object","additionalProperties":{"type":"number"}},"warnings":{"type":"array","items":{"type":"string"},"description":"One line per limit the space has used 80% or more of, with what to do. Empty when none."}},"required":["space_id","name","timezone","dream_mode","created_at","last_seen_at","last_dream_at","delete_after","meaning_search","embeddings","members","shared","recovery_code_set","usage","limits","warnings"]},"DreamMode":{"type":"string","enum":["client","server","off"]},"SpacePatch":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":80,"description":"What people see in their dashboard's space switcher and on sign-in pages."},"timezone":{"type":"string","maxLength":64},"dream_mode":{"$ref":"#/components/schemas/DreamMode"}}},"NewRecoveryCode":{"type":"object","properties":{"recovery_code":{"type":"string","description":"Shown once. The previous code stops working."},"created_at":{"type":"string"},"note":{"type":"string"}},"required":["recovery_code","created_at","note"]},"Recovered":{"type":"object","properties":{"space_id":{"type":"string"},"member_id":{"type":"string"},"name":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"},"api_key":{"type":"string","description":"Your new key. Shown once."},"recovery_code":{"type":"string","description":"The space's new recovery code. Shown once; the one you used no longer works."},"next":{"type":"string"}},"required":["space_id","member_id","name","role","api_key","recovery_code","next"]},"Role":{"type":"string","enum":["owner","member"],"description":"owner = can invite, remove, change roles and space settings, delete the space; member = reads and writes."},"RecoverInput":{"type":"object","properties":{"code":{"type":"string","minLength":8,"maxLength":100,"description":"The space's recovery code (omr_...)."},"name":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Your name as the new owner. Defaults to owner (or owner-2, ...)."}},"required":["code"]},"Member":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"},"created_at":{"type":"string"},"last_seen_at":{"type":"string","description":"Refreshed at most once an hour."},"client":{"type":"object","nullable":true,"properties":{"name":{"type":"string","description":"e.g. Cursor, Claude Code, curl."},"version":{"type":"string","nullable":true},"seen_at":{"type":"string","nullable":true}},"required":["name","version","seen_at"],"description":"The app this member last connected from, as the app reported it: MCP clientInfo, or the User-Agent on REST. Self-reported, so a label, not proof. Null until it connects."},"oauth":{"type":"object","nullable":true,"properties":{"client_id":{"type":"string"},"client_name":{"type":"string","nullable":true},"domain":{"type":"string","nullable":true,"description":"Set when the app's client id is a URL on this domain (a Client ID Metadata Document): the domain vouches for the app. Null for apps that registered themselves."}},"required":["client_id","client_name","domain"],"description":"Set when this member was created by an app's OAuth sign-in. Null for members that joined with a key."},"you":{"type":"boolean","description":"Present (true) on the member whose key made this request."}},"required":["id","name","role","created_at","last_seen_at","client","oauth"]},"MemberPatch":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Your name in this space, e.g. cursor. Unique among its members."},"role":{"allOf":[{"$ref":"#/components/schemas/Role"},{"description":"Owners only."}]}}},"NewInvite":{"allOf":[{"$ref":"#/components/schemas/Invite"},{"type":"object","properties":{"code":{"type":"string","description":"Shown once. Works once, until expires_at."},"prompt":{"type":"string","description":"Paste this into the agent you are inviting. It tells that agent how to redeem the code and connect."}},"required":["code","prompt"]}]},"Invite":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string","nullable":true},"role":{"$ref":"#/components/schemas/Role"},"created_at":{"type":"string"},"expires_at":{"type":"string"},"created_by":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"]}},"required":["id","name","role","created_at","expires_at","created_by"]},"InviteInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"A suggested name for the new member. Accepting can choose another."},"role":{"$ref":"#/components/schemas/Role"},"expires_in_hours":{"type":"integer","minimum":1,"maximum":168,"default":24,"description":"1 to 168 (7 days)."}}},"AcceptedInvite":{"type":"object","properties":{"space_id":{"type":"string"},"member_id":{"type":"string"},"name":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"},"api_key":{"type":"string","description":"Your own key for this space. Shown once. Store it; it cannot be recovered."},"next":{"type":"string"}},"required":["space_id","member_id","name","role","api_key","next"]},"InviteAccept":{"type":"object","properties":{"code":{"type":"string","minLength":8,"maxLength":100,"description":"The invite code (omi_...)."},"name":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Your name in the space. Defaults to the invite's suggested name."}},"required":["code"]},"EmbeddingSettings":{"type":"object","properties":{"provider":{"type":"string","enum":["default","openai"],"description":"Which embeddings this space uses for meaning search."},"model":{"type":"string","nullable":true},"key":{"type":"object","nullable":true,"properties":{"hint":{"type":"string","description":"The last four characters, so you can tell which key this is."},"status":{"type":"string","enum":["active","rejected"],"description":"rejected = OpenAI refused it. Set a new key."},"updated_at":{"type":"string"}},"required":["hint","status","updated_at"]}},"required":["provider","model","key"]},"EmbeddingKeyInput":{"type":"object","properties":{"provider":{"type":"string","enum":["openai"]},"api_key":{"type":"string","pattern":"^sk-[A-Za-z0-9_-]{20,250}$","description":"Stored encrypted and never returned. Use a key from a separate project with a hard spend limit."}},"required":["provider","api_key"]},"Context":{"type":"object","properties":{"now":{"type":"string"},"timezone":{"type":"string"},"today":{"type":"string"},"you":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"}},"required":["id","name","role"],"description":"The member whose key made this request."},"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"}},"required":["id","name","role"]},"description":"Only in a shared space: everyone in it, including you."},"profile":{"type":"object","properties":{"text":{"type":"string","description":"Pinned and core facts, one per line, within budget_chars."},"facts_included":{"type":"number"},"facts_total":{"type":"number"},"truncated":{"type":"boolean"},"dream_summary":{"type":"string","nullable":true,"description":"The owner profile written by the last dream, if any."}},"required":["text","facts_included","facts_total","truncated","dream_summary"]},"due":{"type":"array","items":{"$ref":"#/components/schemas/Record"},"description":"Open records due within due_within_days."},"open_records":{"type":"array","items":{"$ref":"#/components/schemas/Record"},"description":"Open records, soonest due first: all collections unless you name some, up to open_limit."},"open_records_total":{"type":"number","description":"How many open records there are, including any past open_limit."},"actions":{"type":"array","items":{"$ref":"#/components/schemas/Action"},"description":"Pending, approved, and executing actions."},"journal":{"type":"array","items":{"$ref":"#/components/schemas/JournalEntry"}},"weekly":{"type":"object","nullable":true,"properties":{"kind":{"type":"string","enum":["day","week"]},"date":{"type":"string"},"summary":{"type":"string"},"decisions":{"type":"array","items":{"type":"string"}},"open_loops":{"type":"array","items":{"type":"string"}},"source_refs":{"type":"array","items":{"type":"string"}},"origin":{"$ref":"#/components/schemas/Origin"},"updated_at":{"type":"string"},"author":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The member (agent) that wrote it. null = written before the space had members, or by the server itself."},"updated_by":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The last member to change it."}},"required":["kind","date","summary","decisions","open_loops","source_refs","origin","updated_at","author","updated_by"]},"kv":{"type":"object","additionalProperties":{"type":"object","additionalProperties":{"nullable":true}}},"last_dream":{"type":"object","nullable":true,"properties":{"id":{"type":"string"},"status":{"type":"string"},"finished_at":{"type":"string","nullable":true},"report":{"nullable":true}},"required":["id","status","finished_at"]},"warnings":{"type":"array","items":{"type":"string"},"description":"Only when the space has used 80% or more of a limit: one line per limit, with what to do. Tell the person."}},"required":["now","timezone","today","you","profile","due","open_records","open_records_total","actions","journal","weekly","kv","last_dream"]},"Record":{"type":"object","properties":{"id":{"type":"string"},"collection":{"type":"string"},"key":{"type":"string","nullable":true},"status":{"type":"string"},"due_at":{"type":"string","nullable":true},"data":{"type":"object","additionalProperties":{"nullable":true}},"origin":{"$ref":"#/components/schemas/Origin"},"version":{"type":"integer"},"created_at":{"type":"string"},"updated_at":{"type":"string"},"author":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The member (agent) that wrote it. null = written before the space had members, or by the server itself."},"updated_by":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The last member to change it."}},"required":["id","collection","key","status","due_at","data","origin","version","created_at","updated_at","author","updated_by"]},"Origin":{"type":"string","enum":["user","agent","dream"]},"Action":{"type":"object","properties":{"id":{"type":"string"},"class":{"type":"string"},"summary":{"type":"string"},"payload":{"type":"object","additionalProperties":{"nullable":true}},"payload_hash":{"type":"string"},"preconditions":{"type":"array","items":{"nullable":true}},"meta":{"type":"object","additionalProperties":{"nullable":true}},"idempotency_key":{"type":"string"},"status":{"$ref":"#/components/schemas/ActionStatus"},"receipt":{"type":"object","nullable":true,"additionalProperties":{"nullable":true}},"expires_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"author":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The member that proposed it."},"updated_by":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The last member to change it: who approved, denied, or ran it."}},"required":["id","class","summary","payload","payload_hash","preconditions","meta","idempotency_key","status","receipt","expires_at","created_at","updated_at","author","updated_by"]},"ActionStatus":{"type":"string","enum":["pending","approved","executing","done","failed","denied","expired","superseded","blocked"]},"JournalEntry":{"type":"object","properties":{"kind":{"type":"string","enum":["day","week"]},"date":{"type":"string"},"summary":{"type":"string"},"decisions":{"type":"array","items":{"type":"string"}},"open_loops":{"type":"array","items":{"type":"string"}},"source_refs":{"type":"array","items":{"type":"string"}},"origin":{"$ref":"#/components/schemas/Origin"},"updated_at":{"type":"string"},"author":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The member (agent) that wrote it. null = written before the space had members, or by the server itself."},"updated_by":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The last member to change it."}},"required":["kind","date","summary","decisions","open_loops","source_refs","origin","updated_at","author","updated_by"]},"BatchInput":{"type":"object","properties":{"ops":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"op":{"type":"string","enum":["memory.remember"]},"input":{"$ref":"#/components/schemas/MemoryInput"}},"required":["op","input"]},{"type":"object","properties":{"op":{"type":"string","enum":["memory.update"]},"id":{"type":"string"},"patch":{"$ref":"#/components/schemas/MemoryPatch"}},"required":["op","id","patch"]},{"type":"object","properties":{"op":{"type":"string","enum":["memory.delete"]},"id":{"type":"string"}},"required":["op","id"]},{"type":"object","properties":{"op":{"type":"string","enum":["journal.put"]},"date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"input":{"$ref":"#/components/schemas/JournalInput"}},"required":["op","date","input"]},{"type":"object","properties":{"op":{"type":"string","enum":["record.put"]},"collection":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$"},"input":{"$ref":"#/components/schemas/RecordInput"}},"required":["op","collection","input"]},{"type":"object","properties":{"op":{"type":"string","enum":["record.update"]},"collection":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$"},"id":{"type":"string"},"patch":{"$ref":"#/components/schemas/RecordPatch"}},"required":["op","collection","id","patch"]},{"type":"object","properties":{"op":{"type":"string","enum":["record.delete"]},"collection":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$"},"id":{"type":"string"}},"required":["op","collection","id"]},{"type":"object","properties":{"op":{"type":"string","enum":["action.propose"]},"input":{"$ref":"#/components/schemas/ActionInput"}},"required":["op","input"]},{"type":"object","properties":{"op":{"type":"string","enum":["action.update"]},"id":{"type":"string"},"patch":{"$ref":"#/components/schemas/ActionPatch"}},"required":["op","id","patch"]},{"type":"object","properties":{"op":{"type":"string","enum":["action.transition"]},"id":{"type":"string"},"input":{"$ref":"#/components/schemas/ActionTransition"}},"required":["op","id","input"]},{"type":"object","properties":{"op":{"type":"string","enum":["kv.set"]},"ns":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$"},"key":{"type":"string","minLength":1,"maxLength":200},"input":{"$ref":"#/components/schemas/KvInput"}},"required":["op","ns","key","input"]},{"type":"object","properties":{"op":{"type":"string","enum":["kv.delete"]},"ns":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$"},"key":{"type":"string","minLength":1,"maxLength":200}},"required":["op","ns","key"]},{"type":"object","properties":{"op":{"type":"string","enum":["event.append"]},"input":{"$ref":"#/components/schemas/EventInput"}},"required":["op","input"]}]},"minItems":1,"maxItems":50}},"required":["ops"],"description":"Applied in one transaction: all ops succeed or none do."},"MemoryInput":{"type":"object","properties":{"subject":{"type":"string","maxLength":200,"default":"","description":"Who or what the fact is about, e.g. 'Sam'."},"text":{"type":"string","minLength":1,"maxLength":4000,"description":"The fact itself, in one or two sentences."},"tier":{"$ref":"#/components/schemas/Tier"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":20,"default":[]},"source_ref":{"type":"string","maxLength":500,"default":"","description":"Where the fact came from (message id, URL). No message bodies."},"pinned":{"type":"boolean","default":false,"description":"Pinned facts are never changed by dreaming."},"origin":{"type":"string","enum":["user","agent"],"default":"agent","description":"'user' when the person stated it; dreaming never rewrites those."},"expires_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["text"]},"Tier":{"type":"string","enum":["core","long","scratch"],"default":"long","description":"core = always in context; long = recalled on demand; scratch = short-lived."},"MemoryPatch":{"type":"object","properties":{"subject":{"type":"string","maxLength":200},"text":{"type":"string","minLength":1,"maxLength":4000},"tier":{"$ref":"#/components/schemas/Tier"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":20},"source_ref":{"type":"string","maxLength":500},"pinned":{"type":"boolean"},"expires_at":{"type":"string","nullable":true,"format":"date-time"}}},"JournalInput":{"type":"object","properties":{"summary":{"type":"string","maxLength":4000,"default":""},"decisions":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":50,"default":[]},"open_loops":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":50,"default":[]},"source_refs":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":50,"default":[]},"kind":{"type":"string","enum":["day","week"],"default":"day"},"merge":{"type":"boolean","default":false,"description":"Append to an existing entry instead of replacing it."}}},"RecordInput":{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200,"description":"Optional unique key within the collection. Writing it again updates that record: fields you send replace the old values, and fields you leave out keep them."},"status":{"type":"string","maxLength":50,"description":"A new record defaults to an empty status."},"due_at":{"type":"string","nullable":true,"format":"date-time","description":"Send null to clear it on an update by key."},"data":{"type":"object","additionalProperties":{"nullable":true},"description":"Replaces all of the record's data when sent. A new record defaults to {}. To change single fields, use record_update."},"origin":{"type":"string","enum":["user","agent"],"description":"A new record defaults to agent."}}},"RecordPatch":{"type":"object","properties":{"status":{"type":"string","maxLength":50},"due_at":{"type":"string","nullable":true,"format":"date-time"},"data":{"type":"object","additionalProperties":{"nullable":true},"description":"Shallow-merged into the existing data. Set a field to null to clear it."},"expected_version":{"type":"integer","minimum":1,"description":"Fail with 409 unless the record is at this version."}}},"ActionInput":{"type":"object","properties":{"class":{"type":"string","minLength":1,"maxLength":64,"description":"Kind of action, e.g. email_reply, calendar_hold."},"summary":{"type":"string","minLength":1,"maxLength":1000,"description":"One line the owner reads when approving."},"payload":{"type":"object","additionalProperties":{"nullable":true},"description":"Exactly what will be executed."},"preconditions":{"type":"array","items":{"nullable":true},"maxItems":20,"default":[]},"meta":{"type":"object","additionalProperties":{"nullable":true},"default":{}},"idempotency_key":{"type":"string","minLength":1,"maxLength":200,"description":"Same key + same payload returns the existing action, in whatever status it is now, including denied. To ask again after a denial, use a new key."},"expires_at":{"type":"string","nullable":true,"format":"date-time"}},"required":["class","summary","payload","idempotency_key"]},"ActionPatch":{"type":"object","properties":{"meta":{"type":"object","additionalProperties":{"nullable":true},"description":"Merged into the existing meta (for example a chat message id). Set a field to null to remove it. Nested objects are merged too."}},"required":["meta"]},"ActionTransition":{"type":"object","properties":{"from":{"allOf":[{"$ref":"#/components/schemas/ActionStatus"},{"description":"The status you expect the action to be in now."}]},"to":{"$ref":"#/components/schemas/ActionStatus"},"receipt":{"type":"object","additionalProperties":{"nullable":true},"description":"What the execution did. Usually sent with to=done or to=failed."}},"required":["from","to"]},"KvInput":{"type":"object","properties":{"value":{"nullable":true,"description":"Any JSON value."},"expected_version":{"type":"integer","minimum":0,"description":"0 = only create; n = only update if at version n. Omit to upsert."},"expires_at":{"type":"string","nullable":true,"format":"date-time"}}},"EventInput":{"type":"object","properties":{"kind":{"type":"string","minLength":1,"maxLength":64},"key":{"type":"string","maxLength":200,"default":""},"status":{"type":"string","maxLength":64,"default":""},"detail":{"type":"object","additionalProperties":{"nullable":true},"default":{},"description":"Small structured detail. Do not put message bodies or secrets here."}},"required":["kind"]},"ExtractInput":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","system","tool"],"default":"user"},"content":{"type":"string","minLength":1,"maxLength":8000}},"required":["content"]},"minItems":1,"maxItems":100,"description":"The conversation. Not stored. Omit it if your model already has the conversation; send about instead."},"about":{"type":"string","maxLength":500,"description":"What the conversation is about, used to find related facts."}}},"Memory":{"type":"object","properties":{"id":{"type":"string"},"subject":{"type":"string"},"text":{"type":"string"},"tier":{"$ref":"#/components/schemas/Tier"},"tags":{"type":"array","items":{"type":"string"}},"source_ref":{"type":"string"},"pinned":{"type":"boolean"},"origin":{"$ref":"#/components/schemas/Origin"},"expires_at":{"type":"string","nullable":true},"recall_count":{"type":"integer"},"last_recalled_at":{"type":"string","nullable":true},"created_at":{"type":"string"},"updated_at":{"type":"string"},"author":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The member (agent) that wrote it. null = written before the space had members, or by the server itself."},"updated_by":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The last member to change it."},"match":{"type":"string","enum":["keyword","meaning","both"],"description":"Recall only: whether this fact matched the words of q, its meaning, or both."}},"required":["id","subject","text","tier","tags","source_ref","pinned","origin","expires_at","recall_count","last_recalled_at","created_at","updated_at","author","updated_by"]},"ExtractResult":{"type":"object","properties":{"facts":{"type":"array","items":{"$ref":"#/components/schemas/ExtractedFact"},"maxItems":20}},"required":["facts"]},"ExtractedFact":{"type":"object","properties":{"subject":{"type":"string","maxLength":200,"default":"","description":"Who or what the fact is about."},"text":{"type":"string","minLength":1,"maxLength":4000,"description":"The fact, in one or two sentences."},"tier":{"$ref":"#/components/schemas/Tier"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":20,"default":[]},"origin":{"type":"string","enum":["user","agent"],"default":"agent","description":"'user' only when the person said it directly."},"replaces":{"type":"string","maxLength":64,"description":"Id of the related fact this one changes."}},"required":["text"]},"ImportResult":{"type":"object","properties":{"created":{"type":"integer","description":"Facts stored."},"skipped":{"type":"integer","description":"Facts already stored (same subject and text), or repeated in the import."},"ids":{"type":"array","items":{"type":"string"},"description":"Ids of the facts stored."},"next":{"type":"string"}},"required":["created","skipped","ids","next"]},"ImportInput":{"type":"object","properties":{"facts":{"type":"array","items":{"type":"object","properties":{"subject":{"type":"string","maxLength":200,"default":""},"text":{"type":"string","minLength":1,"maxLength":4000},"tier":{"$ref":"#/components/schemas/Tier"},"tags":{"type":"array","items":{"type":"string","minLength":1,"maxLength":50},"maxItems":18,"default":[]}},"required":["text"]},"maxItems":500,"description":"Up to 500 facts. Send facts or text."},"text":{"type":"string","maxLength":200000,"description":"One fact per line, e.g. a ChatGPT or Claude memory list pasted as it is. Bullets and numbering are stripped; blank lines and # headings are skipped."},"subject":{"type":"string","maxLength":200,"description":"Subject for facts from text (default none)."},"source":{"type":"string","pattern":"^[a-z0-9][a-z0-9_.-]{0,39}$","default":"import","description":"Where the facts came from, e.g. chatgpt. Tagged on every fact, with source_ref import:<source>."}}},"RecallSearch":{"type":"object","properties":{"mode":{"type":"string","enum":["hybrid","keyword","semantic","list"],"description":"What actually ran. list = no query, facts listed."},"meaning":{"type":"string","enum":["used","not_requested","off","budget","error"],"description":"Meaning search: used; not_requested; off (not enabled on this server); budget (daily spend limit reached); error. When not used, results are keyword-only."},"entities":{"type":"array","items":{"type":"string"},"description":"Names from q that boosted results. Absent when none did."},"indexing":{"type":"integer","description":"How many matching facts meaning search may not find yet, because they are new, changed, or waiting to be embedded. Absent when none are, and on a full page. They can still be found by their words."}},"required":["mode","meaning"]},"RecallMode":{"type":"string","enum":["hybrid","keyword","semantic"],"description":"hybrid (default) = words and meaning together; keyword = words only (best for names, ids, exact terms); semantic = meaning only."},"ForgetResult":{"type":"object","properties":{"dry_run":{"type":"boolean"},"memories":{"type":"array","items":{"type":"string"}},"records":{"type":"array","items":{"type":"string"}},"journal":{"type":"array","items":{"type":"string"}},"actions":{"type":"array","items":{"type":"string"},"description":"Actions redacted. They stay in the ledger with '[forgotten]' in place of the phrase."},"kv":{"type":"array","items":{"type":"string"},"description":"KV entries deleted, as ns/key."},"events":{"type":"array","items":{"type":"integer"},"description":"Events deleted."},"executing_actions":{"type":"array","items":{"type":"string"},"description":"Matching actions already executing. They were redacted, but whatever is running them already has the original."},"not_searched":{"type":"array","items":{"type":"string","enum":["memories","records","journal","actions","kv","events"]},"description":"Scopes this call did not look in, so the phrase may still be there."},"truncated":{"type":"boolean","description":"More matched than one call handles. Run it again until this is false."}},"required":["dry_run","memories","records","journal","actions","kv","events","executing_actions","not_searched","truncated"]},"ForgetInput":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"},"maxItems":200,"description":"Memory ids to delete."},"query":{"type":"string","minLength":2,"maxLength":200,"description":"Memories match when they contain ALL of these words. Everything else matches when it contains this exact phrase."},"scopes":{"type":"array","items":{"type":"string","enum":["memories","records","journal","actions","kv","events"]},"default":["memories"],"description":"Where to look. The default is memories only, so to forget something everywhere, list all six. The result's not_searched names what was skipped."},"journal_mode":{"type":"string","enum":["redact","delete"],"default":"redact"},"dry_run":{"type":"boolean","default":false}}},"KvItem":{"type":"object","properties":{"ns":{"type":"string"},"key":{"type":"string"},"value":{"nullable":true},"version":{"type":"integer"},"expires_at":{"type":"string","nullable":true},"updated_at":{"type":"string"}},"required":["ns","key","version","expires_at","updated_at"]},"Event":{"type":"object","properties":{"id":{"type":"integer"},"at":{"type":"string"},"kind":{"type":"string"},"key":{"type":"string"},"status":{"type":"string"},"detail":{"type":"object","additionalProperties":{"nullable":true}},"author":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"The member that appended it."}},"required":["id","at","kind","key","status","detail","author"]},"Activity":{"type":"object","properties":{"id":{"type":"integer"},"at":{"type":"string"},"member":{"type":"object","nullable":true,"properties":{"id":{"type":"string","description":"The member's id (mb_...)."},"name":{"type":"string"},"removed":{"type":"boolean","description":"Present (true) when that member has since left or been removed."}},"required":["id","name"],"description":"Who did it. null = the server itself."},"op":{"type":"string","description":"memory.remember|update|delete|import, journal.put, record.put|update|delete, action.propose|update, action.<new status>, kv.set|delete, event.append, forget, invite.created|revoked, member.joined|updated|removed|recovered, recovery.created"},"target_kind":{"type":"string","nullable":true,"description":"memory, journal, record, action, kv, event, invite, member"},"target_id":{"type":"string","nullable":true,"description":"The item's id (journal: kind:date; kv: the namespace only). null for import and forget."},"count":{"type":"integer","description":"How many items: more than 1 for import and forget."}},"required":["id","at","member","op","target_kind","target_id","count"]},"DreamRun":{"type":"object","properties":{"id":{"type":"string"},"mode":{"type":"string"},"status":{"type":"string","description":"running | awaiting_client | done | failed | undone | abandoned"},"report":{"type":"object","additionalProperties":{"nullable":true}},"started_at":{"type":"string"},"finished_at":{"type":"string","nullable":true}},"required":["id","mode","status","report","started_at","finished_at"]},"DreamJob":{"type":"object","nullable":true,"properties":{"run_id":{"type":"string"},"instructions":{"type":"string","description":"System prompt for your model."},"input":{"type":"object","additionalProperties":{"nullable":true},"description":"Send this to your model as the user message (JSON)."},"output_schema":{"type":"object","additionalProperties":{"nullable":true},"description":"JSON Schema the model's answer must match."},"max_changes":{"type":"number"}},"required":["run_id","instructions","input","output_schema","max_changes"]},"DreamResult":{"type":"object","properties":{"merges":{"type":"array","items":{"type":"object","properties":{"keep_id":{"type":"string"},"remove_ids":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":20},"subject":{"type":"string","maxLength":200},"text":{"type":"string","minLength":1,"maxLength":4000}},"required":["keep_id","remove_ids"]},"maxItems":50,"default":[],"description":"Near-duplicate facts to merge into keep_id. Optional new wording for keep_id."},"promotions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tier":{"$ref":"#/components/schemas/Tier"}},"required":["id","tier"]},"maxItems":50,"default":[],"description":"Tier changes, e.g. often-recalled long facts to core."},"contradictions":{"type":"array","items":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string"},"minItems":2,"maxItems":10},"note":{"type":"string","minLength":1,"maxLength":500}},"required":["ids","note"]},"maxItems":20,"default":[],"description":"Facts that disagree. They are flagged, not changed."},"weekly_digest":{"type":"object","nullable":true,"properties":{"week_start":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"summary":{"type":"string","maxLength":4000},"decisions":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":50,"default":[]},"open_loops":{"type":"array","items":{"type":"string","maxLength":500},"maxItems":50,"default":[]}},"required":["week_start","summary"]},"proposals":{"type":"array","items":{"type":"object","properties":{"text":{"type":"string","minLength":1,"maxLength":500},"counterparty":{"type":"string","maxLength":200},"due":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"source_date":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"}},"required":["text"]},"maxItems":20,"default":[],"description":"Unfinished items worth tracking. Stored in the dream.proposals collection with status 'proposed'."},"profile":{"type":"string","maxLength":4000,"description":"A short profile of the owner built only from the facts given."}}}},"parameters":{}},"paths":{"/v1/connect":{"post":{"operationId":"connect_start","tags":["Connect"],"summary":"Start connecting an agent to the person's account","description":"No key needed. Returns a link and a short code to show the person, and a device code to poll connect_token with. The person signs in (or signs up), picks one of their memories or starts one, and approves. Then connect_token returns this agent's own key.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":64,"description":"Your name as a member, e.g. claude-code."},"client":{"type":"string","maxLength":200,"description":"Your app and version, e.g. Codex 1.4."}}}}}},"responses":{"200":{"description":"Show the link and code to the person","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectStarted"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/connect/token":{"post":{"operationId":"connect_token","tags":["Connect"],"summary":"Poll for the agent's key","description":"Returns 400 with error.code authorization_pending until the person approves (slow_down if you poll faster than `interval`), 403 access_denied if they decline, 400 expired_token when the code expired or was used. Once approved, the first poll returns your key, once.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"device_code":{"type":"string","minLength":1,"maxLength":200}},"required":["device_code"]}}}},"responses":{"200":{"description":"Connected","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connected"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/spaces":{"post":{"operationId":"space_create","tags":["Space"],"summary":"Create a memory space and get its key","description":"The key is shown once. Rate limited per IP address. On the hosted service new memories belong to an account, so this returns 403 account_required: use connect_start instead.","requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"timezone":{"type":"string","maxLength":64,"description":"IANA timezone, e.g. Europe/Athens"},"name":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Your name as the first member, e.g. claude-code. Defaults to owner."}}}}}},"responses":{"201":{"description":"Space created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewSpace"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space":{"get":{"operationId":"space_get","tags":["Space"],"summary":"Show this space's settings, usage, and limits","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"The space","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Space"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"space_update","tags":["Space"],"summary":"Rename the space, or change its timezone or dream mode","description":"Owners only.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpacePatch"}}}},"responses":{"200":{"description":"Updated space","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Space"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"space_delete","tags":["Space"],"summary":"Delete this space and everything in it","description":"Owners only. Permanent, for every member. Export first if you want a copy.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string"}},"required":["deleted"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space/key":{"post":{"operationId":"space_key_rotate","tags":["Space"],"summary":"Replace your key","description":"Returns a new key for the member making the call, shown once. Your old key stops working immediately; other members' keys don't change. Everything in the space stays, including a stored OpenAI key.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"The new key","content":{"application/json":{"schema":{"type":"object","properties":{"space_id":{"type":"string"},"member_id":{"type":"string"},"api_key":{"type":"string","description":"Shown once. Store it; it cannot be recovered."}},"required":["space_id","member_id","api_key"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space/recovery":{"post":{"operationId":"recovery_create","tags":["Space"],"summary":"Make a new recovery code","description":"Owners only. Returns a new recovery code, shown once; the previous one stops working. Use it for spaces made before recovery codes existed, or when a code may have been seen by someone else.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"201":{"description":"The new code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewRecoveryCode"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space/recover":{"post":{"operationId":"space_recover","tags":["Space"],"summary":"Get back into a space with its recovery code","description":"No key needed: this is for when every key is lost. Adds a new owner with its own key, and replaces the recovery code (both shown once). Other members' keys keep working. Rate limited per IP address.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecoverInput"}}}},"responses":{"201":{"description":"Recovered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Recovered"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/export":{"get":{"operationId":"space_export","tags":["Space"],"summary":"Export everything in this space as JSON","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"Full export","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"nullable":true}}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space/members":{"get":{"operationId":"member_list","tags":["Members"],"summary":"List the members of this space","description":"Every agent with its own key in this space. The caller is marked with you: true.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"Members","content":{"application/json":{"schema":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}},"required":["members"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space/members/{member_id}":{"patch":{"operationId":"member_update","tags":["Members"],"summary":"Rename a member, or change its role","description":"Use `me` for yourself. Any member can rename itself; owners can rename anyone and change roles. A space always keeps at least one owner.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","maxLength":64,"example":"me"},"required":true,"name":"member_id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberPatch"}}}},"responses":{"200":{"description":"The member","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Member"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"member_remove","tags":["Members"],"summary":"Remove a member, or leave the space","description":"Use `me` to leave. Owners can remove anyone. The removed member's key stops working at once; every other key keeps working. What it wrote stays, still attributed to it.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","maxLength":64,"example":"me"},"required":true,"name":"member_id","in":"path"}],"responses":{"200":{"description":"Removed","content":{"application/json":{"schema":{"type":"object","properties":{"removed":{"type":"string"}},"required":["removed"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space/invites":{"post":{"operationId":"invite_create","tags":["Members"],"summary":"Invite another agent into this space","description":"Owners only. Returns a one-time code and a prompt to paste into the other agent, which redeems it with invite_accept and gets its own key. You never see that key.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteInput"}}}},"responses":{"201":{"description":"The invite","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewInvite"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"invite_list","tags":["Members"],"summary":"List open invites","description":"Owners only. Invites not yet used and not expired. Codes are never shown again.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"Open invites","content":{"application/json":{"schema":{"type":"object","properties":{"invites":{"type":"array","items":{"$ref":"#/components/schemas/Invite"}}},"required":["invites"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space/invites/{invite_id}":{"delete":{"operationId":"invite_revoke","tags":["Members"],"summary":"Revoke an open invite","description":"Owners only. The code stops working.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","maxLength":64},"required":true,"name":"invite_id","in":"path"}],"responses":{"200":{"description":"Revoked","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"string"}},"required":["revoked"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/invites/accept":{"post":{"operationId":"invite_accept","tags":["Members"],"summary":"Join a space with an invite code","description":"No key needed: this is how an invited agent gets its own. Returns that key once. Rate limited per IP address.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteAccept"}}}},"responses":{"201":{"description":"Joined","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptedInvite"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/space/embeddings":{"get":{"operationId":"embedding_settings_get","tags":["Space"],"summary":"Show which embeddings this space uses","description":"Never returns the key, only its last four characters and whether OpenAI still accepts it.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"The settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingSettings"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"operationId":"embedding_key_set","tags":["Space"],"summary":"Use your own OpenAI key for this space's embeddings","description":"Checks the key with one small call to OpenAI, then stores it encrypted. Owners only. It can only be opened by a request made with a member's own key, and no endpoint returns it. Every member's recall uses it. Use a key from a separate project with a hard spend limit. Facts are re-embedded over your next requests. From then on your facts and recall questions are sent to OpenAI under your account.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingKeyInput"}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingSettings"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"embedding_key_delete","tags":["Space"],"summary":"Remove your OpenAI key","description":"Owners only. Deletes the encrypted key for good and goes back to the server's default embeddings. Your facts are re-embedded. Also revoke the key at OpenAI if you think it leaked.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"Removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingSettings"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/context":{"get":{"operationId":"context_get","tags":["Context"],"summary":"Everything an agent needs at the start of a run, in one call","description":"Core profile (bounded), due and open records, pending actions, recent journal days, the latest weekly digest, and selected KV namespaces.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"integer","minimum":200,"maximum":20000,"default":4000},"required":false,"name":"budget_chars","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"maximum":31,"default":7},"required":false,"name":"journal_days","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"maximum":90,"default":7},"required":false,"name":"due_within_days","in":"query"},{"schema":{"type":"string","maxLength":500,"description":"Comma-separated KV namespaces to include, e.g. settings,cursors."},"required":false,"description":"Comma-separated KV namespaces to include, e.g. settings,cursors.","name":"kv","in":"query"},{"schema":{"type":"string","maxLength":500,"description":"Comma-separated record collections, limiting due and open_records. Default: all."},"required":false,"description":"Comma-separated record collections, limiting due and open_records. Default: all.","name":"collections","in":"query"},{"schema":{"type":"integer","nullable":true,"minimum":0,"maximum":50,"description":"Most open_records to return, soonest due first. Default: 20 across all collections, or 50 if you name collections. 0 leaves them out."},"required":false,"description":"Most open_records to return, soonest due first. Default: 20 across all collections, or 50 if you name collections. 0 leaves them out.","name":"open_limit","in":"query"}],"responses":{"200":{"description":"Context","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Context"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/batch":{"post":{"operationId":"batch_apply","tags":["Context"],"summary":"Apply several writes atomically","description":"All ops succeed or none do. Version and status checks abort the whole batch with 409, and error.details.op_index says which op failed when that can be told. Ops that read first (record.update, journal merge, action.propose) see the state from before the batch.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchInput"}}}},"responses":{"200":{"description":"One result per op, in order","content":{"application/json":{"schema":{"type":"object","properties":{"results":{"type":"array","items":{"nullable":true}}},"required":["results"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories/extract":{"post":{"operationId":"memory_extract_job","tags":["Memories"],"summary":"Remember from a conversation: get a job for your model","description":"Returns instructions, the related facts already stored, and an output schema. Run them with your own model, then submit its JSON to /v1/memories/extract/result. The server uses no model of its own for this and does not store the conversation.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractInput"}}}},"responses":{"200":{"description":"The job","content":{"application/json":{"schema":{"type":"object","properties":{"instructions":{"type":"string"},"input":{"type":"object","additionalProperties":{"nullable":true}},"output_schema":{"type":"object","additionalProperties":{"nullable":true}},"max_facts":{"type":"integer"}},"required":["instructions","input","output_schema","max_facts"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories/extract/result":{"post":{"operationId":"memory_extract_submit","tags":["Memories"],"summary":"Remember from a conversation: submit your model's facts","description":"Stores the facts in one transaction. A fact with `replaces` hides the older fact right away; the next dream removes it, and until then PATCH expires_at to null brings it back. Pinned facts are never replaced, and only a fact the person stated can replace another fact the person stated.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResult"}}}},"responses":{"200":{"description":"What was stored","content":{"application/json":{"schema":{"type":"object","properties":{"stored":{"type":"array","items":{"type":"object","properties":{"memory":{"$ref":"#/components/schemas/Memory"},"created":{"type":"boolean"},"replaces":{"type":"string","nullable":true}},"required":["memory","created","replaces"]}},"skipped":{"type":"array","items":{"type":"string"}}},"required":["stored","skipped"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories/import":{"post":{"operationId":"memory_import","tags":["Memories"],"summary":"Import many facts at once","description":"Up to 500 facts per call, as `facts` or as `text` with one fact per line (a ChatGPT or Claude memory list pasted as it is). Stored in one transaction with origin user, tagged imported and the source, with source_ref import:<source>. Facts already stored are skipped. Found by their words at once and by meaning within minutes.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportInput"}}}},"responses":{"200":{"description":"Imported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResult"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories":{"post":{"operationId":"memory_remember","tags":["Memories"],"summary":"Remember a fact","description":"An identical fact (same subject and text) is returned instead of stored twice.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryInput"}}}},"responses":{"200":{"description":"Already known","content":{"application/json":{"schema":{"type":"object","properties":{"memory":{"$ref":"#/components/schemas/Memory"},"created":{"type":"boolean"}},"required":["memory","created"]}}}},"201":{"description":"Stored","content":{"application/json":{"schema":{"type":"object","properties":{"memory":{"$ref":"#/components/schemas/Memory"},"created":{"type":"boolean"}},"required":["memory","created"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"memory_recall","tags":["Memories"],"summary":"Recall facts by words, meaning, subject, tier, or tag","description":"With q, finds facts that share its words (accent- and case-insensitive, prefix matching) or its meaning, best first. Meaning search falls back to words only when it is off or over its daily budget; `search` says what ran. A new or changed fact takes a few minutes to become findable by meaning, and `search.indexing` counts the ones that may not be yet. A q with no letters or digits finds nothing. Without q, lists every stored fact, pinned and core first, with `total` and `next_cursor` for the next page. Listing everything does not count as a recall.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","maxLength":500,"description":"What to look for, in words or as a question. Finds facts sharing its words or its meaning."},"required":false,"description":"What to look for, in words or as a question. Finds facts sharing its words or its meaning.","name":"q","in":"query"},{"schema":{"$ref":"#/components/schemas/RecallMode"},"required":false,"description":"hybrid (default) = words and meaning together; keyword = words only (best for names, ids, exact terms); semantic = meaning only.","name":"mode","in":"query"},{"schema":{"$ref":"#/components/schemas/Tier"},"required":false,"name":"tier","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"subject","in":"query"},{"schema":{"type":"string","maxLength":50},"required":false,"name":"tag","in":"query"},{"schema":{"type":"string","maxLength":64,"description":"Only facts this member wrote: a member id (mb_...) or 'me'."},"required":false,"description":"Only facts this member wrote: a member id (mb_...) or 'me'.","name":"author","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}],"description":"true: only pinned facts. false: only facts that aren't pinned."},"required":false,"description":"true: only pinned facts. false: only facts that aren't pinned.","name":"pinned","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","description":"Without q: the next_cursor from the previous page."},"required":false,"description":"Without q: the next_cursor from the previous page.","name":"cursor","in":"query"},{"schema":{"anyOf":[{"type":"boolean"},{"type":"string","enum":["true","false"]}],"default":true,"description":"Count this as a recall (feeds dreaming's promotion step)."},"required":false,"description":"Count this as a recall (feeds dreaming's promotion step).","name":"touch","in":"query"}],"responses":{"200":{"description":"Matching facts","content":{"application/json":{"schema":{"type":"object","properties":{"memories":{"type":"array","items":{"$ref":"#/components/schemas/Memory"}},"search":{"$ref":"#/components/schemas/RecallSearch"},"total":{"type":"integer","description":"Without q: how many facts match."},"next_cursor":{"type":"string","nullable":true,"description":"Without q: pass as cursor for the next page."}},"required":["memories","search"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories/{id}":{"get":{"operationId":"memory_get","tags":["Memories"],"summary":"Get one fact","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The fact","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"memory_update","tags":["Memories"],"summary":"Change a fact","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryPatch"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"memory_delete","tags":["Memories"],"summary":"Delete one fact","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string"}},"required":["deleted"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/forget":{"post":{"operationId":"memory_forget","tags":["Memories"],"summary":"Forget: remove matching facts, records, journal text, actions, KV values, and events","description":"Looks only in the scopes you list, and the default is memories alone: not_searched names the rest. Facts match when they contain ALL the words in query, as whole words. Everything else matches the exact phrase, ignoring case and accents. Facts, records, KV values, and events are deleted. Journal entries are redacted by default. Actions are always redacted, and any that could still run are superseded. Use dry_run to preview. If truncated is true, run it again. Leaves content-free tombstones.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgetInput"}}}},"responses":{"200":{"description":"What was (or would be) forgotten","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgetResult"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/journal/{date}":{"put":{"operationId":"journal_put","tags":["Journal"],"summary":"Write the journal entry for a date","description":"One entry per date and kind. merge=true appends to an existing entry instead of replacing it.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":true,"name":"date","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalInput"}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JournalEntry"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/journal":{"get":{"operationId":"journal_list","tags":["Journal"],"summary":"List journal entries, newest first","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":false,"name":"from","in":"query"},{"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"required":false,"name":"to","in":"query"},{"schema":{"type":"string","enum":["day","week"]},"required":false,"name":"kind","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":31},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Entries","content":{"application/json":{"schema":{"type":"object","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/JournalEntry"}}},"required":["entries"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{collection}/records":{"post":{"operationId":"record_put","tags":["Records"],"summary":"Create a record, or update the one with the same key","description":"On an update by key, fields you send replace the old values and fields you leave out keep them. data is replaced whole; to change single fields, use record_update.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Collection name, e.g. commitments, goals, routines."},"required":true,"description":"Collection name, e.g. commitments, goals, routines.","name":"collection","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordInput"}}}},"responses":{"200":{"description":"Updated by key","content":{"application/json":{"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/Record"},"created":{"type":"boolean"}},"required":["record","created"]}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"record":{"$ref":"#/components/schemas/Record"},"created":{"type":"boolean"}},"required":["record","created"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"record_query","tags":["Records"],"summary":"Query records by status, key, or due date","description":"Ordered by due date (undated last), then creation. Page with next_cursor.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Collection name, e.g. commitments, goals, routines."},"required":true,"description":"Collection name, e.g. commitments, goals, routines.","name":"collection","in":"path"},{"schema":{"type":"string","maxLength":200,"description":"Comma-separated statuses."},"required":false,"description":"Comma-separated statuses.","name":"status","in":"query"},{"schema":{"type":"string","maxLength":200},"required":false,"name":"key","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"due_before","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"}],"responses":{"200":{"description":"Records","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"next_cursor":{"type":"string","nullable":true}},"required":["records","next_cursor"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{collection}/records/{id}":{"get":{"operationId":"record_get","tags":["Records"],"summary":"Get one record","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Collection name, e.g. commitments, goals, routines."},"required":true,"description":"Collection name, e.g. commitments, goals, routines.","name":"collection","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The record","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"record_update","tags":["Records"],"summary":"Update a record (compare-and-set with expected_version)","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Collection name, e.g. commitments, goals, routines."},"required":true,"description":"Collection name, e.g. commitments, goals, routines.","name":"collection","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordPatch"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"record_delete","tags":["Records"],"summary":"Delete a record","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Collection name, e.g. commitments, goals, routines."},"required":true,"description":"Collection name, e.g. commitments, goals, routines.","name":"collection","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"string"}},"required":["deleted"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/actions":{"post":{"operationId":"action_propose","tags":["Actions"],"summary":"Propose an action that needs approval","description":"Gets a short id (A1, A2, ...) and status 'pending'. Reusing an idempotency_key with the same payload returns the existing action, in whatever status it is now, including denied; with a different payload it is a 409. To ask again after a denial, use a new key.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionInput"}}}},"responses":{"200":{"description":"Already proposed with this key","content":{"application/json":{"schema":{"type":"object","properties":{"action":{"$ref":"#/components/schemas/Action"},"created":{"type":"boolean"}},"required":["action","created"]}}}},"201":{"description":"Proposed","content":{"application/json":{"schema":{"type":"object","properties":{"action":{"$ref":"#/components/schemas/Action"},"created":{"type":"boolean"}},"required":["action","created"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"action_list","tags":["Actions"],"summary":"List actions, newest first (default: open ones)","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","maxLength":200,"description":"Comma-separated statuses. Default: pending,approved,executing."},"required":false,"description":"Comma-separated statuses. Default: pending,approved,executing.","name":"status","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Actions","content":{"application/json":{"schema":{"type":"object","properties":{"actions":{"type":"array","items":{"$ref":"#/components/schemas/Action"}}},"required":["actions"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/actions/{id}":{"get":{"operationId":"action_get","tags":["Actions"],"summary":"Get one action","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":32,"description":"Short action id, e.g. A7"},"required":true,"description":"Short action id, e.g. A7","name":"id","in":"path"}],"responses":{"200":{"description":"The action","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"action_update","tags":["Actions"],"summary":"Change an action's meta","description":"Merges into meta, in any status, for example to keep a chat message id with the action. Set a field to null to remove it. Nothing else can be changed: what the owner approved stays as it was.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":32,"description":"Short action id, e.g. A7"},"required":true,"description":"Short action id, e.g. A7","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionPatch"}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/actions/{id}/transition":{"post":{"operationId":"action_transition","tags":["Actions"],"summary":"Move an action to a new status, only if it is still in `from`","description":"Compare-and-set: two callers cannot both move A7 from approved to executing. Allowed: pending→approved|executing|denied|expired|superseded|blocked, approved→executing|denied|expired|superseded, executing→done|failed, blocked→pending|denied|superseded, failed→pending. Expired actions cannot be approved or executed.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":32,"description":"Short action id, e.g. A7"},"required":true,"description":"Short action id, e.g. A7","name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionTransition"}}}},"responses":{"200":{"description":"Moved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Action"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/kv/{ns}":{"get":{"operationId":"kv_list","tags":["KV"],"summary":"List keys in a namespace","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Namespace, e.g. settings or cursors. Names starting with '_' are reserved."},"required":true,"description":"Namespace, e.g. settings or cursors. Names starting with '_' are reserved.","name":"ns","in":"path"}],"responses":{"200":{"description":"Items","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/KvItem"}}},"required":["items"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/kv/{ns}/{key}":{"get":{"operationId":"kv_get","tags":["KV"],"summary":"Get one value","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Namespace, e.g. settings or cursors. Names starting with '_' are reserved."},"required":true,"description":"Namespace, e.g. settings or cursors. Names starting with '_' are reserved.","name":"ns","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"The value","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KvItem"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"operationId":"kv_set","tags":["KV"],"summary":"Set a value (optionally compare-and-set)","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Namespace, e.g. settings or cursors. Names starting with '_' are reserved."},"required":true,"description":"Namespace, e.g. settings or cursors. Names starting with '_' are reserved.","name":"ns","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"key","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KvInput"}}}},"responses":{"200":{"description":"Saved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KvItem"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"kv_delete","tags":["KV"],"summary":"Delete a value","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64,"pattern":"^[A-Za-z0-9][A-Za-z0-9_.-]*$","description":"Namespace, e.g. settings or cursors. Names starting with '_' are reserved."},"required":true,"description":"Namespace, e.g. settings or cursors. Names starting with '_' are reserved.","name":"ns","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"key","in":"path"}],"responses":{"200":{"description":"deleted is false if it did not exist","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean"}},"required":["deleted"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/events":{"post":{"operationId":"event_append","tags":["Events"],"summary":"Append to the event log","description":"Capped per space; the oldest events are dropped first. Keep message bodies and secrets out of detail.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventInput"}}}},"responses":{"201":{"description":"Appended","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"event_list","tags":["Events"],"summary":"List events, newest first","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","maxLength":64},"required":false,"name":"kind","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"since","in":"query"},{"schema":{"type":"integer","nullable":true},"required":false,"name":"before_id","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Events","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}},"required":["events"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/activity":{"get":{"operationId":"activity_list","tags":["Events"],"summary":"Who did what, newest first","description":"One row per write, import, forget, and member or invite change: the member, the op, and the item's id. Never text. Kept 30 days, at most 5,000 rows per space. Forgetting an item removes its rows.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","maxLength":64,"description":"Only what this member did: a member id or 'me'."},"required":false,"description":"Only what this member did: a member id or 'me'.","name":"member","in":"query"},{"schema":{"type":"string","maxLength":64,"description":"An op (memory.remember, action.approved, ...) or a prefix without a dot (memory, action, member)."},"required":false,"description":"An op (memory.remember, action.approved, ...) or a prefix without a dot (memory, action, member).","name":"op","in":"query"},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"since","in":"query"},{"schema":{"type":"integer","nullable":true,"description":"Pass next_before_id for the next page."},"required":false,"description":"Pass next_before_id for the next page.","name":"before_id","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":200,"default":50},"required":false,"name":"limit","in":"query"}],"responses":{"200":{"description":"Activity","content":{"application/json":{"schema":{"type":"object","properties":{"activity":{"type":"array","items":{"$ref":"#/components/schemas/Activity"}},"next_before_id":{"type":"integer","nullable":true,"description":"Pass as before_id for older rows; null at the end."}},"required":["activity","next_before_id"]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/dream":{"post":{"operationId":"dream_start","tags":["Dreaming"],"summary":"Start a dream now","description":"Runs housekeeping (expired, stale, and duplicate facts; expired actions and KV) immediately. Then, in client mode, waits for you to fetch the job and submit your model's result; in server mode, runs the model here.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"mode":{"$ref":"#/components/schemas/DreamMode"}}}}}},"responses":{"200":{"description":"The run","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DreamRun"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/dream/runs":{"get":{"operationId":"dream_runs","tags":["Dreaming"],"summary":"List recent dream runs and their reports","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"responses":{"200":{"description":"Runs","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/DreamRun"}}},"required":["runs"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/dream/runs/{id}/undo":{"post":{"operationId":"dream_undo","tags":["Dreaming"],"summary":"Undo every change a dream run made","description":"Available for 7 days after the run.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"Undone","content":{"application/json":{"schema":{"type":"object","properties":{"run_id":{"type":"string"},"reverted":{"type":"number"}},"required":["run_id","reverted"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/dream/jobs/next":{"get":{"operationId":"dream_job_next","tags":["Dreaming"],"summary":"Client-mode dreaming: get the job for your model","description":"Returns the waiting job, or null. With start_if_due=true, starts a dream first when the last one is older than the dream interval. Call it from a nightly run, give instructions + input to your model, and submit the JSON it returns.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"start_if_due","in":"query"}],"responses":{"200":{"description":"The job, if any","content":{"application/json":{"schema":{"type":"object","properties":{"job":{"$ref":"#/components/schemas/DreamJob"},"due":{"type":"boolean"}},"required":["job","due"]}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/dream/jobs/{id}/result":{"post":{"operationId":"dream_job_submit","tags":["Dreaming"],"summary":"Client-mode dreaming: submit your model's result","description":"Validated against the job's output schema and applied under the safety rules: pinned and user-stated facts are never rewritten or removed, and at most max_changes are applied. Every change can be undone.","security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":64},"required":true,"name":"id","in":"path"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DreamResult"}}}},"responses":{"200":{"description":"Applied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DreamRun"}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown space key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"Only an owner of the space can do this","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Conflict: version or status precondition failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Quota exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}