{"openapi":"3.1.0","info":{"title":"hejstack API v1","summary":"hejstack public API for service accounts: search and ask company knowledge, read and write wiki pages.","description":"Public interface of hejstack for **service accounts** – for example Windmill apps or your own\nscripts that search company knowledge, ask questions or maintain wiki pages.\n\nGuide with examples (curl, Python, TypeScript, Windmill): <https://hejstack.com/developers>\n\n### Access\n1. The platform administrator creates the service account and hands over the token\n   (`sk-hejstack-sa-…`); it is shown exactly once.\n2. The company's administrator releases under **Zugriff für Apps** (app access) which knowledge\n   groups and wikis the service account may see (wikis with the right *read* or *write*).\n3. First call: `GET /api/v1/me` shows scopes and assignments.\n\n### Authentication\n`Authorization: Bearer <token>` on every call. Scopes on the token: `knowledge:read`, `wiki:read`, `wiki:write`.\nPlease also send `X-hejstack-App: <origin>` (e.g. the Windmill path) – the company's audit log\nthen shows which app accessed the data.\n\n### Limits and errors\n- Rate limit: **60 calls per minute** per service account; above that `429` with `Retry-After`.\n- Every error has a `detail`: a text (German), except request validation (`422`), where `detail`\n  is a list with one entry per invalid field.\n- `401` token invalid · `403` scope or assignment missing · `404` unknown (an unassigned wiki as\n  well) · `422` request invalid · `423` knowledge base locked, retry later.\n- Answers from `knowledge/ask` count against the company's usage quota; when it is used up,\n  `429` comes **without** `Retry-After` – do not retry that automatically. A search only books\n  the small cost of converting the search text (embedding).\n\n### Wiki pages\nA page travels as an **OKF file**: Markdown with YAML front matter, `type` is required (`title`,\n`description`, `tags`, `owner`, `updated` are optional). Every page has a revision (`ETag`);\n`PUT` and `DELETE` require `If-Match` with the ETag you read (`428` without, `409` on conflict).\nDeleted pages go to the wiki's trash and can be restored there.\n\n### Data protection\nPer call only time, service account, endpoint, group and origin are logged – never questions,\nanswers or document contents. All data stays in the EU.\n","version":"1.16.1"},"servers":[{"url":"https://api.hejstack.com"}],"paths":{"/api/v1/me":{"get":{"tags":["General"],"summary":"Check your access","description":"Returns the company, the service account, its scopes and the assigned knowledge groups and wikis with their rights. A good first call: it shows whether the token works and what has been released.","operationId":"me_api_v1_me_get","responses":{"200":{"description":"Company, service account, scopes and assignments","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeOut"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"invalid token"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds.","headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"Rate limit exceeded: 60 per 1 minute"}}}}},"parameters":[{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}]}},"/api/v1/knowledge/search":{"post":{"tags":["Knowledge"],"summary":"Search a knowledge group","description":"Semantic search in exactly one assigned knowledge group. Returns the best matching passages with a relevance score and their source (document, page, folder, link). No language model writes an answer; only the search text is converted into a vector (embedding), and that small cost is booked to the company's usage. For a written answer use `knowledge/ask`.","operationId":"knowledge_search_api_v1_knowledge_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchIn"}}},"required":true},"responses":{"200":{"description":"Hits with passage, score and source","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchOut"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"invalid token"}}}},"403":{"description":"Access denied: the token lacks the required scope, the knowledge group is not assigned to this service account, or the wiki is only assigned read-only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"scope knowledge:read required"}}}},"404":{"description":"Not found. A wiki that is not assigned to the service account deliberately answers 404 as well.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"Wissensgruppe unbekannt"}}}},"422":{"description":"The request is formally invalid, e.g. a required field is missing or too long.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorOut"},"example":{"detail":[{"type":"string_too_short","loc":["body","query"],"msg":"String should have at least 1 character","input":"","ctx":{"min_length":1}}]}}}},"423":{"description":"The company's knowledge base is temporarily locked (encryption key unavailable). Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"Die Wissensdatenbank des Mandanten ist gesperrt"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds.","headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"Rate limit exceeded: 60 per 1 minute"}}}}},"parameters":[{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}]}},"/api/v1/knowledge/ask":{"post":{"tags":["Knowledge"],"summary":"Ask a knowledge group a question","description":"Answers the question solely from the knowledge of the given group, with the same grounding as the chat: citations as `[Quelle N]`, and only documents that are actually cited are returned. Uses the language model released for the company and counts against its quota (429 when exhausted or blocked).","operationId":"knowledge_ask_api_v1_knowledge_ask_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskIn"}}},"required":true},"responses":{"200":{"description":"Answer with the cited sources and the model used","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AskOut"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"invalid token"}}}},"403":{"description":"Access denied: the token lacks the required scope, the knowledge group is not assigned to this service account, or the wiki is only assigned read-only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"scope knowledge:read required"}}}},"404":{"description":"Not found. A wiki that is not assigned to the service account deliberately answers 404 as well.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"Wissensgruppe unbekannt"}}}},"422":{"description":"The request is formally invalid, e.g. a required field is missing or too long.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationErrorOut"},"example":{"detail":[{"type":"string_too_short","loc":["body","query"],"msg":"String should have at least 1 character","input":"","ctx":{"min_length":1}}]}}}},"423":{"description":"The company's knowledge base is temporarily locked (encryption key unavailable). Retry later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"Die Wissensdatenbank des Mandanten ist gesperrt"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds. `knowledge/ask` also answers 429 – **without** `Retry-After` – when the company's usage quota is exhausted or blocked, or the language model's provider quota is used up. Do not retry those automatically: they last until the quota resets or the administrator raises it.","headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"Rate limit exceeded: 60 per 1 minute"}}}}},"parameters":[{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}]}},"/api/v1/wikis":{"get":{"tags":["Wiki"],"summary":"List assigned wikis","description":"All wikis this service account may see, with the right `read` or `write`.","operationId":"list_wikis_api_v1_wikis_get","responses":{"200":{"description":"Wikis with their right","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/WikiOut"},"type":"array","title":"Response List Wikis Api V1 Wikis Get"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"invalid token"}}}},"403":{"description":"Access denied: the token lacks the required scope, the knowledge group is not assigned to this service account, or the wiki is only assigned read-only.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"scope knowledge:read required"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds.","headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorOut"},"example":{"detail":"Rate limit exceeded: 60 per 1 minute"}}}}},"parameters":[{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}]}},"/api/v1/wikis/{wiki}/pages":{"get":{"tags":["Wiki"],"summary":"List the pages of a wiki","description":"All pages of the wiki (excluding the trash) with path, title, type, ETag and last change. `wiki` is the ID, name or slug.","operationId":"list_pages_api_v1_wikis__wiki__pages_get","parameters":[{"name":"wiki","in":"path","required":true,"schema":{"type":"string","description":"ID, name or slug of an assigned wiki","examples":["Processes"],"title":"Wiki"},"description":"ID, name or slug of an assigned wiki"},{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}],"responses":{"200":{"description":"Pages with metadata and ETag","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PageMeta"},"title":"Response List Pages Api V1 Wikis  Wiki  Pages Get"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"example":{"detail":"invalid token"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"403":{"description":"Access denied: the token lacks the required scope, the knowledge group is not assigned to this service account, or the wiki is only assigned read-only.","content":{"application/json":{"example":{"detail":"scope knowledge:read required"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"404":{"description":"Not found. A wiki that is not assigned to the service account deliberately answers 404 as well.","content":{"application/json":{"example":{"detail":"Wissensgruppe unbekannt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"The request is formally invalid, e.g. a required field is missing or too long.","content":{"application/json":{"example":{"detail":[{"type":"string_too_short","loc":["body","query"],"msg":"String should have at least 1 character","input":"","ctx":{"min_length":1}}]},"schema":{"$ref":"#/components/schemas/ValidationErrorOut"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds.","content":{"application/json":{"example":{"detail":"Rate limit exceeded: 60 per 1 minute"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}},"headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}}}}},"post":{"tags":["Wiki"],"summary":"Create a new page","description":"Creates a page at `path` (scope `wiki:write` and right `write` on the wiki). The content is an OKF file with `type` in the front matter. A taken path yields 409; if the path is in the trash, the page is revived there. Response: metadata plus header `ETag`.","operationId":"create_page_api_v1_wikis__wiki__pages_post","parameters":[{"name":"wiki","in":"path","required":true,"schema":{"type":"string","description":"ID, name or slug of an assigned wiki","examples":["Processes"],"title":"Wiki"},"description":"ID, name or slug of an assigned wiki"},{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageCreateIn"}}}},"responses":{"201":{"description":"Page created; header `ETag`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageMeta"}}},"headers":{"ETag":{"description":"Revision of the page, e.g. `\"3\"` – send it back as `If-Match` on PUT/DELETE","schema":{"type":"string"}}}},"400":{"description":"Invalid page path (e.g. empty, `..` or disallowed characters).","content":{"application/json":{"example":{"detail":"Ungültiger Pfad"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"example":{"detail":"invalid token"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"403":{"description":"Access denied: the token lacks the required scope, the knowledge group is not assigned to this service account, or the wiki is only assigned read-only.","content":{"application/json":{"example":{"detail":"scope knowledge:read required"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"404":{"description":"Not found. A wiki that is not assigned to the service account deliberately answers 404 as well.","content":{"application/json":{"example":{"detail":"Wissensgruppe unbekannt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"409":{"description":"Conflict: the page changed in the meantime (ETag mismatch) or the path is already taken. Re-read the page and send again with the current ETag.","content":{"application/json":{"example":{"detail":"Konflikt: die Seite hat inzwischen ETag \"4\" (gesendet: \"3\")"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"The request is invalid: either a field fails validation (`detail` is a list, FastAPI format) or the OKF file cannot be read, e.g. no front matter or no `type` (`detail` is a text).","content":{"application/json":{"examples":{"validation":{"summary":"Field invalid","value":{"detail":[{"type":"string_too_short","loc":["body","query"],"msg":"String should have at least 1 character","input":"","ctx":{"min_length":1}}]}},"okf":{"summary":"OKF file invalid","value":{"detail":"Ungültige OKF-Datei: Kein YAML-Frontmatter gefunden (Datei muss mit '---' beginnen)."}}},"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrorOut"},{"$ref":"#/components/schemas/ErrorOut"}],"title":"Response 422 Create Page Api V1 Wikis  Wiki  Pages Post"}}}},"423":{"description":"The company's knowledge base is temporarily locked (encryption key unavailable). Retry later.","content":{"application/json":{"example":{"detail":"Die Wissensdatenbank des Mandanten ist gesperrt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds.","content":{"application/json":{"example":{"detail":"Rate limit exceeded: 60 per 1 minute"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}},"headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}}}}}},"/api/v1/wikis/{wiki}/pages/{path}":{"get":{"tags":["Wiki"],"summary":"Read one page as an OKF file","description":"Returns the page as an OKF file (`text/markdown`): YAML front matter + Markdown – the same file the ZIP export produces. The `ETag` header carries the revision; send it as `If-Match` on PUT/DELETE.","operationId":"get_page_api_v1_wikis__wiki__pages__path__get","parameters":[{"name":"wiki","in":"path","required":true,"schema":{"type":"string","description":"ID, name or slug of an assigned wiki","examples":["Processes"],"title":"Wiki"},"description":"ID, name or slug of an assigned wiki"},{"name":"path","in":"path","required":true,"schema":{"type":"string","description":"Path of the page within the wiki, e.g. `processes/expense-reports.md`","examples":["processes/expense-reports.md"],"title":"Path"},"description":"Path of the page within the wiki, e.g. `processes/expense-reports.md`"},{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}],"responses":{"200":{"description":"OKF file; header `ETag`","content":{"text/markdown":{"example":"---\ntype: process\ntitle: Expense reports\ndescription: Process and deadlines for travel expense reports\ntags: [finance, travel]\n---\n\n## Process\n1. Upload the receipts in the portal within 14 days after returning.\n2. Accounting checks them and pays out with the next payroll run.\n"}},"headers":{"ETag":{"description":"Revision of the page, e.g. `\"3\"` – send it back as `If-Match` on PUT/DELETE","schema":{"type":"string"}}}},"400":{"description":"Invalid page path (e.g. empty, `..` or disallowed characters).","content":{"application/json":{"example":{"detail":"Ungültiger Pfad"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"example":{"detail":"invalid token"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"403":{"description":"Access denied: the token lacks the required scope, the knowledge group is not assigned to this service account, or the wiki is only assigned read-only.","content":{"application/json":{"example":{"detail":"scope knowledge:read required"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"404":{"description":"Not found. A wiki that is not assigned to the service account deliberately answers 404 as well.","content":{"application/json":{"example":{"detail":"Wissensgruppe unbekannt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"The request is formally invalid, e.g. a required field is missing or too long.","content":{"application/json":{"example":{"detail":[{"type":"string_too_short","loc":["body","query"],"msg":"String should have at least 1 character","input":"","ctx":{"min_length":1}}]},"schema":{"$ref":"#/components/schemas/ValidationErrorOut"}}}},"423":{"description":"The company's knowledge base is temporarily locked (encryption key unavailable). Retry later.","content":{"application/json":{"example":{"detail":"Die Wissensdatenbank des Mandanten ist gesperrt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds.","content":{"application/json":{"example":{"detail":"Rate limit exceeded: 60 per 1 minute"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}},"headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}}}}},"put":{"tags":["Wiki"],"summary":"Replace a page","description":"Replaces the whole content of the page with the OKF file sent. `If-Match` must carry the ETag of the page as you read it – 428 without it; 409 if the page changed in the meantime (re-read and send again). Every save is kept in the page history.","operationId":"replace_page_api_v1_wikis__wiki__pages__path__put","parameters":[{"name":"wiki","in":"path","required":true,"schema":{"type":"string","description":"ID, name or slug of an assigned wiki","examples":["Processes"],"title":"Wiki"},"description":"ID, name or slug of an assigned wiki"},{"name":"path","in":"path","required":true,"schema":{"type":"string","description":"Path of the page within the wiki, e.g. `processes/expense-reports.md`","examples":["processes/expense-reports.md"],"title":"Path"},"description":"Path of the page within the wiki, e.g. `processes/expense-reports.md`"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ETag of the page as you read it, e.g. `\"3\"` (required; `*` is not accepted)","title":"If-Match"},"description":"ETag of the page as you read it, e.g. `\"3\"` (required; `*` is not accepted)"},{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageReplaceIn"}}}},"responses":{"200":{"description":"Page saved; header `ETag`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageMeta"}}},"headers":{"ETag":{"description":"Revision of the page, e.g. `\"3\"` – send it back as `If-Match` on PUT/DELETE","schema":{"type":"string"}}}},"400":{"description":"Invalid page path (e.g. empty, `..` or disallowed characters).","content":{"application/json":{"example":{"detail":"Ungültiger Pfad"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"example":{"detail":"invalid token"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"403":{"description":"Access denied: the token lacks the required scope, the knowledge group is not assigned to this service account, or the wiki is only assigned read-only.","content":{"application/json":{"example":{"detail":"scope knowledge:read required"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"404":{"description":"Not found. A wiki that is not assigned to the service account deliberately answers 404 as well.","content":{"application/json":{"example":{"detail":"Wissensgruppe unbekannt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"409":{"description":"Conflict: the page changed in the meantime (ETag mismatch) or the path is already taken. Re-read the page and send again with the current ETag.","content":{"application/json":{"example":{"detail":"Konflikt: die Seite hat inzwischen ETag \"4\" (gesendet: \"3\")"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"The request is invalid: either a field fails validation (`detail` is a list, FastAPI format) or the OKF file cannot be read, e.g. no front matter or no `type` (`detail` is a text).","content":{"application/json":{"examples":{"validation":{"summary":"Field invalid","value":{"detail":[{"type":"string_too_short","loc":["body","query"],"msg":"String should have at least 1 character","input":"","ctx":{"min_length":1}}]}},"okf":{"summary":"OKF file invalid","value":{"detail":"Ungültige OKF-Datei: Kein YAML-Frontmatter gefunden (Datei muss mit '---' beginnen)."}}},"schema":{"anyOf":[{"$ref":"#/components/schemas/ValidationErrorOut"},{"$ref":"#/components/schemas/ErrorOut"}],"title":"Response 422 Replace Page Api V1 Wikis  Wiki  Pages  Path  Put"}}}},"423":{"description":"The company's knowledge base is temporarily locked (encryption key unavailable). Retry later.","content":{"application/json":{"example":{"detail":"Die Wissensdatenbank des Mandanten ist gesperrt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"428":{"description":"`If-Match` is missing. Read the page first (header `ETag`), then write or delete with exactly that value.","content":{"application/json":{"example":{"detail":"Header If-Match mit dem ETag der gelesenen Seite ist Pflicht"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds.","content":{"application/json":{"example":{"detail":"Rate limit exceeded: 60 per 1 minute"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}},"headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}}}}},"delete":{"tags":["Wiki"],"summary":"Move a page to the trash","description":"Moves the page to the wiki's trash (not permanent – the company's administrator can restore it in hejstack). `If-Match` with the ETag you read is required (428 without, 409 on conflict).","operationId":"delete_page_api_v1_wikis__wiki__pages__path__delete","parameters":[{"name":"wiki","in":"path","required":true,"schema":{"type":"string","description":"ID, name or slug of an assigned wiki","examples":["Processes"],"title":"Wiki"},"description":"ID, name or slug of an assigned wiki"},{"name":"path","in":"path","required":true,"schema":{"type":"string","description":"Path of the page within the wiki, e.g. `processes/expense-reports.md`","examples":["processes/expense-reports.md"],"title":"Path"},"description":"Path of the page within the wiki, e.g. `processes/expense-reports.md`"},{"name":"If-Match","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ETag of the page as you read it, e.g. `\"3\"` (required; `*` is not accepted)","title":"If-Match"},"description":"ETag of the page as you read it, e.g. `\"3\"` (required; `*` is not accepted)"},{"name":"X-hejstack-App","in":"header","required":false,"schema":{"type":"string","maxLength":200},"description":"Origin of the call, e.g. the Windmill path `f/purchasing/supplier_check`. Recorded in the company's audit log next to time, service account and endpoint."}],"responses":{"204":{"description":"Page is in the trash"},"400":{"description":"Invalid page path (e.g. empty, `..` or disallowed characters).","content":{"application/json":{"example":{"detail":"Ungültiger Pfad"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"401":{"description":"Token missing, invalid or revoked.","content":{"application/json":{"example":{"detail":"invalid token"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"403":{"description":"Access denied: the token lacks the required scope, the knowledge group is not assigned to this service account, or the wiki is only assigned read-only.","content":{"application/json":{"example":{"detail":"scope knowledge:read required"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"404":{"description":"Not found. A wiki that is not assigned to the service account deliberately answers 404 as well.","content":{"application/json":{"example":{"detail":"Wissensgruppe unbekannt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"409":{"description":"Conflict: the page changed in the meantime (ETag mismatch) or the path is already taken. Re-read the page and send again with the current ETag.","content":{"application/json":{"example":{"detail":"Konflikt: die Seite hat inzwischen ETag \"4\" (gesendet: \"3\")"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"422":{"description":"The request is formally invalid, e.g. a required field is missing or too long.","content":{"application/json":{"example":{"detail":[{"type":"string_too_short","loc":["body","query"],"msg":"String should have at least 1 character","input":"","ctx":{"min_length":1}}]},"schema":{"$ref":"#/components/schemas/ValidationErrorOut"}}}},"423":{"description":"The company's knowledge base is temporarily locked (encryption key unavailable). Retry later.","content":{"application/json":{"example":{"detail":"Die Wissensdatenbank des Mandanten ist gesperrt"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"428":{"description":"`If-Match` is missing. Read the page first (header `ETag`), then write or delete with exactly that value.","content":{"application/json":{"example":{"detail":"Header If-Match mit dem ETag der gelesenen Seite ist Pflicht"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}}},"429":{"description":"Too many requests: the per-service-account rate limit is reached; `Retry-After` gives the wait in seconds.","content":{"application/json":{"example":{"detail":"Rate limit exceeded: 60 per 1 minute"},"schema":{"$ref":"#/components/schemas/ErrorOut"}}},"headers":{"Retry-After":{"description":"Seconds until the next allowed call (rate limit only, not on a quota 429)","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Allowed calls per minute and service account","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Remaining calls in the current one-minute window","schema":{"type":"integer"}}}}}}}},"components":{"schemas":{"AskIn":{"properties":{"question":{"type":"string","maxLength":4000,"minLength":1,"title":"Question","description":"Question in natural language"},"group":{"type":"string","title":"Group","description":"ID, name or slug of an assigned knowledge group"}},"type":"object","required":["question","group"],"title":"AskIn","examples":[{"group":"Purchasing","question":"Which payment terms did we agree with Müller & Söhne?"}]},"AskOut":{"properties":{"group":{"$ref":"#/components/schemas/GroupOut","description":"The knowledge group that was asked"},"answer":{"type":"string","title":"Answer","description":"Answer text (German, same grounding as the chat); citations appear inline as `[Quelle N]`"},"sources":{"items":{"$ref":"#/components/schemas/SourceOut"},"type":"array","title":"Sources","description":"Only documents the answer actually cites – one entry per document"},"model":{"type":"string","title":"Model","description":"Alias of the language model that produced the answer"}},"type":"object","required":["group","answer","sources","model"],"title":"AskOut","examples":[{"answer":"Mit Müller & Söhne gilt ein Zahlungsziel von 30 Tagen netto; bei Zahlung innerhalb von 10 Tagen werden 2 % Skonto gewährt [Quelle 1].","group":{"id":"7f1c2a4e-5b6d-4c3e-9a8f-0d1e2f3a4b5c","name":"Purchasing"},"model":"hejstack-default","sources":[{"chunk_index":12,"document_id":"3e9d7c1a-2b4f-4a6e-8c0d-1f2e3d4c5b6a","filename":"Supplier list 2026.xlsx","folder":"Purchasing/Suppliers"}]}]},"ErrorOut":{"properties":{"detail":{"type":"string","title":"Detail","description":"Human-readable error message (German)","examples":["Wissensgruppe unbekannt"]}},"type":"object","required":["detail"],"title":"ErrorOut","description":"Error response – `detail` is a human-readable message (German)."},"GroupOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"ID of the knowledge group (stable across renames)"},"name":{"type":"string","title":"Name","description":"Display name of the knowledge group"}},"type":"object","required":["id","name"],"title":"GroupOut"},"HitOut":{"properties":{"text":{"type":"string","title":"Text","description":"Text passage as indexed"},"score":{"type":"number","title":"Score","description":"Relevance score – higher is better; only comparable within one response"},"source":{"$ref":"#/components/schemas/SourceOut"}},"type":"object","required":["text","score","source"],"title":"HitOut"},"MeOut":{"properties":{"tenant":{"additionalProperties":true,"type":"object","title":"Tenant","description":"Company (tenant): `id`, `name`, `slug`"},"service_account":{"additionalProperties":true,"type":"object","title":"Service Account","description":"This service account: `id`, `name`"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes","description":"Scopes of the token: `knowledge:read`, `wiki:read`, `wiki:write`"},"knowledge_groups":{"items":{"$ref":"#/components/schemas/GroupOut"},"type":"array","title":"Knowledge Groups","description":"Assigned knowledge groups – only these can be searched and asked"},"wikis":{"items":{"$ref":"#/components/schemas/WikiOut"},"type":"array","title":"Wikis","description":"Assigned wikis with the respective right"}},"type":"object","required":["tenant","service_account","scopes","knowledge_groups"],"title":"MeOut","examples":[{"knowledge_groups":[{"id":"7f1c2a4e-5b6d-4c3e-9a8f-0d1e2f3a4b5c","name":"Purchasing"}],"scopes":["knowledge:read","wiki:read"],"service_account":{"id":"5c6d7e8f-9a0b-4c1d-8e2f-3a4b5c6d7e8f","name":"purchasing-app"},"tenant":{"id":"0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d","name":"Example GmbH","slug":"example-gmbh"},"wikis":[{"access":"read","id":"9b8a7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d","name":"Processes"}]}]},"PageCreateIn":{"properties":{"path":{"type":"string","maxLength":512,"minLength":1,"title":"Path","description":"Path of the new page, sub-folders with `/`, extension `.md`; e.g. `processes/expense-reports.md`"},"content":{"type":"string","maxLength":220000,"title":"Content","description":"OKF file: YAML front matter (`type` required) + Markdown. If `updated`/`owner` are missing, hejstack fills them in."},"indexed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Indexed","description":"`false` = exclude the page from search (otherwise taken from the front matter)"}},"type":"object","required":["path","content"],"title":"PageCreateIn","examples":[{"content":"---\ntype: process\ntitle: Expense reports\ndescription: Process and deadlines for travel expense reports\ntags: [finance, travel]\n---\n\n## Process\n1. Upload the receipts in the portal within 14 days after returning.\n2. Accounting checks them and pays out with the next payroll run.\n","indexed":true,"path":"processes/expense-reports.md"}]},"PageMeta":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"ID of the page"},"path":{"type":"string","title":"Path","description":"Path of the page within the wiki – its identity, e.g. `processes/expense-reports.md`"},"title":{"type":"string","title":"Title","description":"Title from the front matter (otherwise the file name)"},"type":{"type":"string","title":"Type","description":"Page type from the front matter (`type`, required in OKF files)"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Short description from the front matter"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","description":"Tags from the front matter"},"etag":{"type":"integer","title":"Etag","description":"Revision of the page (starts at 1, +1 per save); also sent as header `ETag`"},"indexed":{"type":"boolean","title":"Indexed","description":"`false` = the page is excluded from search","default":true},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At","description":"Last change (ISO 8601, UTC)"},"updated_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By","description":"Who saved last: user or service account"},"channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel","description":"Channel of the last change: `hejstack` (editor) or `api`"}},"type":"object","required":["id","path","title","type","etag"],"title":"PageMeta","examples":[{"channel":"api","description":"Process and deadlines for travel expense reports","etag":3,"id":"c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f","indexed":true,"path":"processes/expense-reports.md","tags":["finance","travel"],"title":"Expense reports","type":"process","updated_at":"2026-11-04T09:12:33+00:00","updated_by":"purchasing-app"}]},"PageReplaceIn":{"properties":{"content":{"type":"string","maxLength":220000,"title":"Content","description":"Complete OKF file replacing the current state (front matter + Markdown)"},"indexed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Indexed","description":"`false` = exclude the page from search"}},"type":"object","required":["content"],"title":"PageReplaceIn","examples":[{"content":"---\ntype: process\ntitle: Expense reports\ndescription: Process and deadlines for travel expense reports\ntags: [finance, travel]\n---\n\n## Process\n1. Upload the receipts in the portal within 14 days after returning.\n2. Accounting checks them and pays out with the next payroll run.\n"}]},"SearchIn":{"properties":{"query":{"type":"string","maxLength":2000,"minLength":1,"title":"Query","description":"Search text in natural language"},"group":{"type":"string","title":"Group","description":"ID, name or slug of an assigned knowledge group"},"limit":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Limit","description":"Number of hits (1–20)","default":5}},"type":"object","required":["query","group"],"title":"SearchIn","examples":[{"group":"Purchasing","limit":5,"query":"payment terms supplier Müller"}]},"SearchOut":{"properties":{"group":{"$ref":"#/components/schemas/GroupOut","description":"The knowledge group that was searched"},"hits":{"items":{"$ref":"#/components/schemas/HitOut"},"type":"array","title":"Hits","description":"Best matching passages, descending by score"}},"type":"object","required":["group","hits"],"title":"SearchOut","examples":[{"group":{"id":"7f1c2a4e-5b6d-4c3e-9a8f-0d1e2f3a4b5c","name":"Purchasing"},"hits":[{"score":0.83,"source":{"chunk_index":12,"document_id":"3e9d7c1a-2b4f-4a6e-8c0d-1f2e3d4c5b6a","filename":"Supplier list 2026.xlsx","folder":"Purchasing/Suppliers"},"text":"Zahlungsziel bei Müller & Söhne: 30 Tage netto, 2 % Skonto bei Zahlung innerhalb von 10 Tagen."}]}]},"SourceOut":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"ID of the document in hejstack"},"filename":{"type":"string","title":"Filename","description":"File name or title of the document"},"page":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Page","description":"Page within the document, if known (PDF, Office)"},"chunk_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Chunk Index","description":"Running number of the text chunk within the document"},"folder":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Folder","description":"Folder or path of the source, if any"},"remote_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Remote Url","description":"Link to the original (e.g. OneDrive, Outlook), if any"}},"type":"object","required":["document_id","filename"],"title":"SourceOut","examples":[{"chunk_index":12,"document_id":"3e9d7c1a-2b4f-4a6e-8c0d-1f2e3d4c5b6a","filename":"Supplier list 2026.xlsx","folder":"Purchasing/Suppliers"}]},"ValidationErrorOut":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationIssue"},"type":"array","title":"Detail","description":"One entry per invalid field"}},"type":"object","required":["detail"],"title":"ValidationErrorOut","description":"Request validation failed – `detail` is a LIST with one entry per invalid field."},"ValidationIssue":{"properties":{"type":{"type":"string","title":"Type","description":"Machine-readable error type","examples":["string_too_short"]},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Loc","description":"Where the problem is: `body`, `path` or `header`, then the field","examples":[["body","query"]]},"msg":{"type":"string","title":"Msg","description":"What is wrong (English)","examples":["String should have at least 1 character"]},"input":{"title":"Input","description":"The value that was sent"},"ctx":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Ctx","description":"Details of the rule, e.g. `{\"min_length\": 1}`"}},"type":"object","required":["type","loc","msg"],"title":"ValidationIssue","description":"One invalid field of a request (FastAPI format)."},"WikiOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"ID of the wiki"},"name":{"type":"string","title":"Name","description":"Name of the wiki"},"access":{"type":"string","title":"Access","description":"This service account's right on the wiki: `read` or `write`","examples":["read"]}},"type":"object","required":["id","name","access"],"title":"WikiOut"}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Service-account token (`Authorization: Bearer sk-hejstack-sa-…`). Issued by the platform administrator; shown exactly once and revocable."}}},"tags":[{"name":"General","description":"Check your access: company, scopes and what the token may see."},{"name":"Knowledge","description":"Search and ask knowledge groups – only groups the company's administrator released to the service account under “Zugriff für Apps” (app access)."},{"name":"Wiki","description":"Read and write wiki pages (OKF files, ETag/If-Match). The company's administrator grants the right per wiki (read or write)."}],"security":[{"bearerAuth":[]}]}