{"openapi":"3.1.0","info":{"title":"empremta","version":"0.1.0","summary":"Long-term memory for assistants.","description":"Every call is scoped to one person of one product: the product comes from the API key, the person from `subject` in the body (never in the URL). Writing never waits for a model: messages and items are stored and queued. Read with `/v1/context` (once per turn, into the system prompt) and `/v1/tools/{name}` (the tools the model asks for). The same memory is exposed over MCP at `/mcp`.","license":{"name":"BUSL-1.1 (server), MIT (SDK)"}},"servers":[{"url":"/","description":"Your empremta service"}],"security":[{"productKey":[]}],"components":{"securitySchemes":{"productKey":{"type":"http","scheme":"bearer","description":"Product API key `emp_…`: it reads any person of the product, so it stays on the product’s server."},"personToken":{"type":"http","scheme":"bearer","description":"Person token `emps_…`: one person, only valid at `/mcp`."}},"responses":{"Error":{"description":"Error: `{ \"error\": { \"code\", \"message\" } }`. 400 invalid, 401 bad key, 404 not found, 413 body too large, 429 rate or monthly limit (with `retry-after` when it is the rate).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}},"required":["error"]}}}}}},"tags":[{"name":"Memory","description":"Write what was said and what arrived, and read it back: the context for each turn, the search, the tools of the loop."},{"name":"Privacy","description":"The rights of a person over their memory: everything about them, and erasing it for good."},{"name":"Person tokens","description":"A token for one person (`emps_…`), so they can connect their own MCP client to their memory and nothing else."},{"name":"Integrations","description":"Only for products with the `personal` schema, and only when the server has `EMPREMTA_SECRETS_KEY` and `EMPREMTA_PUBLIC_URL`: the service itself runs a Telegram bot per product and reads Gmail, Calendar and Drive for the people who connect them. Secrets go in and never come out."},{"name":"Product","description":"For whoever runs the product: its people, what was used, the request log, keys and settings."}],"paths":{"/v1/tools":{"get":{"summary":"Schema, guide and tools","description":"The product's schema, the memory guide for the system prompt, the tool declarations and the tool-loop limits.","tags":["Memory"],"operationId":"getTools","responses":{"200":{"description":"JSON. Shape: `ToolsInfo` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/messages":{"post":{"summary":"Append messages","description":"Append messages of a conversation (up to 200 per call). Returns at once: extraction runs in the background queue. A message with an `externalId` already stored is not stored twice.","tags":["Memory"],"operationId":"postMessages","responses":{"200":{"description":"JSON. Shape: `{ conversationId: string; messageIds: string[] }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"locale":{"type":"string","minLength":2,"maxLength":35},"timezone":{"type":"string","minLength":1,"maxLength":64},"displayName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"kind":{"type":"string","enum":["person","account"]},"account":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"displayName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]}},"required":["externalId"],"additionalProperties":false}},"required":["externalId"],"additionalProperties":false},"conversation":{"type":"object","properties":{"id":{"type":"string","maxLength":64},"externalId":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","maxLength":300}},"additionalProperties":false},"messages":{"minItems":1,"maxItems":200,"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["user","assistant","agent"]},"text":{"type":"string","maxLength":100000},"author":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"meta":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"externalId":{"anyOf":[{"type":"string","minLength":1,"maxLength":200},{"type":"null"}]}},"required":["role","text"],"additionalProperties":false}}},"required":["subject","messages"],"additionalProperties":false}}}}}},"/v1/items":{"post":{"summary":"Store an item","description":"Store an email, event, task, ticket, document, note or code-index entry, with versions: `201` new, `200` unchanged.","tags":["Memory"],"operationId":"postItems","responses":{"200":{"description":"JSON. Shape: `ItemResult` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"locale":{"type":"string","minLength":2,"maxLength":35},"timezone":{"type":"string","minLength":1,"maxLength":64},"displayName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"kind":{"type":"string","enum":["person","account"]},"account":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"displayName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]}},"required":["externalId"],"additionalProperties":false}},"required":["externalId"],"additionalProperties":false},"item":{"type":"object","properties":{"externalId":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"kind":{"type":"string","enum":["email","event","task","ticket","document","note","code"]},"title":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}]},"body":{"type":"string","maxLength":500000},"author":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}]},"participants":{"maxItems":200,"type":"array","items":{"type":"string","maxLength":300}},"occurredAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},"startsAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"endsAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"dueAt":{"anyOf":[{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"},{"type":"null"}]},"status":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}]},"meta":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["kind"],"additionalProperties":false}},"required":["subject","item"],"additionalProperties":false}}}}}},"/v1/context":{"post":{"summary":"Context for a turn","description":"The memory context for this turn, to put in the system prompt (`text`, `blocks`, `history`).","tags":["Memory"],"operationId":"postContext","responses":{"200":{"description":"JSON. Shape: `ContextResult` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"locale":{"type":"string","minLength":2,"maxLength":35},"timezone":{"type":"string","minLength":1,"maxLength":64},"displayName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"kind":{"type":"string","enum":["person","account"]},"account":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"displayName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]}},"required":["externalId"],"additionalProperties":false}},"required":["externalId"],"additionalProperties":false},"conversation":{"type":"object","properties":{"id":{"type":"string","maxLength":64},"externalId":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","maxLength":300}},"additionalProperties":false},"query":{"type":"string","maxLength":20000},"seed":{"type":"boolean"}},"required":["subject"],"additionalProperties":false}}}}}},"/v1/recall":{"post":{"summary":"Search the memory","description":"Direct search over everything remembered (`query`, `from`, `to`, `limit`, `fact`); `code: true` searches the code index; `relevant: true` drops what is beside the point.","tags":["Memory"],"operationId":"postRecall","responses":{"200":{"description":"JSON. Shape: `RecallResult` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false},"query":{"type":"string","minLength":1,"maxLength":2000},"from":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"to":{"type":"string","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"limit":{"type":"integer","minimum":1,"maximum":20},"fact":{"type":"string","maxLength":200},"code":{"type":"boolean"},"relevant":{"type":"boolean"},"conversation":{"type":"object","properties":{"id":{"type":"string","maxLength":64},"externalId":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","maxLength":300},"whole":{"type":"boolean"}},"additionalProperties":false}},"required":["subject","query"],"additionalProperties":false}}}}}},"/v1/tools/{name}":{"post":{"summary":"Run a memory tool","description":"Run one memory tool with `args`, as the model asked for it in the product’s tool loop. An invalid argument comes back as `error` in the result.","tags":["Memory"],"operationId":"postToolsName","responses":{"200":{"description":"JSON. Shape: `{ result: unknown; hits: number }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false},"args":{"default":{},"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["subject"],"additionalProperties":false}}}},"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"},"description":"Tool name, from `GET /v1/tools`"}]}},"/v1/facts":{"post":{"summary":"Facts and history","description":"Current facts and their history.","tags":["Memory"],"operationId":"postFacts","responses":{"200":{"description":"JSON. Shape: `{ current: Fact[]; history: Fact[] }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false}},"required":["subject"],"additionalProperties":false}}}}}},"/v1/facts/forget":{"post":{"summary":"Forget a fact","description":"“Forget this”: a fact stops being current and stops showing in the context. It is not deleted: it stays in the history and the export.","tags":["Memory"],"operationId":"postFactsForget","responses":{"200":{"description":"JSON. Shape: `{ forgotten: string }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false},"id":{"type":"string","minLength":1,"maxLength":64}},"required":["subject","id"],"additionalProperties":false}}}}}},"/v1/export":{"post":{"summary":"Export a person","description":"Everything about one person (right of access and portability).","tags":["Privacy"],"operationId":"postExport","responses":{"200":{"description":"JSON. Shape: `SubjectExport` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false}},"required":["subject"],"additionalProperties":false}}}}}},"/v1/erase":{"post":{"summary":"Erase a person","description":"Erase a person and everything theirs, and check it (`left` must be 0). Cannot be undone.","tags":["Privacy"],"operationId":"postErase","responses":{"200":{"description":"JSON. Shape: `{ erased: Record<string, number> }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false}},"required":["subject"],"additionalProperties":false}}}}}},"/v1/subject-tokens":{"post":{"summary":"Create a person token","description":"Create a person token (`emps_…`) for their own MCP client. It is shown once; only its hash is stored.","tags":["Person tokens"],"operationId":"postSubjectTokens","responses":{"200":{"description":"JSON. Shape: `{ token: string; subjectToken: SubjectToken }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"locale":{"type":"string","minLength":2,"maxLength":35},"timezone":{"type":"string","minLength":1,"maxLength":64},"displayName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"kind":{"type":"string","enum":["person","account"]},"account":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200},"displayName":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]}},"required":["externalId"],"additionalProperties":false}},"required":["externalId"],"additionalProperties":false},"label":{"type":"string","maxLength":100},"expiresInDays":{"anyOf":[{"type":"integer","minimum":1,"maximum":730},{"type":"null"}]}},"required":["subject"],"additionalProperties":false}}}}}},"/v1/subject-tokens/list":{"post":{"summary":"List a person's tokens","description":"A person's tokens, revoked and expired ones too; never the token itself.","tags":["Person tokens"],"operationId":"postSubjectTokensList","responses":{"200":{"description":"JSON. Shape: `{ tokens: SubjectToken[] }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false}},"required":["subject"],"additionalProperties":false}}}}}},"/v1/subject-tokens/revoke":{"post":{"summary":"Revoke a person token","description":"Revoke a person token for good.","tags":["Person tokens"],"operationId":"postSubjectTokensRevoke","responses":{"200":{"description":"JSON. Shape: `{ subjectToken: SubjectToken }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false},"id":{"type":"string","minLength":1,"maxLength":64}},"required":["subject","id"],"additionalProperties":false}}}}}},"/v1/usage":{"get":{"summary":"Usage and limits","description":"What the product has used and its limits, per UTC day (by default, the current month).","tags":["Product"],"operationId":"getUsage","responses":{"200":{"description":"JSON. Shape: `Usage` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string"},"description":"First day, `YYYY-MM-DD`"},{"name":"to","in":"query","required":false,"schema":{"type":"string"},"description":"Last day, `YYYY-MM-DD`"}]}},"/v1/subjects":{"get":{"summary":"List people","description":"The product's people, newest first, with counts of what is stored for each.","tags":["Product"],"operationId":"getSubjects","responses":{"200":{"description":"JSON. Shape: `SubjectList` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"Page size"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"},"description":"Offset"}]}},"/v1/browse":{"post":{"summary":"Browse a memory","description":"A part of a person's stored memory, to look at it (`what`: overview, facts, episodes, items, conversations, graph…). Never vectors, never retired versions.","tags":["Product"],"operationId":"postBrowse","responses":{"200":{"description":"JSON. Shape: `BrowseRequest (the answer depends on `what`)` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false},"what":{"type":"string","enum":["overview","episodes","items","item","conversations","messages","graph"]},"category":{"type":"string","minLength":1,"maxLength":60},"code":{"type":"boolean"},"kinds":{"maxItems":7,"type":"array","items":{"type":"string","enum":["email","event","task","ticket","document","note","code"]}},"title":{"type":"string","maxLength":200},"id":{"type":"string","maxLength":80},"limit":{"type":"integer","minimum":1,"maximum":2000},"offset":{"type":"integer","minimum":0,"maximum":1000000},"beforeSeq":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["subject","what"],"additionalProperties":false}}}}}},"/v1/requests":{"get":{"summary":"Request log","description":"The product's request log: the requested page and the period's figures by kind and by day. Never anyone's text.","tags":["Product"],"operationId":"getRequests","responses":{"200":{"description":"JSON. Shape: `RequestLog` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":100000}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":100000}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"maximum":100000}},{"name":"kind","in":"query","required":false,"schema":{"type":"string","pattern":"^[a-z][a-z0-9_.:-]{0,59}$"}},{"name":"outcome","in":"query","required":false,"schema":{"type":"string","enum":["ok","error"]}}]}},"/v1/agents":{"get":{"summary":"Keys and tokens","description":"The product's keys (never their value) and person tokens, with what they did in the last 30 days.","tags":["Product"],"operationId":"getAgents","responses":{"200":{"description":"JSON. Shape: `Agents` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/integrations":{"get":{"summary":"Integration status","description":"Whether integrations are on (and what the server is missing), the Telegram bot name and the Google client id, and the redirect URI to register in Google Cloud. Never a secret.","tags":["Integrations"],"operationId":"getIntegrations","responses":{"200":{"description":"JSON. Shape: `IntegrationsStatus` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/integrations/telegram":{"post":{"summary":"Set the Telegram bot","description":"Set the product's Telegram bot (`token` from @BotFather). It is checked with Telegram first and stored encrypted.","tags":["Integrations"],"operationId":"postIntegrationsTelegram","responses":{"200":{"description":"JSON. Shape: `{ telegram: { configured: true; username: string } }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string","minLength":1,"maxLength":200}},"required":["token"],"additionalProperties":false}}}}}},"/v1/integrations/telegram/remove":{"post":{"summary":"Remove the Telegram bot","description":"Remove the bot: the service stops polling it. The people linked to it stay linked if it is set again.","tags":["Integrations"],"operationId":"postIntegrationsTelegramRemove","responses":{"200":{"description":"JSON. Shape: `{ removed: boolean }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/integrations/google":{"post":{"summary":"Set the Google credential","description":"Set the OAuth web client of the product (`clientId`, `clientSecret`), whose redirect URI is the one `GET /v1/integrations` gives. The secret is stored encrypted.","tags":["Integrations"],"operationId":"postIntegrationsGoogle","responses":{"200":{"description":"JSON. Shape: `{ google: { configured: true; clientId: string; redirectUri: string } }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"clientId":{"type":"string","minLength":10,"maxLength":300},"clientSecret":{"type":"string","minLength":6,"maxLength":300}},"required":["clientId","clientSecret"],"additionalProperties":false}}}}}},"/v1/integrations/google/remove":{"post":{"summary":"Remove the Google credential","description":"Remove the Google credential: the connections of each person stop syncing.","tags":["Integrations"],"operationId":"postIntegrationsGoogleRemove","responses":{"200":{"description":"JSON. Shape: `{ removed: boolean }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}}}},"/v1/connections":{"post":{"summary":"A person's connections","description":"What a person has connected (Telegram, Google), with its status, account, last sync and last error.","tags":["Integrations"],"operationId":"postConnections","responses":{"200":{"description":"JSON. Shape: `{ connections: Connection[] }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false}},"required":["subject"],"additionalProperties":false}}}}}},"/v1/connections/telegram/link":{"post":{"summary":"Link to the Telegram bot","description":"A one-time link (15 minutes) that opens the bot and links that Telegram chat to the person.","tags":["Integrations"],"operationId":"postConnectionsTelegramLink","responses":{"200":{"description":"JSON. Shape: `{ url: string; expiresAt: string }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false}},"required":["subject"],"additionalProperties":false}}}}}},"/v1/connections/google/start":{"post":{"summary":"Connect Google","description":"The Google consent link (10 minutes, read-only) for the chosen `sources`: gmail, calendar, drive. Whoever completes it connects their Google account to that memory.","tags":["Integrations"],"operationId":"postConnectionsGoogleStart","responses":{"200":{"description":"JSON. Shape: `{ url: string; expiresAt: string }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false},"sources":{"minItems":1,"maxItems":3,"type":"array","items":{"type":"string","enum":["gmail","calendar","drive"]}}},"required":["subject","sources"],"additionalProperties":false}}}}}},"/v1/connections/disconnect":{"post":{"summary":"Disconnect","description":"Stop a connection and delete its secret. What was already stored stays.","tags":["Integrations"],"operationId":"postConnectionsDisconnect","responses":{"200":{"description":"JSON. Shape: `{ connection: Connection }` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"subject":{"type":"object","properties":{"externalId":{"type":"string","minLength":1,"maxLength":200}},"required":["externalId"],"additionalProperties":false},"kind":{"type":"string","enum":["telegram","google"]}},"required":["subject","kind"],"additionalProperties":false}}}}}},"/v1/settings":{"get":{"summary":"Settings","description":"How the product is configured: schema, models, similarity floor, limits and log retention.","tags":["Product"],"operationId":"getSettings","responses":{"200":{"description":"JSON. Shape: `Settings` in the TypeScript SDK (`@empremta/sdk`, `types.ts`).","content":{"application/json":{"schema":{"type":"object"}}}},"default":{"$ref":"#/components/responses/Error"}}}}}}