{"openapi":"3.1.0","info":{"title":"rentfree","version":"0.0.2","summary":"Memory for AI agents.","description":"Agents log what they see and what they are given; rentfree turns it into searchable, attributable memories and hands back the context for the next turn, within a token budget. Every request under /v1 carries an API key as a bearer. Every POST under /v1 that writes takes an Idempotency-Key header."},"servers":[{"url":"https://api.rentfree.dev/api"}],"tags":[{"name":"memories","description":"What an agent should remember."},{"name":"recall","description":"Search and the context pack."},{"name":"sessions","description":"Logging what happens, as it happens."},{"name":"sources","description":"Documents, URLs, and files."},{"name":"recap","description":"Turning events into memories."},{"name":"account","description":"Collections, agents, and keys."},{"name":"login","description":"The browser login the CLI runs."},{"name":"meta","description":"Liveness."}],"paths":{"/health":{"get":{"operationId":"health","tags":["meta"],"summary":"Whether the api and its database are up","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"The database is unreachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/openapi.json":{"get":{"operationId":"openapi","tags":["meta"],"summary":"This document","security":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenApiDocument"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/device":{"post":{"operationId":"startLogin","tags":["login"],"summary":"Start a login; the CLI shows the code and opens the page","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginStarted"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/device/poll":{"post":{"operationId":"pollLogin","tags":["login"],"summary":"Ask whether the browser has approved; the key comes back once","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceCode":{"type":"string","minLength":1}},"required":["deviceCode"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginPoll"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`access_denied`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"410":{"description":"`device_session_expired`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`slow_down`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/device/{userCode}":{"get":{"operationId":"getLogin","tags":["login"],"summary":"What the approval page shows about a login","security":[{"session":[]}],"parameters":[{"name":"userCode","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceSession"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/auth/device/approve":{"post":{"operationId":"answerLogin","tags":["login"],"summary":"Approve or deny a login; a first approval creates the account","security":[{"session":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"userCode":{"type":"string","minLength":1,"maxLength":20},"decision":{"type":"string","enum":["approve","deny"]}},"required":["userCode","decision"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["approved","denied"]},"name":{"type":"string"}},"required":["status","name"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/me":{"get":{"operationId":"getMe","tags":["account"],"summary":"The user, the key in use, and what it can see","security":[{"apiKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateMe","tags":["account"],"summary":"Choose the embedding model, while the account has no content","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"embedModel":{"type":"string","minLength":1},"embedDimensions":{"anyOf":[{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},{"type":"null"}]}},"required":["embedModel"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`embed_model_in_use`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"deleteMe","tags":["account"],"summary":"Delete the account; every key stops at once","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"deletedAt":{"type":"string","format":"date-time"}},"required":["id","deletedAt"],"additionalProperties":false}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections":{"get":{"operationId":"listCollections","tags":["account"],"summary":"Collections; an agent sees the active ones it may read","security":[{"apiKey":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","archived"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"collections":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}}},"required":["collections"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createCollection","tags":["account"],"summary":"Make a collection","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`idempotency_key_in_progress`, `name_taken`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}":{"patch":{"operationId":"updateCollection","tags":["account"],"summary":"Rename a collection, or make it the default","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"isDefault":{"type":"boolean"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`, `name_taken`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"archiveCollection","tags":["account"],"summary":"Archive a collection: still readable, nothing new goes in","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Collection"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_default`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agents":{"get":{"operationId":"listAgents","tags":["account"],"summary":"Agents, live by default","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"status","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","revoked"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}}},"required":["agents"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createAgent","tags":["account"],"summary":"Make an agent with its permissions","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"canReadMemories":{"type":"boolean"},"canWriteMemories":{"type":"boolean"},"readCollectionIds":{"maxItems":100,"type":"array","items":{"type":"string","minLength":1}},"writeCollectionIds":{"maxItems":100,"type":"array","items":{"type":"string","minLength":1}}},"required":["name","canReadMemories","canWriteMemories","readCollectionIds","writeCollectionIds"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`idempotency_key_in_progress`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/agents/{id}":{"patch":{"operationId":"updateAgent","tags":["account"],"summary":"Change an agent's name or permissions","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"canReadMemories":{"type":"boolean"},"canWriteMemories":{"type":"boolean"},"readCollectionIds":{"maxItems":100,"type":"array","items":{"type":"string","minLength":1}},"writeCollectionIds":{"maxItems":100,"type":"array","items":{"type":"string","minLength":1}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Agent"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"revokeAgent","tags":["account"],"summary":"Revoke an agent and every key it holds","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"agent":{"$ref":"#/components/schemas/Agent"},"keysRevoked":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["agent","keysRevoked"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/keys":{"get":{"operationId":"listKeys","tags":["account"],"summary":"Keys, live by default; never the secret","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"status","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","revoked"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"$ref":"#/components/schemas/Key"}}},"required":["keys"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"createKey","tags":["account"],"summary":"Mint a key; the secret is in this answer only","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"agentId":{"type":"string","minLength":1}},"required":["name"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedKey"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`idempotency_key_in_progress`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/keys/{id}":{"delete":{"operationId":"revokeKey","tags":["account"],"summary":"Revoke a key","security":[{"apiKey":[]}],"description":"Takes a user-level key; an agent key is refused with 403.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Key"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sessions":{"post":{"operationId":"startSession","tags":["sessions"],"summary":"Start a session, or find the one with this externalId","security":[{"apiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"collectionId":{"type":"string","minLength":1},"externalId":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":500}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`, `idempotency_key_in_progress`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listSessions","tags":["sessions"],"summary":"Sessions in a collection, newest first","security":[{"apiKey":[]}],"parameters":[{"name":"collectionId","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":200}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionPage"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sessions/{id}":{"get":{"operationId":"getSession","tags":["sessions"],"summary":"One session","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateSession","tags":["sessions"],"summary":"Retitle a session, or end it, which starts a recap","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"title":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"ended":{"type":"boolean","const":true}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sessions/{id}/events":{"post":{"operationId":"logEvents","tags":["sessions"],"summary":"Log one event, or a batch of up to 100, all or none","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"events":{"minItems":1,"maxItems":100,"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["message.user","message.assistant","tool.call","tool.result","note"]},"content":{"type":"string","minLength":1,"maxLength":100000},"metadata":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["type","content"]}}},"required":["events"]},{"type":"object","properties":{"type":{"type":"string","enum":["message.user","message.assistant","tool.call","tool.result","note"]},"content":{"type":"string","minLength":1,"maxLength":100000},"metadata":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["type","content"]}]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}},"required":["events"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`, `idempotency_key_in_progress`, `session_ended`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listEvents","tags":["sessions"],"summary":"A session's events, oldest first","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventPage"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sources":{"post":{"operationId":"addSource","tags":["sources"],"summary":"Add text, a URL, or an uploaded file; under an external id the collection already has, update that source","security":[{"apiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","const":"text"},"content":{"type":"string"},"title":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"format":{"type":"string","enum":["markdown","text"]},"collectionId":{"type":"string","minLength":1},"uri":{"type":"string","minLength":1,"maxLength":2000},"externalId":{"type":"string","minLength":1,"maxLength":500},"metadata":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind","content"]},{"type":"object","properties":{"kind":{"type":"string","const":"url"},"url":{"type":"string","maxLength":2000},"title":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"collectionId":{"type":"string","minLength":1},"externalId":{"type":"string","minLength":1,"maxLength":500},"metadata":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind","url"]},{"type":"object","properties":{"kind":{"type":"string","const":"file"},"blobKey":{"type":"string","minLength":1,"maxLength":1000},"title":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"collectionId":{"type":"string","minLength":1},"externalId":{"type":"string","minLength":1,"maxLength":500},"metadata":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind","blobKey"]}]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Source"}}}},"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddedSource"}}}},"202":{"description":"Accepted; the work continues in the background","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Source"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`, `idempotency_key_in_progress`, `ingest_in_progress`, `source_kind_mismatch`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listSources","tags":["sources"],"summary":"Sources in a collection, newest first","security":[{"apiKey":[]}],"parameters":[{"name":"collectionId","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"externalId","in":"query","required":false,"schema":{"type":"string","minLength":1,"maxLength":500}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourcePage"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sources/{id}":{"get":{"operationId":"getSource","tags":["sources"],"summary":"One source, with its ingest status","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Source"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"operationId":"replaceSource","tags":["sources"],"summary":"Replace a text source; unchanged content is a no-op","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"},"title":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"format":{"type":"string","enum":["markdown","text"]}},"required":["content"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Source"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`, `not_a_text_source`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"removeSource","tags":["sources"],"summary":"Remove a source and its chunks","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"204":{"description":"Done; no body"},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sources/{id}/content":{"get":{"operationId":"getSourceContent","tags":["sources"],"summary":"A ready source's text","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"}},"required":["content"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`source_not_ready`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sources/{id}/chunks":{"get":{"operationId":"listChunks","tags":["sources"],"summary":"A source's chunks, in document order","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"level","in":"query","required":false,"schema":{"type":"string","enum":["document","section","paragraph"]}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":200}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChunkPage"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/sources/{id}/refresh":{"post":{"operationId":"refreshSource","tags":["sources"],"summary":"Fetch a URL source again","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"responses":{"202":{"description":"Accepted; the work continues in the background","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Source"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`, `idempotency_key_in_progress`, `ingest_in_progress`, `not_refreshable`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/uploads":{"post":{"operationId":"createUpload","tags":["sources"],"summary":"Get a short-lived URL to PUT a file to, before adding it","security":[{"apiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"filename":{"type":"string","minLength":1,"maxLength":255},"contentType":{"type":"string","enum":["application/pdf","text/markdown","text/plain"]},"size":{"type":"integer","minimum":1,"maximum":20971520}},"required":["filename","contentType","size"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Upload"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`idempotency_key_in_progress`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories":{"post":{"operationId":"remember","tags":["memories"],"summary":"Write a memory","security":[{"apiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"collectionId":{"type":"string","minLength":1},"type":{"type":"string","minLength":1},"tier":{"type":"string","enum":["working","long"]},"content":{"type":"string","minLength":1,"maxLength":20000},"subject":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"importance":{"type":"number","minimum":0,"maximum":1},"expiresAt":{"type":"string","format":"date-time"}},"required":["collectionId","type","tier","content"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`, `idempotency_key_in_progress`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"get":{"operationId":"listMemories","tags":["memories"],"summary":"Memories in a collection, newest first","security":[{"apiKey":[]}],"parameters":[{"name":"collectionId","in":"query","required":true,"schema":{"type":"string","minLength":1}},{"name":"status","in":"query","required":false,"schema":{"default":"active","type":"string","enum":["active","archived","expired"]}},{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryPage"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories/{id}":{"get":{"operationId":"getMemory","tags":["memories"],"summary":"One memory","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"patch":{"operationId":"updateMemory","tags":["memories"],"summary":"Correct a memory, or archive or restore it","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":20000},"subject":{"anyOf":[{"type":"string","minLength":1,"maxLength":500},{"type":"null"}]},"importance":{"type":"number","minimum":0,"maximum":1},"status":{"type":"string","enum":["active","archived"]}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`, `memory_expired`, `memory_inactive`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"archiveMemory","tags":["memories"],"summary":"Archive a memory; its history and sources stay","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories/{id}/history":{"get":{"operationId":"memoryHistory","tags":["memories"],"summary":"Every change to a memory, newest first","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"limit","in":"query","required":false,"schema":{"default":50,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/MemoryChange"}}},"required":["items"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/memories/{id}/sources":{"get":{"operationId":"memorySources","tags":["memories"],"summary":"Where a memory came from","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/MemorySource"}}},"required":["items"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/search":{"post":{"operationId":"search","tags":["recall"],"summary":"Find memories and passages by meaning and by words","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"query":{"type":"string","minLength":1,"maxLength":2000},"collectionIds":{"minItems":1,"maxItems":50,"type":"array","items":{"type":"string","minLength":1}},"kinds":{"default":["memory","chunk"],"minItems":1,"type":"array","items":{"type":"string","enum":["memory","chunk"]}},"types":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1}},"tiers":{"minItems":1,"maxItems":20,"type":"array","items":{"type":"string","minLength":1}},"asOf":{"type":"string","format":"date-time"},"limit":{"default":10,"type":"integer","minimum":1,"maximum":50}},"required":["query"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResult"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/context":{"post":{"operationId":"context","tags":["recall"],"summary":"A context pack: what an agent needs for its next turn, within a budget","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"collectionId":{"type":"string","minLength":1},"query":{"type":"string","minLength":1,"maxLength":2000},"tokenBudget":{"default":2000,"type":"integer","minimum":200,"maximum":16000}},"required":["collectionId"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextPack"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/collections/{id}/profile":{"get":{"operationId":"getProfile","tags":["recall"],"summary":"A collection's latest profile","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`collection_archived`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/recap/run":{"post":{"operationId":"runRecap","tags":["recap"],"summary":"Start a recap of the events not yet read","security":[{"apiKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"1 to 255 printable characters, remembered for 24 hours. A retry with the same key and body replays the first answer.","schema":{"type":"string","minLength":1,"maxLength":255}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecapRunAnswer"}}}},"202":{"description":"Accepted; the work continues in the background","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecapRunAnswer"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`idempotency_key_in_progress`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"`idempotency_key_reused`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/recap/runs":{"get":{"operationId":"listRecapRuns","tags":["recap"],"summary":"Recap runs, newest first","security":[{"apiKey":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"default":20,"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"runs":{"type":"array","items":{"$ref":"#/components/schemas/RecapRun"}}},"required":["runs"],"additionalProperties":false}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/recap/runs/{id}":{"get":{"operationId":"getRecapRun","tags":["recap"],"summary":"One recap run","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","minLength":1}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecapRun"}}}},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"`forbidden`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/index/status":{"get":{"operationId":"indexStatus","tags":["recall"],"summary":"How much content is still waiting to be embedded","security":[{"apiKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IndexStatus"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"`internal`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"schemas":{"AddedSource":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"kind":{"type":"string","enum":["text","url","file"]},"status":{"type":"string","enum":["pending","processing","ready","failed"]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"uri":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"type":"string","enum":["markdown","text"]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"duplicateOf":{"type":"object","properties":{"id":{"type":"string"},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","externalId","title"],"additionalProperties":false}},"required":["id","collectionId","kind","status","title","uri","externalId","format","metadata","error","version","createdAt","updatedAt"],"additionalProperties":false},"Agent":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"canReadMemories":{"type":"boolean"},"canWriteMemories":{"type":"boolean"},"readCollectionIds":{"type":"array","items":{"type":"string"}},"writeCollectionIds":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"revokedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","name","canReadMemories","canWriteMemories","readCollectionIds","writeCollectionIds","createdAt","revokedAt"],"additionalProperties":false},"Chunk":{"type":"object","properties":{"id":{"type":"string"},"parentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"level":{"type":"string","enum":["document","section","paragraph"]},"ordinal":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"headingPath":{"anyOf":[{"type":"string"},{"type":"null"}]},"contextHeader":{"anyOf":[{"type":"string"},{"type":"null"}]},"text":{"type":"string"},"tokenCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"charStart":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"charEnd":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["id","parentId","level","ordinal","headingPath","contextHeader","text","tokenCount","charStart","charEnd"],"additionalProperties":false},"ChunkHit":{"type":"object","properties":{"id":{"type":"string"},"text":{"type":"string"},"headingPath":{"anyOf":[{"type":"string"},{"type":"null"}]},"source":{"type":"object","properties":{"id":{"type":"string"},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"uri":{"anyOf":[{"type":"string"},{"type":"null"}]},"collectionId":{"type":"string"}},"required":["id","title","uri","collectionId"],"additionalProperties":false},"score":{"type":"number"},"vectorRank":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"textRank":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","text","headingPath","source","score","vectorRank","textRank"],"additionalProperties":false},"ChunkPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Chunk"}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"additionalProperties":false},"Collection":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"isDefault":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"},"archivedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","name","isDefault","createdAt","archivedAt"],"additionalProperties":false},"ContextPack":{"type":"object","properties":{"text":{"type":"string"},"tokenCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"tokenBudget":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"mode":{"type":"string","enum":["hybrid","text","importance"]},"profile":{"anyOf":[{"type":"object","properties":{"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"tokenCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"truncated":{"type":"boolean"}},"required":["version","tokenCount","truncated"],"additionalProperties":false},{"type":"null"}]},"memories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"type":{"type":"string"},"tier":{"type":"string"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"content":{"type":"string"},"importance":{"type":"number"},"validFrom":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"score":{"type":"number"},"vectorRank":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"textRank":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","collectionId","type","tier","subject","content","importance","validFrom","createdAt"],"additionalProperties":false}},"chunks":{"type":"array","items":{"$ref":"#/components/schemas/ChunkHit"}}},"required":["text","tokenCount","tokenBudget","mode","profile","memories","chunks"],"additionalProperties":false},"CreatedKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"keyPrefix":{"type":"string"},"agentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"lastUsedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"apiKey":{"type":"string"}},"required":["id","name","keyPrefix","agentId","createdAt","lastUsedAt","revokedAt","apiKey"],"additionalProperties":false},"DeviceSession":{"type":"object","properties":{"userCode":{"type":"string"},"name":{"type":"string"},"status":{"type":"string","enum":["pending","approved","denied","claimed","expired"]},"createdAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"}},"required":["userCode","name","status","createdAt","expiresAt"],"additionalProperties":false},"Error":{"type":"object","properties":{"error":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"path":{"type":"string"},"message":{"type":"string"}},"required":["path","message"],"additionalProperties":false}}},"required":["error"],"additionalProperties":false},"Event":{"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"sessionId":{"type":"string"},"agentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":{"type":"string","enum":["message.user","message.assistant","tool.call","tool.result","note"]},"content":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string","format":"date-time"}},"required":["id","sessionId","agentId","type","content","metadata","createdAt"],"additionalProperties":false},"EventPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"additionalProperties":false},"Health":{"type":"object","properties":{"ok":{"type":"boolean"},"db":{"type":"string","enum":["up","down"]}},"required":["ok","db"],"additionalProperties":false},"IndexStatus":{"type":"object","properties":{"waiting":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failed":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"oldestWaitingAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["waiting","failed","oldestWaitingAt"],"additionalProperties":false},"Key":{"type":"object","properties":{"id":{"type":"string"},"name":{"anyOf":[{"type":"string"},{"type":"null"}]},"keyPrefix":{"type":"string"},"agentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"lastUsedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"revokedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","name","keyPrefix","agentId","createdAt","lastUsedAt","revokedAt"],"additionalProperties":false},"LoginPoll":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","const":"pending"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"approved"},"apiKey":{"type":"string"},"keyPrefix":{"type":"string"},"user":{"type":"object","properties":{"id":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["id","email"],"additionalProperties":false},"defaultCollectionId":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["status","apiKey","keyPrefix","user","defaultCollectionId"],"additionalProperties":false}]},"LoginStarted":{"type":"object","properties":{"deviceCode":{"type":"string"},"userCode":{"type":"string"},"verifyUrl":{"type":"string"},"expiresIn":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"interval":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["deviceCode","userCode","verifyUrl","expiresIn","interval"],"additionalProperties":false},"Me":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/User"},"caller":{"type":"object","properties":{"agentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"apiKeyId":{"type":"string"},"keyPrefix":{"anyOf":[{"type":"string"},{"type":"null"}]},"keyName":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["agentId","apiKeyId","keyPrefix","keyName"],"additionalProperties":false},"collections":{"type":"array","items":{"$ref":"#/components/schemas/Collection"}},"agents":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}}},"required":["user","caller","collections"],"additionalProperties":false},"Memory":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"type":{"type":"string"},"tier":{"type":"string"},"origin":{"type":"string"},"status":{"type":"string","enum":["active","archived","expired"]},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"content":{"type":"string"},"confidence":{"type":"number"},"importance":{"type":"number"},"importanceNow":{"type":"number"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"validFrom":{"type":"string","format":"date-time"},"validTo":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"supersedesId":{"anyOf":[{"type":"string"},{"type":"null"}]},"accessCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"lastAccessedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"expiresAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","collectionId","type","tier","origin","status","subject","content","confidence","importance","importanceNow","version","validFrom","validTo","supersedesId","accessCount","lastAccessedAt","createdAt","updatedAt","expiresAt"],"additionalProperties":false},"MemoryChange":{"type":"object","properties":{"id":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"op":{"type":"string"},"actor":{"type":"string"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}]},"before":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"after":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"recapRunId":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","op","actor","reason","before","after","recapRunId","createdAt"],"additionalProperties":false},"MemoryHit":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"type":{"type":"string"},"tier":{"type":"string"},"subject":{"anyOf":[{"type":"string"},{"type":"null"}]},"content":{"type":"string"},"importance":{"type":"number"},"validFrom":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"},"score":{"type":"number"},"vectorRank":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"textRank":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]}},"required":["id","collectionId","type","tier","subject","content","importance","validFrom","createdAt","score","vectorRank","textRank"],"additionalProperties":false},"MemoryPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Memory"}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"additionalProperties":false},"MemorySource":{"type":"object","properties":{"sourceId":{"anyOf":[{"type":"string"},{"type":"null"}]},"chunkId":{"anyOf":[{"type":"string"},{"type":"null"}]},"eventId":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"sessionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"quote":{"anyOf":[{"type":"string"},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["sourceId","chunkId","eventId","sessionId","quote","createdAt"],"additionalProperties":false},"OpenApiDocument":{"type":"object","properties":{"openapi":{"type":"string","const":"3.1.0"},"info":{"type":"object","properties":{"title":{"type":"string"},"version":{"type":"string"}},"required":["title","version"],"additionalProperties":{}},"paths":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["openapi","info","paths"],"additionalProperties":{}},"Profile":{"type":"object","properties":{"collectionId":{"type":"string"},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"content":{"type":"string"},"tokenCount":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"generatedAt":{"type":"string","format":"date-time"}},"required":["collectionId","version","content","tokenCount","generatedAt"],"additionalProperties":false},"RecapRun":{"type":"object","properties":{"id":{"type":"string"},"trigger":{"type":"string"},"status":{"type":"string"},"eventsFromId":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"eventsToId":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"extractModel":{"anyOf":[{"type":"string"},{"type":"null"}]},"reconcileModel":{"anyOf":[{"type":"string"},{"type":"null"}]},"inputTokens":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"outputTokens":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"costUsd":{"anyOf":[{"type":"number"},{"type":"null"}]},"stats":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"type":"string","format":"date-time"},"finishedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","trigger","status","eventsFromId","eventsToId","extractModel","reconcileModel","inputTokens","outputTokens","costUsd","stats","error","startedAt","finishedAt"],"additionalProperties":false},"RecapRunAnswer":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","const":"running"},"run":{"$ref":"#/components/schemas/RecapRun"}},"required":["status","run"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"idle"}},"required":["status"],"additionalProperties":false},{"type":"object","properties":{"status":{"type":"string","const":"started"},"unread":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["status","unread"],"additionalProperties":false}]},"SearchResult":{"type":"object","properties":{"mode":{"type":"string","enum":["hybrid","text"]},"memories":{"type":"array","items":{"$ref":"#/components/schemas/MemoryHit"}},"chunks":{"type":"array","items":{"$ref":"#/components/schemas/ChunkHit"}}},"required":["mode","memories","chunks"],"additionalProperties":false},"Session":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"anyOf":[{"type":"string"},{"type":"null"}]},"agentId":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"startedAt":{"type":"string","format":"date-time"},"endedAt":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}]}},"required":["id","collectionId","agentId","externalId","title","startedAt","endedAt"],"additionalProperties":false},"SessionPage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Session"}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"additionalProperties":false},"Source":{"type":"object","properties":{"id":{"type":"string"},"collectionId":{"type":"string"},"kind":{"type":"string","enum":["text","url","file"]},"status":{"type":"string","enum":["pending","processing","ready","failed"]},"title":{"anyOf":[{"type":"string"},{"type":"null"}]},"uri":{"anyOf":[{"type":"string"},{"type":"null"}]},"externalId":{"anyOf":[{"type":"string"},{"type":"null"}]},"format":{"type":"string","enum":["markdown","text"]},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"version":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","collectionId","kind","status","title","uri","externalId","format","metadata","error","version","createdAt","updatedAt"],"additionalProperties":false},"SourcePage":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/Source"}},"nextCursor":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["items","nextCursor"],"additionalProperties":false},"Upload":{"type":"object","properties":{"blobKey":{"type":"string"},"uploadUrl":{"type":"string"},"method":{"type":"string","const":"PUT"},"headers":{"type":"object","properties":{"content-type":{"type":"string","enum":["application/pdf","text/markdown","text/plain"]}},"required":["content-type"],"additionalProperties":false},"expiresAt":{"type":"string","format":"date-time"}},"required":["blobKey","uploadUrl","method","headers","expiresAt"],"additionalProperties":false},"User":{"type":"object","properties":{"id":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"embedModel":{"type":"string"},"embedDimensions":{"anyOf":[{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time"}},"required":["id","email","embedModel","embedDimensions","createdAt"],"additionalProperties":false}},"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key: `rf_` and 43 characters."},"session":{"type":"http","scheme":"bearer","description":"A Clerk session token from the web app; only the approval page uses it."}}}}