KI-Chat
Ein Chat im Dokument mit dem eigenen Anthropic-Schlüssel des Workspace (ADR-0097): die Einstellung, die ein Admin pflegt, die eigenen Chats einer Person und eine Nachricht, deren Antwort als Strom kommt. Aus, bis ein Admin sie einschaltet, und nur mit Sitzung.
13 Operationen. Jeder Pfad ist relativ zum Ursprung der Instanz; jeder Antwortkörper ist JSON, sofern nicht anders vermerkt. Die Endpunktbeschreibungen unten stammen unverändert aus der Routentabelle des Servers und bleiben englisch. Authentifizierung, Fehler und seitenweise Abfrage stehen unter API.
GET /api/v1/workspaces/{workspaceId}/ai
Whether the workspace's AI chat is on (ADR-0097 D1, amendment 4): answers {enabled: true} while it is, {enabled: false} while it is off, and 404 outside Basalt. Every member.
getAiStatus · token scope: session only
Path parameters
workspaceId· string (uuid) · required
Response 200 · application/json
enabled· boolean · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
GET /api/v1/workspaces/{workspaceId}/ai/setting
The workspace's AI setting (ADR-0097 D1): on or off, the model, the monthly limit in US dollars, the stored key's last four characters, and what this month's chats cost so far. Admins only; 404 for everybody else.
getAiSetting · token scope: session only
Path parameters
workspaceId· string (uuid) · required
Response 200 · application/json
enabled· boolean · requiredmodel·"claude-opus-5-5"|"claude-sonnet-5-5"|"claude-haiku-5-5"· requiredmonthlyLimitUsd· number · requiredkeyHint· string | null · requiredmonthCostUsd· number · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
PUT /api/v1/workspaces/{workspaceId}/ai/setting
Change the AI setting (ADR-0097 D1). A new apiKey is checked with one small call to the model provider before it is stored sealed; a key that fails is refused with 422 ai_key_invalid. apiKey: null removes the key and turns the AI off. Turning it on needs a key. Admins only.
updateAiSetting · token scope: session only
Path parameters
workspaceId· string (uuid) · required
Request body · application/json, required
enabled· booleanapiKey· string | nullmodel·"claude-opus-5-5"|"claude-sonnet-5-5"|"claude-haiku-5-5"monthlyLimitUsd· number · −∞–10000
Response 200 · application/json
enabled· boolean · requiredmodel·"claude-opus-5-5"|"claude-sonnet-5-5"|"claude-haiku-5-5"· requiredmonthlyLimitUsd· number · requiredkeyHint· string | null · requiredmonthCostUsd· number · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
GET /api/v1/workspaces/{workspaceId}/ai/chats
The caller's own chats on a page (ADR-0097 D6), newest first. Requires read on the page and the workspace's AI on.
listAiChats · token scope: session only
Path parameters
workspaceId· string (uuid) · required
Query parameters
pageId· string (uuid) · required
Response 200 · application/json
items· object[] · requiredid· string (uuid) · requiredpageId· string (uuid) · requiredscope·"subtree"|"collection"· requiredtitle· string · requiredcostUsd· number · requiredupdatedAt· string (date-time) · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
POST /api/v1/workspaces/{workspaceId}/ai/chats
Start a chat on a page (ADR-0097 D4, D6) with the scope subtree (the page and its sub-documents, the default) or collection (the page's whole collection). The chat is the caller's alone. Requires read on the page and the workspace's AI on.
createAiChat · token scope: session only
Path parameters
workspaceId· string (uuid) · required
Request body · application/json, required
pageId· string (uuid) · requiredscope·"subtree"|"collection"
Response 200 · application/json
id· string (uuid) · requiredpageId· string (uuid) · requiredscope·"subtree"|"collection"· requiredtitle· string · requiredcostUsd· number · requiredupdatedAt· string (date-time) · requiredmessages· object[] · requiredid· string (uuid) · requiredrole·"user"|"assistant"· requiredtext· string · requiredsteps· object[] · requiredtool· string · requiredpageId· string (uuid) | null · requiredtitle· string | null · requiredok· boolean · required
status·"done"|"failed"|"stopped"· requirederror· string | null · requiredmemory· object[] · requiredid· string (uuid) · requiredpageId· string (uuid) · requiredpageTitle· string · requiredtext· string · required
costUsd· number · requiredcreatedAt· string (date-time) · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
GET /api/v1/workspaces/{workspaceId}/ai/chats/{chatId}
One of the caller's chats with its messages, oldest first: the text, the tool steps in short, the status and the cost. Somebody else's chat answers 404, for admins too.
getAiChat · token scope: session only
Path parameters
workspaceId· string (uuid) · requiredchatId· string (uuid) · required
Response 200 · application/json
id· string (uuid) · requiredpageId· string (uuid) · requiredscope·"subtree"|"collection"· requiredtitle· string · requiredcostUsd· number · requiredupdatedAt· string (date-time) · requiredmessages· object[] · requiredid· string (uuid) · requiredrole·"user"|"assistant"· requiredtext· string · requiredsteps· object[] · requiredtool· string · requiredpageId· string (uuid) | null · requiredtitle· string | null · requiredok· boolean · required
status·"done"|"failed"|"stopped"· requirederror· string | null · requiredmemory· object[] · requiredid· string (uuid) · requiredpageId· string (uuid) · requiredpageTitle· string · requiredtext· string · required
costUsd· number · requiredcreatedAt· string (date-time) · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
PATCH /api/v1/workspaces/{workspaceId}/ai/chats/{chatId}
Switch a chat's scope (ADR-0097 D4); it applies from the next message. The caller's own chats only.
updateAiChat · token scope: session only
Path parameters
workspaceId· string (uuid) · requiredchatId· string (uuid) · required
Request body · application/json, required
scope·"subtree"|"collection"· required
Response 200 · application/json
id· string (uuid) · requiredpageId· string (uuid) · requiredscope·"subtree"|"collection"· requiredtitle· string · requiredcostUsd· number · requiredupdatedAt· string (date-time) · requiredmessages· object[] · requiredid· string (uuid) · requiredrole·"user"|"assistant"· requiredtext· string · requiredsteps· object[] · requiredtool· string · requiredpageId· string (uuid) | null · requiredtitle· string | null · requiredok· boolean · required
status·"done"|"failed"|"stopped"· requirederror· string | null · requiredmemory· object[] · requiredid· string (uuid) · requiredpageId· string (uuid) · requiredpageTitle· string · requiredtext· string · required
costUsd· number · requiredcreatedAt· string (date-time) · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
DELETE /api/v1/workspaces/{workspaceId}/ai/chats/{chatId}
Delete one of the caller's chats with its messages.
deleteAiChat · token scope: session only
Path parameters
workspaceId· string (uuid) · requiredchatId· string (uuid) · required
Response 200 · application/json
ok·true· required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
GET /api/v1/workspaces/{workspaceId}/ai/memory
The memory of a page (ADR-0097 D9, D10): its own entries and those of every page above it, nearest first, each with where it comes from. The same for everybody, filtered per caller: an entry is shown only when the caller may read its page and, for an entry the agent wrote, every page it was drawn from. Requires read on the page and the workspace's AI on.
listAiMemory · token scope: session only
Path parameters
workspaceId· string (uuid) · required
Query parameters
pageId· string (uuid) · required
Response 200 · application/json
items· object[] · requiredid· string (uuid) · requiredpageId· string (uuid) · requiredpageTitle· string · requiredinherited· boolean · requiredtext· string · requiredorigin·"person"|"agent"· requiredsources· object[] · requiredid· string (uuid) · requiredtitle· string · required
canEdit· boolean · requiredupdatedAt· string (date-time) · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
POST /api/v1/workspaces/{workspaceId}/ai/memory
Add an entry to a page's memory: at most 2000 characters of Markdown. Requires edit on the page.
createAiMemory · token scope: session only
Path parameters
workspaceId· string (uuid) · required
Request body · application/json, required
pageId· string (uuid) · requiredtext· string · required, length 1–2000
Response 200 · application/json
id· string (uuid) · requiredpageId· string (uuid) · requiredpageTitle· string · requiredinherited· boolean · requiredtext· string · requiredorigin·"person"|"agent"· requiredsources· object[] · requiredid· string (uuid) · requiredtitle· string · required
canEdit· boolean · requiredupdatedAt· string (date-time) · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
PATCH /api/v1/workspaces/{workspaceId}/ai/memory/{entryId}
Change a memory entry's text. Requires edit on the page the entry is on.
updateAiMemory · token scope: session only
Path parameters
workspaceId· string (uuid) · requiredentryId· string (uuid) · required
Request body · application/json, required
text· string · required, length 1–2000
Response 200 · application/json
id· string (uuid) · requiredpageId· string (uuid) · requiredpageTitle· string · requiredinherited· boolean · requiredtext· string · requiredorigin·"person"|"agent"· requiredsources· object[] · requiredid· string (uuid) · requiredtitle· string · required
canEdit· boolean · requiredupdatedAt· string (date-time) · required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
DELETE /api/v1/workspaces/{workspaceId}/ai/memory/{entryId}
Delete a memory entry. Requires edit on the page the entry is on.
deleteAiMemory · token scope: session only
Path parameters
workspaceId· string (uuid) · requiredentryId· string (uuid) · required
Response 200 · application/json
ok·true· required
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object
POST /api/v1/workspaces/{workspaceId}/ai/chats/{chatId}/messages
Send a message and stream the answer as server-sent events (ADR-0097 D3, D5, D7, D8): the stored message, the text as it comes, a line per tool step, then the answer with its cost. The agent reads and changes only pages in the chat's scope that the caller may read or edit, as the caller; before its first change to a page in a run a version of that page is recorded. Refused with 409 ai_limit_reached when the month's cost has reached the limit, and with 409 ai_run_active while the chat already runs.
sendAiMessage · token scope: session only
Path parameters
workspaceId· string (uuid) · requiredchatId· string (uuid) · required
Request body · application/json, required
text· string · required, length 1–8000lang·"en"|"de"
Response 200 · application/json
- string
Response default · application/json
error· object · requiredcode·"bad_request"|"validation_failed"|"unauthorized"|"forbidden"|"not_found"|"conflict"|"rate_limited"|"internal"· requiredmessage· string · requiredreason· string · length 1–64params· object