# MGWiki – API-Referenz

*MGWiki 5.9.0 · 2026-11-22 · 196 Schnittstellen*

## Überblick

Alles, was MGWiki zeigt und tut, läuft über diese API - die Oberfläche benutzt genau diese
Schnittstellen, mit den Rechten der angemeldeten Person. Anfragen und Antworten sind JSON (UTF-8), außer
eine Schnittstelle sagt etwas anderes (CSV, PDF, Excel, Dateien, der Datenstrom der KI).

Die Adresse ist die der Installation, z. B. `https://mgwiki.example.com`; auf dem Server selbst
`http://127.0.0.1:8719`. Alle Pfade unten beginnen mit `/api/`. Die Verwaltung liegt unter `/api/admin/…`.

## Anmeldung

**API-Token (für Skripte und andere Systeme).** Ein Token legt man unter *Account → API tokens* an; es
wird einmal angezeigt. Bei jeder Anfrage mitsenden:

```
Authorization: Bearer axw_<token>
```

Ein Token hat genau die Rechte der Person, die es angelegt hat - das Token eines Administrators darf, was
ein Administrator darf, nicht mehr. *Wer darf* unten nennt, was eine Schnittstelle vorab verlangt; darüber
hinaus prüft sie die Rechte am einzelnen Objekt (Berechtigungen eines Projekts, eines Bereichs, die
Einschränkungen einer Seite) und antwortet mit 403 oder 404, wo sie fehlen. Ein widerrufenes Token wird sofort abgelehnt. Tokens gehören nicht in
Protokolle oder Skripte, die andere lesen.

**Sitzung (der Browser).** `POST /api/auth/login` mit `{"username": "…", "password": "…"}` setzt ein
Sitzungs-Cookie; `POST /api/auth/logout` beendet es. Passkeys und die Anmeldung über Identitätsanbieter
(Microsoft Entra, Google, Okta) laufen über die Anmeldeseite, Konten aus dem Active Directory über
dasselbe `POST /api/auth/login`.

## Fehler

Ein Fehler ist ein HTTP-Status mit einem JSON-Body:

```json
{"error": "Ein Satz, der sagt, was nicht stimmt", "code": "optionaler_maschinenlesbarer_code"}
```

| Status | Bedeutung |
|---|---|
| 400 | Die Anfrage stimmt nicht - der Satz sagt, was. |
| 401 | Nicht angemeldet, oder das Token ist nicht gültig. |
| 403 | Angemeldet, aber nicht erlaubt - oder, bei Änderungen, keine gültige Lizenz (`code: license_required`). |
| 404 | Nicht vorhanden oder für diese Person nicht sichtbar (die API unterscheidet beides nicht). |
| 409 | Widerspricht dem Bestand (z. B. ein vergebener Name). |
| 413 | Zu groß - große Dateien in Teilen senden (siehe unten). |
| 429 | Zu viele Anfragen - so lange warten, wie `Retry-After` sagt. |
| 500 | Unerwartet; die Antwort enthält `ref`, eine Kennung, unter der die Details im Server-Protokoll stehen. |

## Grenzen

Anfragen ohne Sitzung sind auf 300 pro Minute je Adresse begrenzt, angemeldete Clients und Tokens auf
1200 pro Minute (jeweils je Arbeitsprozess gezählt; eine Installation kann beides ändern,
`<PRODUCT>_RATE_LIMIT_ANON` und `<PRODUCT>_RATE_LIMIT`). Darüber antwortet der Server mit `429` und
`Retry-After` in Sekunden. `/api/health` ist nie begrenzt; die Anmeldung (`/api/auth/…`) hat stattdessen
eine eigene Sperre nach Fehlversuchen.

## Formate

- Zeitpunkte sind ISO 8601 in UTC, z. B. `2026-11-06T14:30:00Z`; reine Daten `2026-11-06`.
- Dauern sind Sekunden (`seconds`), oder Text, wo eine Schnittstelle das sagt (`timeSpent: "1h 30m"`).
- Lange Listen nehmen `limit` und `offset`, wo angegeben; die Antwort sagt, wie viele es insgesamt gibt.

## Große Dateien in Teilen

Proxys vor einem Server nehmen oft nur begrenzt viel pro Anfrage (Cloudflare: 100 MB). Große Dateien
gehen deshalb in Teilen von höchstens 50 MB:

1. `POST /api/uploads` mit `{"filename": "…", "size": <Bytes>}` → `{"id": "<Upload-ID>", …}`
2. `PUT /api/uploads/<id>/<n>` mit den Bytes von Teil `n` (0, 1, 2 …) als Body, der Reihe nach
3. `GET /api/uploads/<id>` sagt, wie weit es ist - vor dem erneuten Senden eines Teils nach einer Unterbrechung
4. die fertige Datei mit `"uploadId": "<id>"` statt einer Formular-Datei anhängen; `DELETE /api/uploads/<id>`
   bricht ab

Ein Upload gehört der Person, die ihn begonnen hat; ein nicht abgeschlossener wird nach einem Tag entfernt.

## Antworten des KI-Assistenten

`POST /api/ai/ask` mit `{"question": "…", "conversation": "<beliebige Kennung des Gesprächs>"}` antwortet
als Datenstrom aus JSON-Zeilen (`application/x-ndjson`), ein Ereignis je Zeile, während die Arbeit läuft:

| `type` | Inhalt |
|---|---|
| `start` | die Protokollkennung dieser Frage |
| `step` | ein Werkzeug, das der Assistent benutzt hat: `tool`, `input`, `summary` |
| `sources` | was er gefunden und geöffnet hat: `items` |
| `list` | eine Liste aus der Datenbank, mit der Abfrage, die sie ergab |
| `chart` | ein Diagramm: `chart` = `{type, title, labels, series[{name, values}], unit}` |
| `draft` | eine vorbereitete Änderung, die die Person bestätigt |
| `text` | die Antwort, stückweise |
| `error` | was schiefging, in einem Satz |
| `end` | die Antwort ist vollständig |

Jede Zahl in einem Diagramm stammt aus einem Werkzeugergebnis derselben Antwort; der Assistent handelt
mit den Rechten der fragenden Person.


## Inhalt

- [admin/ai](#area-admin-ai) – 13
- [admin/announcement](#area-admin-announcement) – 2
- [admin/applinks](#area-admin-applinks) – 6
- [admin/audit-log](#area-admin-audit-log) – 1
- [admin/audit-log.csv](#area-admin-audit-log-csv) – 1
- [admin/branding](#area-admin-branding) – 4
- [admin/changelog](#area-admin-changelog) – 1
- [admin/confluence](#area-admin-confluence) – 7
- [admin/database](#area-admin-database) – 2
- [admin/db](#area-admin-db) – 4
- [admin/entra](#area-admin-entra) – 4
- [admin/global-permissions](#area-admin-global-permissions) – 2
- [admin/groups](#area-admin-groups) – 6
- [admin/identity](#area-admin-identity) – 5
- [admin/instance](#area-admin-instance) – 2
- [admin/labels](#area-admin-labels) – 3
- [admin/license](#area-admin-license) – 3
- [admin/links](#area-admin-links) – 4
- [admin/mail](#area-admin-mail) – 3
- [admin/mail-queue](#area-admin-mail-queue) – 1
- [admin/notification-schemes](#area-admin-notification-schemes) – 2
- [admin/public-site](#area-admin-public-site) – 4
- [admin/sections](#area-admin-sections) – 1
- [admin/space-permission-catalog](#area-admin-space-permission-catalog) – 1
- [admin/spaces](#area-admin-spaces) – 1
- [admin/subjects](#area-admin-subjects) – 1
- [admin/system-info](#area-admin-system-info) – 1
- [admin/templates](#area-admin-templates) – 4
- [admin/users](#area-admin-users) – 3
- [admin/webhooks](#area-admin-webhooks) – 5
- [ai](#area-ai) – 11
- [applinks](#area-applinks) – 4
- [archive](#area-archive) – 2
- [attachments](#area-attachments) – 3
- [auth](#area-auth) – 5
- [comments](#area-comments) – 2
- [dashboard](#area-dashboard) – 1
- [health](#area-health) – 2
- [links](#area-links) – 1
- [macros](#area-macros) – 3
- [me](#area-me) – 8
- [notifications](#area-notifications) – 2
- [pages](#area-pages) – 29
- [pdf-layouts](#area-pdf-layouts) – 3
- [search](#area-search) – 1
- [spaces](#area-spaces) – 16
- [templates](#area-templates) – 1
- [third-party](#area-third-party) – 1
- [uploads](#area-uploads) – 4

## Bereich: `admin/ai`

<a id="area-admin-ai"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/ai`

**KI-Assistent lesen**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/ai' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `kind` | string | `"ollama"` |
| `baseUrl` | string | `""` |
| `defaultUrl` | string | `"http://127.0.0.1:11434"` |
| `chatModel` | string | `""` |
| `embedModel` | string | `""` |
| `toolModel` | string | `""` |
| `mode` | string | `"guided"` |
| `basicUser` | string | `""` |
| `context` | integer | `16384` |
| `hasKey` | boolean | `false` |
| `hasBasicPassword` | boolean | `false` |
| `enabled` | boolean | `false` |
| `ready` | boolean | `false` |
| `leaves` | boolean | `true` |
| `destination` | string | `""` |
| `consent` | null | `null` |
| `index` | object |  |
| `index.documents` | integer | `0` |
| `index.withVectors` | integer | `0` |
| `index.waiting` | integer | `1` |
| `index.lastRound` | null | `null` |
| `index.lastError` | null | `null` |

<details><summary>Beispielantwort</summary>

```json
{
  "kind": "ollama",
  "baseUrl": "",
  "defaultUrl": "http://127.0.0.1:11434",
  "chatModel": "",
  "embedModel": "",
  "toolModel": "",
  "mode": "guided",
  "basicUser": "",
  "context": 16384,
  "hasKey": false,
  "hasBasicPassword": false,
  "enabled": false,
  "ready": false,
  "leaves": true,
  "destination": "",
  "consent": null,
  "index": {
    "documents": 0,
    "withVectors": 0,
    "waiting": 1,
    "lastRound": null,
    "lastError": null
  }
}
```

</details>

### `PUT /api/admin/ai`

**KI-Assistent ändern**

<details><summary>Details aus dem Code (englisch)</summary>

Saved as given. Switching on with an address that leaves this server needs
the administrator's confirmation of exactly that address.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `kind`, `baseUrl`, `chatModel`, `embedModel`, `toolModel`, `mode`, `basicUser`, `context`, `apiKey`, `clearApiKey`, `basicPassword`, `confirmLeaves`, `confirmHost`, `enabled`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/ai' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"kind": "…", "baseUrl": "…", "chatModel": "…", "embedModel": "…", "toolModel": "…", "mode": "…", "basicUser": "…", "context": "…"}'
```

**Liefert**

Wie `GET /api/admin/ai`.

### `GET /api/admin/ai/cases`

**Prüffälle auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/ai/cases' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `cases` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "cases": []
}
```

</details>

### `POST /api/admin/ai/cases`

**Prüffall anlegen**

<details><summary>Details aus dem Code (englisch)</summary>

A question and the pages a right answer has to find (PG-12, PG-40).

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `question`, `expect`, `expected`, `note`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/ai/cases' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"question": "…", "expect": "…", "expected": "…", "note": "…"}'
```

**Liefert**

Wie `GET /api/admin/ai/cases`.

### `POST /api/admin/ai/cases/standard`

**Standardfrage anlegen**

<details><summary>Details aus dem Code (englisch)</summary>

The standard questions - the ones that went wrong once - into the catalogue: the
measure every change to the assistant is held against. A question already there is
left as it is.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/ai/cases/standard' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`added`

### `GET /api/admin/ai/glossary`

**Glossar auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/ai/glossary' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `terms` | array |  |
| `terms[].id` | integer | `1` |
| `terms[].term` | string | `"Raum"` |
| `terms[].meaning` | string | `"a space of the wiki"` |

<details><summary>Beispielantwort</summary>

```json
{
  "terms": [
    {
      "id": 1,
      "term": "Raum",
      "meaning": "a space of the wiki"
    },
    {
      "id": 2,
      "term": "zuletzt geändert",
      "meaning": "the pages with the newest change - list_pages, order newest"
    }
  ]
}
```

</details>

### `POST /api/admin/ai/glossary`

**Glossar-Begriff anlegen**

<details><summary>Details aus dem Code (englisch)</summary>

A word of this team and what it means here.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `term`, `meaning`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/ai/glossary' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"term": "…", "meaning": "…"}'
```

**Liefert**

`ok`

### `DELETE /api/admin/ai/glossary/{gid}`

**Glossar-Begriff löschen**

- **Wer darf:** Administratoren
- **Pfadparameter:** `gid` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/ai/glossary/{gid}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`

### `GET /api/admin/ai/log`

**Protokoll auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

The last questions, for the administrator: way, steps, query, outcome, time, thumbs.

</details>

- **Wer darf:** Administratoren
- **Abfrageparameter:** `limit` (int, Standard 50)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/ai/log?limit=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `entries` | array |  |
| `days` | integer | `30` |

<details><summary>Beispielantwort</summary>

```json
{
  "entries": [],
  "days": 30
}
```

</details>

### `POST /api/admin/ai/reindex`

**Index neu aufbauen – KI-Assistent**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/ai/reindex' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

JSON.

### `GET /api/admin/ai/runs`

**Läufe auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/ai/runs' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `runs` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "runs": []
}
```

</details>

### `POST /api/admin/ai/runs`

**Lauf anlegen**

<details><summary>Details aus dem Code (englisch)</summary>

The whole catalogue against the model in use - in the background; the page asks
for progress. mode: the way to test, guided or agent, so the two can be compared.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `mode`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/ai/runs' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"mode": "…"}'
```

**Liefert**

`id`

### `POST /api/admin/ai/test`

**Testen – KI-Assistent**

<details><summary>Details aus dem Code (englisch)</summary>

Reaches the server, lists its models, and has the chosen one say a word.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `kind`, `baseUrl`, `chatModel`, `embedModel`, `basicUser`, `apiKey`, `basicPassword`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/ai/test' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"kind": "…", "baseUrl": "…", "chatModel": "…", "embedModel": "…", "basicUser": "…", "apiKey": "…", "basicPassword": "…"}'
```

**Liefert**

JSON.


## Bereich: `admin/announcement`

<a id="area-admin-announcement"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/announcement`

**Ankündigung lesen**

<details><summary>Details aus dem Code (englisch)</summary>

Readable by anybody signed in - everybody is meant to see it.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/announcement' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `message` | string | `""` |
| `active` | boolean | `false` |
| `updatedBy` | null | `null` |
| `updated` | string | `"2026-11-22 07:46:52"` |

<details><summary>Beispielantwort</summary>

```json
{
  "message": "",
  "active": false,
  "updatedBy": null,
  "updated": "2026-11-22 07:46:52"
}
```

</details>

### `PUT /api/admin/announcement`

**Ankündigung ändern**

- **Wer darf:** Administratoren
- **JSON-Body:** `message`, `active`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/announcement' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"message": "…", "active": "…"}'
```

**Liefert**

`error`


## Bereich: `admin/applinks`

<a id="area-admin-applinks"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/applinks`

**Applinks lesen**

<details><summary>Details aus dem Code (englisch)</summary>

The application links of this installation. Administrators.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/applinks' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `links` | array |  |
| `product` | string | `"mgwiki"` |

<details><summary>Beispielantwort</summary>

```json
{
  "links": [],
  "product": "mgwiki"
}
```

</details>

### `POST /api/admin/applinks`

**Applinks senden**

<details><summary>Details aus dem Code (englisch)</summary>

Set up a link: the other application's address, an administrator's login there (password or API
token - used once, not kept) and this installation's address as the other one reaches it.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `base_url`, `username`, `secret`, `own_url`, `own_name`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/applinks' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"base_url": "…", "username": "…", "secret": "…", "own_url": "…", "own_name": "…"}'
```

**Liefert**

`link`

### `POST /api/admin/applinks/browser`

**Browser senden**

<details><summary>Details aus dem Code (englisch)</summary>

Set up a link in the browser - no password, no token (5.8.1): the address to open, where you approve the
link signed in over there as you are (any identity provider it has, or a password); that application
checks you are one of its
administrators. Back here, /admin/applinks/complete keeps it.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `base_url`, `own_url`, `own_name`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/applinks/browser' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"base_url": "…", "own_url": "…", "own_name": "…"}'
```

**Liefert**

JSON.

### `POST /api/admin/applinks/complete`

**Abschließen – applinks**

<details><summary>Details aus dem Code (englisch)</summary>

The browser is back from approving the link over there, with that side's key: kept here too - only for
the administrator who started it.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/applinks/complete' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`link`

### `DELETE /api/admin/applinks/{link_id}`

**Applinks löschen**

<details><summary>Details aus dem Code (englisch)</summary>

Remove a link - here and in the other application.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `link_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/applinks/{link_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`, `other_side`

### `POST /api/admin/applinks/{link_id}/test`

**Testen – applinks**

<details><summary>Details aus dem Code (englisch)</summary>

Ask the other application as whom it sees you over the link.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `link_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/applinks/{link_id}/test' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`


## Bereich: `admin/audit-log`

<a id="area-admin-audit-log"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/audit-log`

**Prüfprotokoll auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

What was done, newest first - filtered, and exportable as CSV.

An auditor asks "who changed this" and has to be able to look it up and
take it away as a file.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/audit-log' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `entries` | array |  |
| `entries[].id` | integer | `3` |
| `entries[].user_id` | null | `null` |
| `entries[].action` | string | `"POST /api/auth/logout"` |
| `entries[].target_type` | string | `"request"` |
| `entries[].target_id` | null | `null` |
| `entries[].detail` | string | `"{}"` |
| `entries[].ip` | string | `"127.0.0.1"` |
| `entries[].created_at` | string | `"2026-11-22 07:46:50"` |
| `entries[].username` | null | `null` |
| `entries[].display_name` | null | `null` |
| `entries[].user` | string | `"System"` |
| `total` | integer | `3` |

<details><summary>Beispielantwort</summary>

```json
{
  "entries": [
    {
      "id": 3,
      "user_id": null,
      "action": "POST /api/auth/logout",
      "target_type": "request",
      "target_id": null,
      "detail": "{}",
      "ip": "127.0.0.1",
      "created_at": "2026-11-22 07:46:50",
      "username": null,
      "display_name": null,
      "user": "System"
    },
    {
      "id": 2,
      "user_id": null,
      "action": "sign-in failed",
      "target_type": "request",
      "target_id": "",
      "detail": null,
      "ip": "127.0.0.1",
      "created_at": "2026-11-22 07:46:50",
      "username": null,
      "display_name": null,
      "user": "System"
    },
    "…"
  ],
  "total": 3
}
```

</details>


## Bereich: `admin/audit-log.csv`

<a id="area-admin-audit-log-csv"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/audit-log.csv`

**Prüfprotokoll als CSV exportieren**

<details><summary>Details aus dem Code (englisch)</summary>

The same rows the page shows, with the same filter, as a file.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/audit-log.csv' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

Eine Datei (text/csv).


## Bereich: `admin/branding`

<a id="area-admin-branding"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/branding`

**Logo und Farben lesen**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/branding' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `light` | object |  |
| `light.set` | boolean | `false` |
| `light.filename` | string | `""` |
| `light.size_bytes` | integer | `0` |
| `dark` | object |  |
| `dark.set` | boolean | `false` |
| `dark.filename` | string | `""` |
| `dark.size_bytes` | integer | `0` |
| `icon` | object |  |
| `icon.set` | boolean | `false` |
| `icon.filename` | string | `""` |
| `icon.size_bytes` | integer | `0` |
| `icon_max_kb` | integer | `256` |
| `max_kb` | integer | `512` |
| `accepts` | array |  |
| `accent` | string | `"#50226B"` |
| `accent_mode` | string | `"auto"` |
| `shades` | object |  |
| `shades.accent` | string | `"#50226B"` |
| `shades.deep` | string | `"#331644"` |
| `shades.soft` | string | `"#F1E9F7"` |
| `shades.hover` | string | `"#6A2D8E"` |
| `shades.dark_accent` | string | `"#B284CD"` |
| `shades.dark_deep` | string | `"#CCB2DC"` |
| `shades.dark_soft` | string | `"#2D1839"` |

<details><summary>Beispielantwort</summary>

```json
{
  "light": {
    "set": false,
    "filename": "",
    "size_bytes": 0
  },
  "dark": {
    "set": false,
    "filename": "",
    "size_bytes": 0
  },
  "icon": {
    "set": false,
    "filename": "",
    "size_bytes": 0
  },
  "icon_max_kb": 256,
  "max_kb": 512,
  "accepts": [
    "image/jpeg",
    "image/png",
    "…"
  ],
  "accent": "#50226B",
  "accent_mode": "auto",
  "shades": {
    "accent": "#50226B",
    "deep": "#331644",
    "soft": "#F1E9F7",
    "hover": "#6A2D8E",
    "dark_accent": "#B284CD",
    "dark_deep": "#CCB2DC",
    "dark_soft": "#2D1839"
  }
}
```

</details>

### `PUT /api/admin/branding/accent`

**Akzentfarbe ändern**

<details><summary>Details aus dem Code (englisch)</summary>

The one colour everything else is mixed from.

"auto" means it was read out of the logo and should be read again when the
logo changes; "manual" means somebody chose it and nothing may overrule
that - not even a new logo.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `color`, `mode`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/branding/accent' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"color": "…", "mode": "…"}'
```

**Liefert**

`error`

### `POST /api/admin/branding/logo`

**Logo senden**

<details><summary>Details aus dem Code (englisch)</summary>

Store a logo for the top left corner.

Two slots, because the wordmark that reads on a white page rarely reads on
a dark one. Only the light slot is needed: without a dark one the same file
is used for both, which is right for a mark that works either way.

</details>

- **Wer darf:** Administratoren
- **Abfrageparameter:** `variant` (string)
- **JSON-Body:** `(multipart form: file)`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/branding/logo?variant=…' \
  -H 'Authorization: Bearer $TOKEN' \
  -F 'file=@/path/to/file'
```

**Liefert**

`error`, `ok`, `variant`, `size_bytes`

### `DELETE /api/admin/branding/logo`

**Logo löschen**

<details><summary>Details aus dem Code (englisch)</summary>

Back to the delivered mark for one slot, or for both.

</details>

- **Wer darf:** Administratoren
- **Abfrageparameter:** `variant` (string)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/branding/logo?variant=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`


## Bereich: `admin/changelog`

<a id="area-admin-changelog"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/changelog`

**Änderungsprotokoll lesen**

<details><summary>Details aus dem Code (englisch)</summary>

The changelog that shipped with this build, straight from the file.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/changelog' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `releases` | array |  |
| `releases[].version` | string | `"5.9.0"` |
| `releases[].notes` | array |  |
| `version` | string | `"5.9.0"` |

<details><summary>Beispielantwort</summary>

```json
{
  "releases": [
    {
      "version": "5.9.0",
      "notes": [
        "The MGProject and MGService macros show the columns you choose: in the macro'…",
        "MGService macro: the Assignee is shown by default (Key, Summary, Status, Repo…",
        "…"
      ]
    },
    {
      "version": "5.8.4",
      "notes": [
        "The MGService macro with \"Only the open ones\" listed resolved, closed and can…",
        "tests/applinks_e2e_check.py checks it against MGService's own statuses; it fa…"
      ]
    },
    "…"
  ],
  "version": "5.9.0"
}
```

</details>


## Bereich: `admin/confluence`

<a id="area-admin-confluence"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/confluence`

**Confluence-Import lesen**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/confluence' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `settings` | object |  |
| `settings.url` | string | `""` |
| `settings.email` | string | `""` |
| `settings.hasToken` | boolean | `false` |
| `settings.custom_domain` | boolean | `false` |
| `settings.canonical` | null | `null` |
| `job` | null | `null` |

<details><summary>Beispielantwort</summary>

```json
{
  "settings": {
    "url": "",
    "email": "",
    "hasToken": false,
    "custom_domain": false,
    "canonical": null
  },
  "job": null
}
```

</details>

### `PUT /api/admin/confluence`

**Confluence-Import ändern**

- **Wer darf:** Administratoren
- **JSON-Body:** `url`, `email`, `token`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/confluence' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"url": "…", "email": "…", "token": "…"}'
```

**Liefert**

Wie `GET /api/admin/confluence`.

### `POST /api/admin/confluence/import`

**Importieren – Confluence-Import**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/confluence/import' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `space`, `job`

### `GET /api/admin/confluence/job/{job_id}`

**Auftrag lesen – Confluence-Import**

- **Wer darf:** Administratoren
- **Pfadparameter:** `job_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/confluence/job/{job_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `POST /api/admin/confluence/probe`

**Prüfen – Confluence-Import**

<details><summary>Details aus dem Code (englisch)</summary>

Check what actually happens when an attachment is fetched.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/confluence/probe' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `report`, `custom_domain`, `canonical`, `configured`

### `GET /api/admin/confluence/spaces`

**Bereiche auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

What is over there, and what already came across: spaces of every type (knowledge base,
collaboration...) with their kind; ?archived=1 lists the archived ones too.

</details>

- **Wer darf:** Administratoren
- **Abfrageparameter:** `archived` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/confluence/spaces?archived=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `spaces`

### `POST /api/admin/confluence/test`

**Testen – Confluence-Import**

- **Wer darf:** Administratoren
- **JSON-Body:** `token`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/confluence/test' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"token": "…"}'
```

**Liefert**

`ok`, `error`, `user`, `custom_domain`, `canonical`


## Bereich: `admin/database`

<a id="area-admin-database"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/database`

**Datenbank lesen**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/database' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `backend` | string | `"postgres"` |
| `postgres` | object |  |
| `postgres.host` | string | `"127.0.0.1"` |
| `postgres.port` | integer | `5432` |
| `postgres.user` | string | `"mg"` |
| `postgres.password` | string | `"********"` |
| `postgres.dbname` | string | `"mgwiki_apidocs_3368477_1795333609"` |
| `has_password` | boolean | `true` |
| `config_path` | string | `"/tmp/apidocs-4jol8o_p/database.json"` |
| `driver_installed` | boolean | `true` |
| `counts` | array |  |
| `counts[].label` | string | `"spaces"` |
| `counts[].count` | integer | `1` |

<details><summary>Beispielantwort</summary>

```json
{
  "backend": "postgres",
  "postgres": {
    "host": "127.0.0.1",
    "port": 5432,
    "user": "mg",
    "password": "********",
    "dbname": "mgwiki_apidocs_3368477_1795333609"
  },
  "has_password": true,
  "config_path": "/tmp/apidocs-4jol8o_p/database.json",
  "driver_installed": true,
  "counts": [
    {
      "label": "spaces",
      "count": 1
    },
    {
      "label": "pages",
      "count": 1
    },
    "…"
  ]
}
```

</details>

### `POST /api/admin/database/test`

**Testen – Datenbank**

- **Wer darf:** Administratoren
- **JSON-Body:** `password`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/database/test' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"password": "…"}'
```

**Liefert**

`ok`, `error`


## Bereich: `admin/db`

<a id="area-admin-db"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `POST /api/admin/db/query`

**Abfrage senden**

<details><summary>Details aus dem Code (englisch)</summary>

Run one statement. SELECT shows rows; anything else says how many it hit.

One statement at a time: a semicolon in the middle is refused, because a
second statement after a checked first one is exactly how this kind of
page gets abused.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `sql`, `preview`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/db/query' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"sql": "…", "preview": "…"}'
```

**Liefert**

`error`, `kind`, `columns`, `rows`, `total`, `shown`, `table`, `message`

### `GET /api/admin/db/table/{name}`

**Tabelle lesen**

<details><summary>Details aus dem Code (englisch)</summary>

One page of a table, with a filter per column.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `name` (string)
- **Abfrageparameter:** `f_` (string), `page` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/db/table/{name}?f_=…&page=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `table` | string | `"users"` |
| `columns` | array |  |
| `columns[].name` | string | `"id"` |
| `columns[].type` | string | `"integer"` |
| `key` | string | `"id"` |
| `sealed` | array |  |
| `total` | integer | `1` |
| `page` | integer | `0` |
| `pages` | integer | `1` |
| `rows` | array |  |
| `rows[].id` | integer | `1` |
| `rows[].username` | string | `"admin"` |
| `rows[].email` | string | `""` |
| `rows[].display_name` | string | `"Administrator"` |
| `rows[].password_hash` | string | `"<hidden>"` |
| `rows[].ms_oid` | null | `null` |
| `rows[].avatar_color` | string | `"#1F9D6B"` |
| `rows[].job_title` | null | `null` |
| `rows[].is_active` | integer | `1` |
| `rows[].is_admin` | integer | `1` |
| `rows[].source` | string | `"local"` |
| `rows[].last_login` | string | `"2026-11-22 07:46:50"` |
| `rows[].created_at` | string | `"2026-11-22 07:46:50"` |
| `rows[].must_change_password` | string | `"<hidden>"` |
| `rows[].password_changed` | string | `"<hidden>"` |
| `rows[].failed_logins` | integer | `0` |
| `rows[].locked_until` | null | `null` |
| `rows[].white_pages` | string | `""` |

<details><summary>Beispielantwort</summary>

```json
{
  "table": "users",
  "columns": [
    {
      "name": "id",
      "type": "integer"
    },
    {
      "name": "username",
      "type": "character varying"
    },
    "…"
  ],
  "key": "id",
  "sealed": [
    "client_secret",
    "credential_id",
    "…"
  ],
  "total": 1,
  "page": 0,
  "pages": 1,
  "rows": [
    {
      "id": 1,
      "username": "admin",
      "email": "",
      "display_name": "Administrator",
      "password_hash": "<hidden>",
      "ms_oid": null,
      "avatar_color": "#1F9D6B",
      "job_title": null,
      "is_active": 1,
      "is_admin": 1,
      "source": "local",
      "last_login": "2026-11-22 07:46:50",
      "created_at": "2026-11-22 07:46:50",
      "must_change_password": "<hidden>",
      "password_changed": "<hidden>",
      "failed_logins": 0,
      "locked_until": null,
      "white_pages": ""
    }
  ]
}
```

</details>

### `PUT /api/admin/db/table/{name}`

**Tabelle ändern**

<details><summary>Details aus dem Code (englisch)</summary>

Change one value in one row, named by its key. Nothing else.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `name` (string)
- **JSON-Body:** `column`, `keyColumn`, `keyValue`, `value`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/db/table/{name}' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"column": "…", "keyColumn": "…", "keyValue": "…", "value": "…"}'
```

**Liefert**

`error`, `table`, `column`, `was`, `now`

### `GET /api/admin/db/tables`

**Datenbanktabellen auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/db/tables' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `tables` | array |  |
| `tables[].name` | string | `"ai_cases"` |
| `tables[].rows` | integer | `0` |
| `database` | string | `"127.0.0.1/mgwiki_apidocs_3368477_1795333609"` |

<details><summary>Beispielantwort</summary>

```json
{
  "tables": [
    {
      "name": "ai_cases",
      "rows": 0
    },
    {
      "name": "ai_docs",
      "rows": 0
    },
    "…"
  ],
  "database": "127.0.0.1/mgwiki_apidocs_3368477_1795333609"
}
```

</details>


## Bereich: `admin/entra`

<a id="area-admin-entra"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/entra`

**Microsoft-Entra-Einstellungen auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/entra' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `enabled` | boolean | `false` |
| `tenantId` | string | `""` |
| `clientId` | string | `""` |
| `hasSecret` | boolean | `false` |
| `domainAllowList` | string | `""` |
| `autoCreate` | boolean | `true` |
| `entraOnly` | boolean | `false` |
| `defaultGroups` | string | `"wiki-users"` |
| `syncEnabled` | boolean | `false` |
| `syncHours` | integer | `12` |
| `deactivateMissing` | boolean | `false` |
| `lastSync` | null | `null` |
| `lastSyncResult` | string | `""` |
| `redirectUri` | string | `"/auth/microsoft/callback"` |

<details><summary>Beispielantwort</summary>

```json
{
  "enabled": false,
  "tenantId": "",
  "clientId": "",
  "hasSecret": false,
  "domainAllowList": "",
  "autoCreate": true,
  "entraOnly": false,
  "defaultGroups": "wiki-users",
  "syncEnabled": false,
  "syncHours": 12,
  "deactivateMissing": false,
  "lastSync": null,
  "lastSyncResult": "",
  "redirectUri": "/auth/microsoft/callback"
}
```

</details>

### `PUT /api/admin/entra`

**Microsoft-Entra-Einstellungen ändern**

- **Wer darf:** Administratoren
- **JSON-Body:** `tenantId`, `clientId`, `clientSecret`, `domainAllowList`, `defaultGroups`, `autoCreate`, `enabled`, `entraOnly`, `syncEnabled`, `syncHours`, `deactivateMissing`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/entra' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"tenantId": "…", "clientId": "…", "clientSecret": "…", "domainAllowList": "…", "defaultGroups": "…", "autoCreate": "…", "enabled": "…", "entraOnly": "…"}'
```

**Liefert**

`error`

### `POST /api/admin/entra/sync`

**Abgleich ausführen – Microsoft-Entra-Einstellung**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/entra/sync' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `POST /api/admin/entra/test`

**Testen – Microsoft-Entra-Einstellung**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/entra/test' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`, `error`, `issuer`, `redirectUri`


## Bereich: `admin/global-permissions`

<a id="area-admin-global-permissions"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/global-permissions`

**Allgemeine Berechtigungen auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/global-permissions' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `available` | array |  |
| `available[].key` | string | `"CAN_USE"` |
| `available[].label` | string | `"Can use MGWiki"` |
| `subjects` | array |  |
| `subjects[].subject_type` | string | `"group"` |
| `subjects[].subject_id` | integer | `1` |
| `subjects[].name` | string | `"wiki-administrators"` |
| `subjects[].permissions` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "available": [
    {
      "key": "CAN_USE",
      "label": "Can use MGWiki"
    },
    {
      "key": "CREATE_SPACE",
      "label": "Create spaces"
    },
    "…"
  ],
  "subjects": [
    {
      "subject_type": "group",
      "subject_id": 1,
      "name": "wiki-administrators",
      "permissions": [
        "CAN_USE",
        "CREATE_SPACE",
        "…"
      ]
    },
    {
      "subject_type": "group",
      "subject_id": 2,
      "name": "wiki-users",
      "permissions": [
        "CAN_USE",
        "CREATE_SPACE",
        "…"
      ]
    }
  ]
}
```

</details>

### `PUT /api/admin/global-permissions`

**Allgemeine Berechtigungen ändern**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/global-permissions' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`


## Bereich: `admin/groups`

<a id="area-admin-groups"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/groups`

**Gruppen auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/groups' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `groups` | array |  |
| `groups[].id` | integer | `1` |
| `groups[].name` | string | `"wiki-administrators"` |
| `groups[].description` | string | `"Full access to MGWiki"` |
| `groups[].is_system` | boolean | `true` |
| `groups[].created_at` | string | `"2026-11-22 07:46:50"` |
| `groups[].member_count` | integer | `1` |
| `groups[].members` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "groups": [
    {
      "id": 1,
      "name": "wiki-administrators",
      "description": "Full access to MGWiki",
      "is_system": true,
      "created_at": "2026-11-22 07:46:50",
      "member_count": 1,
      "members": [
        {
          "id": 1,
          "username": "admin",
          "display_name": "Administrator",
          "is_active": 1
        }
      ]
    },
    {
      "id": 2,
      "name": "wiki-users",
      "description": "Everyone who may use MGWiki",
      "is_system": true,
      "created_at": "2026-11-22 07:46:50",
      "member_count": 0,
      "members": []
    }
  ]
}
```

</details>

### `POST /api/admin/groups`

**Gruppe anlegen**

- **Wer darf:** Administratoren
- **JSON-Body:** `name`, `description`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/groups' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name": "…", "description": "…"}'
```

**Liefert**

`error`, `group`

### `PUT /api/admin/groups/{group_id}`

**Gruppe ändern**

<details><summary>Details aus dem Code (englisch)</summary>

Rename a group or change its description.

The other two products have had this since they had groups; here the
screen offered a Delete and nothing else, so a typo in a group name meant
deleting it and starting over - and every permission granted to it went
with it.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `group_id` (integer)
- **JSON-Body:** `name`, `description`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/groups/{group_id}' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name": "…", "description": "…"}'
```

**Liefert**

`error`, `group`

### `DELETE /api/admin/groups/{group_id}`

**Gruppe löschen**

- **Wer darf:** Administratoren
- **Pfadparameter:** `group_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/groups/{group_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`

### `GET /api/admin/groups/{group_id}/members`

**Mitglieder auflisten (Gruppe)**

- **Wer darf:** Administratoren
- **Pfadparameter:** `group_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/groups/{group_id}/members' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `members` | array |  |
| `members[].id` | integer | `1` |
| `members[].username` | string | `"admin"` |
| `members[].email` | string | `""` |
| `members[].display_name` | string | `"Administrator"` |
| `members[].job_title` | null | `null` |
| `members[].is_active` | boolean | `true` |
| `members[].is_admin` | boolean | `true` |
| `members[].source` | string | `"local"` |
| `members[].last_login` | string | `"2026-11-22 07:46:50"` |
| `members[].must_change_password` | boolean | `false` |
| `members[].created_at` | string | `"2026-11-22 07:46:50"` |
| `members[].avatar_color` | string | `"#1F9D6B"` |
| `members[].groups` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "members": [
    {
      "id": 1,
      "username": "admin",
      "email": "",
      "display_name": "Administrator",
      "job_title": null,
      "is_active": true,
      "is_admin": true,
      "source": "local",
      "last_login": "2026-11-22 07:46:50",
      "must_change_password": false,
      "created_at": "2026-11-22 07:46:50",
      "avatar_color": "#1F9D6B",
      "groups": [
        "wiki-administrators"
      ]
    }
  ]
}
```

</details>

### `PUT /api/admin/groups/{group_id}/members`

**Mitglieder ändern (Gruppe)**

<details><summary>Details aus dem Code (englisch)</summary>

Replace who is in a group.

Reading the members was possible, setting them was not - so the group
editor could name a group and describe it, and the one thing a group is
for had to be done from each person's own screen instead.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `group_id` (integer)
- **JSON-Body:** `members`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/groups/{group_id}/members' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"members": "…"}'
```

**Liefert**

`error`, `members`


## Bereich: `admin/identity`

<a id="area-admin-identity"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/identity`

**Identitätsanbieter auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/identity' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `settings` | object |  |
| `settings.order` | array |  |
| `settings.onlyThroughIdp` | boolean | `false` |
| `providers` | object |  |
| `providers.entra` | object |  |
| `providers.entra.label` | string | `"Microsoft Entra"` |
| `providers.entra.enabled` | boolean | `false` |
| `providers.entra.people` | integer | `0` |
| `providers.google` | object |  |
| `providers.google.label` | string | `"Google Workspace"` |
| `providers.google.enabled` | boolean | `false` |
| `providers.google.autoCreate` | boolean | `true` |
| `providers.google.domainAllowList` | string | `""` |
| `providers.google.syncEnabled` | boolean | `false` |
| `providers.google.syncHours` | integer | `12` |
| `providers.google.deactivateMissing` | boolean | `false` |
| `providers.google.lastSync` | null | `null` |
| `providers.google.lastSyncResult` | string | `""` |
| `providers.google.defaultGroups` | string | `""` |
| `providers.google.clientId` | string | `""` |
| `providers.google.hostedDomain` | string | `""` |
| `providers.google.adminEmail` | string | `""` |
| `providers.google.hasClientSecret` | boolean | `false` |
| `providers.google.hasServiceAccountJson` | boolean | `false` |
| `providers.google.people` | integer | `0` |
| `providers.google.redirectUri` | string | `"http://localhost/auth/google/callback"` |
| `providers.okta` | object |  |
| `providers.okta.label` | string | `"Okta"` |
| `providers.okta.enabled` | boolean | `false` |
| `providers.okta.autoCreate` | boolean | `true` |
| `providers.okta.domainAllowList` | string | `""` |
| `providers.okta.syncEnabled` | boolean | `false` |
| `providers.okta.syncHours` | integer | `12` |
| `providers.okta.deactivateMissing` | boolean | `false` |
| `providers.okta.lastSync` | null | `null` |
| `providers.okta.lastSyncResult` | string | `""` |
| `providers.okta.defaultGroups` | string | `""` |
| `providers.okta.domain` | string | `""` |
| `providers.okta.clientId` | string | `""` |
| `providers.okta.hasClientSecret` | boolean | `false` |

<details><summary>Beispielantwort</summary>

```json
{
  "settings": {
    "order": [
      "entra",
      "ldap",
      "…"
    ],
    "onlyThroughIdp": false
  },
  "providers": {
    "entra": {
      "label": "Microsoft Entra",
      "enabled": false,
      "people": 0
    },
    "google": {
      "label": "Google Workspace",
      "enabled": false,
      "autoCreate": true,
      "domainAllowList": "",
      "syncEnabled": false,
      "syncHours": 12,
      "deactivateMissing": false,
      "lastSync": null,
      "lastSyncResult": "",
      "defaultGroups": "",
      "clientId": "",
      "hostedDomain": "",
      "adminEmail": "",
      "hasClientSecret": false,
      "hasServiceAccountJson": false,
      "people": 0,
      "redirectUri": "http://localhost/auth/google/callback"
    },
    "okta": {
      "label": "Okta",
      "enabled": false,
      "autoCreate": true,
      "domainAllowList": "",
      "syncEnabled": false,
      "syncHours": 12,
      "deactivateMissing": false,
      "lastSync": null,
      "lastSyncResult": "",
      "defaultGroups": "",
      "domain": "",
      "clientId": "",
      "hasClientSecret": false,
      "hasApiToken": false,
      "people": 0,
      "redirectUri": "http://localhost/auth/okta/callback"
    },
    "ldap": {
      "label": "Active Directory",
      "enabled": false,
      "autoCreate": true,
      "domainAllowList": "",
      "syncEnabled": false,
      "syncHours": 12,
      "deactivateMissing": false,
      "lastSync": null,
      "lastSyncResult": "",
      "defaultGroups": "",
      "server": "",
      "startTls": false,
      "verifyCertificate": true,
      "baseDn": "",
      "bindDn": "",
      "loginAttribute": "sAMAccountName",
      "userFilter": "(&(objectCategory=person)(objectClass=user))",
      "groupDn": "",
      "hasBindPassword": false,
      "peo
…
```

</details>

### `PUT /api/admin/identity`

**Identitätsanbieter ändern**

- **Wer darf:** Administratoren
- **JSON-Body:** `order`, `onlyThroughIdp`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/identity' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"order": "…", "onlyThroughIdp": "…"}'
```

**Liefert**

`error`

### `PUT /api/admin/identity/{provider}`

**Identitätsanbieter ändern**

- **Wer darf:** Administratoren
- **Pfadparameter:** `provider` (string)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/identity/{provider}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `POST /api/admin/identity/{provider}/sync`

**Abgleich ausführen – Identitätsanbieter**

- **Wer darf:** Administratoren
- **Pfadparameter:** `provider` (string)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/identity/{provider}/sync' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `POST /api/admin/identity/{provider}/test`

**Testen – Identitätsanbieter**

- **Wer darf:** Administratoren
- **Pfadparameter:** `provider` (string)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/identity/{provider}/test' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`, `lines`


## Bereich: `admin/instance`

<a id="area-admin-instance"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/instance`

**Instanz-Einstellungen auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/instance' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `base_url` | string | `""` |
| `title` | string | `""` |
| `primary_color` | string | `"#50226B"` |
| `redirect_uri` | string | `"/auth/microsoft/callback"` |
| `env_base_url` | string | `""` |
| `bind` | string | `"127.0.0.1:8719"` |

<details><summary>Beispielantwort</summary>

```json
{
  "base_url": "",
  "title": "",
  "primary_color": "#50226B",
  "redirect_uri": "/auth/microsoft/callback",
  "env_base_url": "",
  "bind": "127.0.0.1:8719"
}
```

</details>

### `PUT /api/admin/instance`

**Instanz-Einstellungen ändern**

<details><summary>Details aus dem Code (englisch)</summary>

The base URL only builds links, so a change takes effect at once - no
restart, no redeploy.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `base_url`, `title`, `primary_color`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/instance' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"base_url": "…", "title": "…", "primary_color": "…"}'
```

**Liefert**

`error`, `base_url`, `title`, `primary_color`, `redirect_uri`, `entra_changed`


## Bereich: `admin/labels`

<a id="area-admin-labels"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/labels`

**Labels auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

Every label in use, with where it is used.

A label nobody has put on anything is worth seeing too: that is usually a
typo left over from a page that has since been edited.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/labels' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `labels` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "labels": []
}
```

</details>

### `PUT /api/admin/labels/{label_id}`

**Label ändern**

<details><summary>Details aus dem Code (englisch)</summary>

Rename a label everywhere at once.

Renaming onto a label that already exists merges the two rather than
failing: that is what somebody means by it, and two labels differing only
in case are the usual reason for doing it.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `label_id` (integer)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/labels/{label_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`, `merged`

### `DELETE /api/admin/labels/{label_id}`

**Label löschen**

<details><summary>Details aus dem Code (englisch)</summary>

Remove a label from every page. The pages themselves are untouched.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `label_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/labels/{label_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`


## Bereich: `admin/license`

<a id="area-admin-license"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/license`

**Lizenz lesen**

<details><summary>Details aus dem Code (englisch)</summary>

Where this installation stands. Any signed-in person may ask.

Not admin-only on purpose: the banner that says the wiki is read-only is
shown to everybody, and it would be odd to make people guess why their
Save button stopped working.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/license' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `valid` | boolean | `true` |
| `state` | string | `"ok"` |
| `message` | string | `""` |

<details><summary>Beispielantwort</summary>

```json
{
  "valid": true,
  "state": "ok",
  "message": ""
}
```

</details>

### `PUT /api/admin/license`

**Lizenz ändern**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/license' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `DELETE /api/admin/license`

**Lizenz löschen**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/license' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

Wie `GET /api/admin/license`.


## Bereich: `admin/links`

<a id="area-admin-links"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/links`

**Verknüpfungen auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/links' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `links` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "links": []
}
```

</details>

### `POST /api/admin/links`

**Verknüpfung anlegen**

- **Wer darf:** Administratoren
- **JSON-Body:** `label`, `url`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/links' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"label": "…", "url": "…"}'
```

**Liefert**

`error`, `id`

### `PUT /api/admin/links/{link_id}`

**Verknüpfung ändern**

- **Wer darf:** Administratoren
- **Pfadparameter:** `link_id` (integer)
- **JSON-Body:** `label`, `url`, `position`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/links/{link_id}' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"label": "…", "url": "…", "position": "…"}'
```

**Liefert**

`error`, `ok`

### `DELETE /api/admin/links/{link_id}`

**Verknüpfung löschen**

- **Wer darf:** Administratoren
- **Pfadparameter:** `link_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/links/{link_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`


## Bereich: `admin/mail`

<a id="area-admin-mail"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/mail`

**Mail-Einstellungen auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/mail' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `enabled` | boolean | `false` |
| `tenantId` | string | `""` |
| `clientId` | string | `""` |
| `sender` | string | `""` |
| `fromName` | string | `"MGWiki"` |
| `hasSecret` | boolean | `false` |
| `replyTo` | string | `""` |
| `footer` | string | `""` |
| `transport` | string | `"graph"` |
| `smtpHost` | string | `""` |
| `smtpPort` | string | `""` |
| `smtpSecurity` | string | `"starttls"` |
| `smtpUser` | string | `""` |
| `hasSmtpPassword` | boolean | `false` |

<details><summary>Beispielantwort</summary>

```json
{
  "enabled": false,
  "tenantId": "",
  "clientId": "",
  "sender": "",
  "fromName": "MGWiki",
  "hasSecret": false,
  "replyTo": "",
  "footer": "",
  "transport": "graph",
  "smtpHost": "",
  "smtpPort": "",
  "smtpSecurity": "starttls",
  "smtpUser": "",
  "hasSmtpPassword": false
}
```

</details>

### `PUT /api/admin/mail`

**Mail-Einstellungen ändern**

- **Wer darf:** Administratoren
- **JSON-Body:** `enabled`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/mail' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"enabled": "…"}'
```

**Liefert**

Wie `GET /api/admin/mail`.

### `POST /api/admin/mail/test`

**Testen – Mail-Einstellung**

<details><summary>Details aus dem Code (englisch)</summary>

Send one message to the person asking, so the setup can be checked.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `to`, `enabled`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/mail/test' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"to": "…", "enabled": "…"}'
```

**Liefert**

`error`, `sent`, `enabled`


## Bereich: `admin/mail-queue`

<a id="area-admin-mail-queue"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/mail-queue`

**Mail-Warteschlange auflisten**

- **Wer darf:** Administratoren
- **Abfrageparameter:** `status` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/mail-queue?status=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `queue` | array |  |
| `enabled` | boolean | `false` |
| `sender` | string | `""` |

<details><summary>Beispielantwort</summary>

```json
{
  "queue": [],
  "enabled": false,
  "sender": ""
}
```

</details>


## Bereich: `admin/notification-schemes`

<a id="area-admin-notification-schemes"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/notification-schemes`

**Benachrichtigungsschemata auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/notification-schemes' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `schemes` | array |  |
| `schemes[].id` | integer | `1` |
| `schemes[].name` | string | `"Default notification scheme"` |
| `schemes[].description` | string | `"Used by every space that does not point at its own"` |
| `schemes[].is_default` | boolean | `true` |
| `schemes[].rules` | array |  |
| `events` | array |  |
| `events[].key` | string | `"page_created"` |
| `events[].label` | string | `"Page created"` |

<details><summary>Beispielantwort</summary>

```json
{
  "schemes": [
    {
      "id": 1,
      "name": "Default notification scheme",
      "description": "Used by every space that does not point at its own",
      "is_default": true,
      "rules": [
        {
          "id": 6,
          "scheme_id": 1,
          "event": "attachment_added",
          "subject_type": "watchers",
          "subject_id": null
        },
        {
          "id": 4,
          "scheme_id": 1,
          "event": "comment_added",
          "subject_type": "watchers",
          "subject_id": null
        },
        "…"
      ]
    }
  ],
  "events": [
    {
      "key": "page_created",
      "label": "Page created"
    },
    {
      "key": "page_updated",
      "label": "Page updated"
    },
    "…"
  ]
}
```

</details>

### `PUT /api/admin/notification-schemes/{scheme_id}`

**Benachrichtigungsschema ändern**

- **Wer darf:** Administratoren
- **Pfadparameter:** `scheme_id` (integer)
- **JSON-Body:** `name`, `description`, `rules`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/notification-schemes/{scheme_id}' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name": "…", "description": "…", "rules": "…"}'
```

**Liefert**

`error`, `ok`


## Bereich: `admin/public-site`

<a id="area-admin-public-site"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/public-site`

**Öffentliche Seite lesen**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/public-site' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `enabled` | boolean | `false` |
| `host` | string | `""` |
| `port` | string | `""` |
| `space_key` | string | `""` |
| `title` | string | `""` |
| `tagline` | string | `"Help and documentation"` |
| `footer` | string | `""` |
| `show_search` | boolean | `true` |
| `url` | string | `""` |
| `listen` | string | `""` |
| `listening` | null | `null` |
| `spaces` | array |  |
| `spaces[].space_key` | string | `"MG"` |
| `spaces[].name` | string | `"MGWiki demo"` |
| `bind` | string | `"127.0.0.1:8719"` |
| `counts` | object |  |
| `counts.live` | integer | `0` |
| `counts.new` | integer | `0` |
| `counts.changed` | integer | `0` |
| `counts.restricted` | integer | `0` |
| `counts.orphans` | integer | `0` |

<details><summary>Beispielantwort</summary>

```json
{
  "enabled": false,
  "host": "",
  "port": "",
  "space_key": "",
  "title": "",
  "tagline": "Help and documentation",
  "footer": "",
  "show_search": true,
  "url": "",
  "listen": "",
  "listening": null,
  "spaces": [
    {
      "space_key": "MG",
      "name": "MGWiki demo"
    }
  ],
  "bind": "127.0.0.1:8719",
  "counts": {
    "live": 0,
    "new": 0,
    "changed": 0,
    "restricted": 0,
    "orphans": 0
  }
}
```

</details>

### `PUT /api/admin/public-site`

**Öffentliche Seite ändern**

- **Wer darf:** Administratoren
- **JSON-Body:** `host`, `port`, `enabled`, `space_key`, `title`, `tagline`, `footer`, `show_search`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/public-site' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"host": "…", "port": "…", "enabled": "…", "space_key": "…", "title": "…", "tagline": "…", "footer": "…", "show_search": "…"}'
```

**Liefert**

`error`

### `GET /api/admin/public-site/pages`

**Seiten auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

What is live, what has moved on, and what has never been out.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/public-site/pages' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `pages` | array |  |
| `orphans` | array |  |
| `counts` | object |  |

<details><summary>Beispielantwort</summary>

```json
{
  "pages": [],
  "orphans": [],
  "counts": {}
}
```

</details>

### `POST /api/admin/public-site/publish`

**Veröffentlichen – öffentliche Seite**

<details><summary>Details aus dem Code (englisch)</summary>

Move the chosen pages out. Everything not chosen stays as it was.

</details>

- **Wer darf:** Administratoren
- **JSON-Body:** `page_ids`, `withdraw`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/public-site/publish' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"page_ids": "…", "withdraw": "…"}'
```

**Liefert**

`error`, `published`, `withdrawn`, `counts`


## Bereich: `admin/sections`

<a id="area-admin-sections"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/sections`

**Abschnitte auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/sections' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `sections` | array |  |
| `sections[].group` | string | `"Identity settings"` |
| `sections[].note` | string | `"Who may sign in, how they are reached, and what they may do` |
| `sections[].items` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "sections": [
    {
      "group": "Identity settings",
      "note": "Who may sign in, how they are reached, and what they may do above the spaces.",
      "items": [
        {
          "key": "people",
          "label": "People",
          "icon": "people",
          "text": "Accounts, sign-in methods, roles and activation."
        },
        {
          "key": "groups",
          "label": "Groups",
          "icon": "people",
          "text": "Bundle people so space permissions can be granted to a team rather than one a…"
        },
        "…"
      ]
    },
    {
      "group": "Space settings",
      "note": "How content is organised, who may reach it, and who hears about it.",
      "items": [
        {
          "key": "spaces",
          "label": "Spaces",
          "icon": "layers",
          "text": "Every space in this installation, active and archived."
        },
        {
          "key": "space-permissions",
          "label": "Space permissions",
          "icon": "shield",
          "text": "Who may do what inside a space, edited per space."
        },
        "…"
      ]
    },
    "…"
  ]
}
```

</details>


## Bereich: `admin/space-permission-catalog`

<a id="area-admin-space-permission-catalog"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/space-permission-catalog`

**Bereichsberechtigungen auflisten**

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/space-permission-catalog' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `permissions` | array |  |
| `permissions[].key` | string | `"SPACE_VIEW"` |
| `permissions[].label` | string | `"View the space"` |

<details><summary>Beispielantwort</summary>

```json
{
  "permissions": [
    {
      "key": "SPACE_VIEW",
      "label": "View the space"
    },
    {
      "key": "PAGE_ADD",
      "label": "Add pages"
    },
    "…"
  ]
}
```

</details>


## Bereich: `admin/spaces`

<a id="area-admin-spaces"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/spaces`

**Bereiche auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

Every space, for System settings > Spaces and Space permissions: its name, key, kind, state and who may
enter it is an administrator's business - what is in it is not (5.5.0). Whether this administrator may
open it themselves is said; somebody else's personal space shows only its owner.

</details>

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/spaces' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `spaces` | array |  |
| `spaces[].id` | integer | `1` |
| `spaces[].key` | string | `"MG"` |
| `spaces[].name` | string | `"MGWiki demo"` |
| `spaces[].type` | string | `"global"` |
| `spaces[].status` | string | `"current"` |
| `spaces[].personal` | boolean | `false` |
| `spaces[].owner_name` | null | `null` |
| `spaces[].can_open` | boolean | `true` |
| `spaces[].can_archive` | boolean | `true` |
| `spaces[].can_restore` | boolean | `false` |
| `spaces[].manageable` | boolean | `true` |

<details><summary>Beispielantwort</summary>

```json
{
  "spaces": [
    {
      "id": 1,
      "key": "MG",
      "name": "MGWiki demo",
      "type": "global",
      "status": "current",
      "personal": false,
      "owner_name": null,
      "can_open": true,
      "can_archive": true,
      "can_restore": false,
      "manageable": true
    }
  ]
}
```

</details>


## Bereich: `admin/subjects`

<a id="area-admin-subjects"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/subjects`

**Berechtigte auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

People and groups, for the permission dialogs.

</details>

- **Wer darf:** Jede angemeldete Person
- **Abfrageparameter:** `q` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/subjects?q=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `users` | array |  |
| `users[].id` | integer | `1` |
| `users[].username` | string | `"admin"` |
| `users[].display_name` | string | `"Administrator"` |
| `users[].avatar_color` | string | `"#1F9D6B"` |
| `groups` | array |  |
| `groups[].id` | integer | `1` |
| `groups[].name` | string | `"wiki-administrators"` |

<details><summary>Beispielantwort</summary>

```json
{
  "users": [
    {
      "id": 1,
      "username": "admin",
      "display_name": "Administrator",
      "avatar_color": "#1F9D6B"
    }
  ],
  "groups": [
    {
      "id": 1,
      "name": "wiki-administrators"
    },
    {
      "id": 2,
      "name": "wiki-users"
    }
  ]
}
```

</details>


## Bereich: `admin/system-info`

<a id="area-admin-system-info"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/system-info`

**Systeminformation lesen**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/system-info' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `version` | string | `"5.9.0"` |
| `python` | string | `"3.12.3"` |
| `platform` | string | `"Linux-6.8.0-139-generic-x86_64-with-glibc2.39"` |
| `database` | string | `"postgres"` |
| `env_bind` | string | `"127.0.0.1:8719"` |
| `base_url` | string | `""` |
| `title` | string | `"MGWiki"` |
| `counts` | object |  |
| `counts.users` | integer | `1` |
| `counts.groups` | integer | `2` |
| `counts.spaces` | integer | `1` |
| `counts.pages` | integer | `1` |
| `counts.page_versions` | integer | `1` |
| `counts.comments` | integer | `0` |
| `counts.attachments` | integer | `0` |
| `counts.mail_queue` | integer | `0` |
| `migrations` | array |  |
| `migrations[].number` | integer | `1` |
| `migrations[].name` | string | `"core"` |
| `migrations[].applied_at` | string | `"2026-11-22 07:46:50"` |
| `mail_enabled` | boolean | `false` |
| `microsoft_enabled` | boolean | `false` |
| `data_dir` | string | `"/tmp/apidocs-4jol8o_p"` |

<details><summary>Beispielantwort</summary>

```json
{
  "version": "5.9.0",
  "python": "3.12.3",
  "platform": "Linux-6.8.0-139-generic-x86_64-with-glibc2.39",
  "database": "postgres",
  "env_bind": "127.0.0.1:8719",
  "base_url": "",
  "title": "MGWiki",
  "counts": {
    "users": 1,
    "groups": 2,
    "spaces": 1,
    "pages": 1,
    "page_versions": 1,
    "comments": 0,
    "attachments": 0,
    "mail_queue": 0
  },
  "migrations": [
    {
      "number": 1,
      "name": "core",
      "applied_at": "2026-11-22 07:46:50"
    },
    {
      "number": 2,
      "name": "password_state",
      "applied_at": "2026-11-22 07:46:50"
    },
    "…"
  ],
  "mail_enabled": false,
  "microsoft_enabled": false,
  "data_dir": "/tmp/apidocs-4jol8o_p"
}
```

</details>


## Bereich: `admin/templates`

<a id="area-admin-templates"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/templates`

**Vorlagen auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/templates' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `templates` | array |  |
| `spaces` | array |  |
| `spaces[].id` | integer | `1` |
| `spaces[].name` | string | `"MGWiki demo"` |
| `spaces[].space_key` | string | `"MG"` |

<details><summary>Beispielantwort</summary>

```json
{
  "templates": [],
  "spaces": [
    {
      "id": 1,
      "name": "MGWiki demo",
      "space_key": "MG"
    }
  ]
}
```

</details>

### `POST /api/admin/templates`

**Vorlage anlegen**

- **Wer darf:** Administratoren
- **JSON-Body:** `name`, `space_id`, `description`, `body`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/templates' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name": "…", "space_id": "…", "description": "…", "body": "…"}'
```

**Liefert**

`error`, `id`

### `PUT /api/admin/templates/{template_id}`

**Vorlage ändern**

- **Wer darf:** Administratoren
- **Pfadparameter:** `template_id` (integer)
- **JSON-Body:** `name`, `description`, `space_id`, `body`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/templates/{template_id}' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name": "…", "description": "…", "space_id": "…", "body": "…"}'
```

**Liefert**

`error`, `ok`

### `DELETE /api/admin/templates/{template_id}`

**Vorlage löschen**

- **Wer darf:** Administratoren
- **Pfadparameter:** `template_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/templates/{template_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`


## Bereich: `admin/users`

<a id="area-admin-users"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/users`

**Personen auflisten**

- **Wer darf:** Administratoren
- **Abfrageparameter:** `q` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/users?q=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `users` | array |  |
| `users[].id` | integer | `1` |
| `users[].username` | string | `"admin"` |
| `users[].email` | string | `""` |
| `users[].display_name` | string | `"Administrator"` |
| `users[].job_title` | null | `null` |
| `users[].is_active` | boolean | `true` |
| `users[].is_admin` | boolean | `true` |
| `users[].source` | string | `"local"` |
| `users[].last_login` | string | `"2026-11-22 07:46:50"` |
| `users[].must_change_password` | boolean | `false` |
| `users[].created_at` | string | `"2026-11-22 07:46:50"` |
| `users[].avatar_color` | string | `"#1F9D6B"` |
| `users[].groups` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "users": [
    {
      "id": 1,
      "username": "admin",
      "email": "",
      "display_name": "Administrator",
      "job_title": null,
      "is_active": true,
      "is_admin": true,
      "source": "local",
      "last_login": "2026-11-22 07:46:50",
      "must_change_password": false,
      "created_at": "2026-11-22 07:46:50",
      "avatar_color": "#1F9D6B",
      "groups": [
        "wiki-administrators"
      ]
    }
  ]
}
```

</details>

### `POST /api/admin/users`

**Person anlegen**

- **Wer darf:** Administratoren
- **JSON-Body:** `username`, `password`, `email`, `display_name`, `job_title`, `is_admin`, `groups`, `generated_password`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/users' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"username": "…", "password": "…", "email": "…", "display_name": "…", "job_title": "…", "is_admin": "…", "groups": "…", "generated_password": "…"}'
```

**Liefert**

`error`

### `PUT /api/admin/users/{user_id}`

**Person ändern**

- **Wer darf:** Administratoren
- **Pfadparameter:** `user_id` (integer)
- **JSON-Body:** `password`, `is_active`, `is_admin`, `groups`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/users/{user_id}' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"password": "…", "is_active": "…", "is_admin": "…", "groups": "…"}'
```

**Liefert**

`error`, `user`


## Bereich: `admin/webhooks`

<a id="area-admin-webhooks"></a>

Systemeinstellungen, für Administratoren: Lizenz, Mail, Datenbank, Logo, Ankündigungen, die KI, Identitätsanbieter, Personen, Gruppen und mehr.

### `GET /api/admin/webhooks`

**Webhooks auflisten**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/admin/webhooks' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `webhooks` | array |  |
| `events` | object |  |
| `events.page_created` | string | `"Page created"` |
| `events.page_updated` | string | `"Page updated"` |
| `events.page_deleted` | string | `"Page deleted"` |
| `events.comment_added` | string | `"Comment added"` |
| `events.attachment_added` | string | `"Attachment added"` |
| `events.mention` | string | `"Someone mentioned"` |
| `events.space_created` | string | `"Space created"` |
| `formats` | object |  |
| `formats.teams` | string | `"Teams message card"` |
| `formats.json` | string | `"Plain JSON"` |
| `spaces` | array |  |
| `spaces[].id` | integer | `1` |
| `spaces[].name` | string | `"MGWiki demo"` |
| `spaces[].space_key` | string | `"MG"` |

<details><summary>Beispielantwort</summary>

```json
{
  "webhooks": [],
  "events": {
    "page_created": "Page created",
    "page_updated": "Page updated",
    "page_deleted": "Page deleted",
    "comment_added": "Comment added",
    "attachment_added": "Attachment added",
    "mention": "Someone mentioned",
    "space_created": "Space created"
  },
  "formats": {
    "teams": "Teams message card",
    "json": "Plain JSON"
  },
  "spaces": [
    {
      "id": 1,
      "name": "MGWiki demo",
      "space_key": "MG"
    }
  ]
}
```

</details>

### `POST /api/admin/webhooks`

**Webhook anlegen**

- **Wer darf:** Administratoren

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/webhooks' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `id`

### `PUT /api/admin/webhooks/{webhook_id}`

**Webhook ändern**

- **Wer darf:** Administratoren
- **Pfadparameter:** `webhook_id` (integer)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/admin/webhooks/{webhook_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`

### `DELETE /api/admin/webhooks/{webhook_id}`

**Webhook löschen**

- **Wer darf:** Administratoren
- **Pfadparameter:** `webhook_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/admin/webhooks/{webhook_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`

### `POST /api/admin/webhooks/{webhook_id}/test`

**Testen – Webhook**

<details><summary>Details aus dem Code (englisch)</summary>

Post one message to this endpoint, whatever events it is subscribed to.

</details>

- **Wer darf:** Administratoren
- **Pfadparameter:** `webhook_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/admin/webhooks/{webhook_id}/test' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`, `detail`


## Bereich: `ai`

<a id="area-ai"></a>

Der KI-Assistent: eine Frage stellen (Antwort als Datenstrom von Ereignissen), suchen, Entwürfe, die der Assistent vorbereitet und die Person bestätigt, und Rückmeldungen zu Antworten.

### `POST /api/ai/ask`

**Fragen – KI-Assistent**

<details><summary>Details aus dem Code (englisch)</summary>

Answers as lines of JSON: first what was found, then the answer piece by piece.

</details>

- **Wer darf:** Jede angemeldete Person
- **JSON-Body:** `question`, `previous`, `history`, `conversation`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/ai/ask' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"question": "…", "previous": "…", "history": "…", "conversation": "…"}'
```

**Liefert**

Einen Datenstrom aus JSON-Zeilen (application/x-ndjson), ein Ereignis je Zeile - siehe „Antworten des KI-Assistenten“.

### `GET /api/ai/box`

**KI-Box lesen**

<details><summary>Details aus dem Code (englisch)</summary>

Where the person put the box, and how big they made it - theirs on every browser.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/ai/box' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

```json
{}
```

### `PUT /api/ai/box`

**KI-Box ändern**

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/ai/box' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

Wie `GET /api/ai/box`.

### `POST /api/ai/drafts/{draft_id}/carry-out`

**Ausführen – Entwurf**

<details><summary>Details aus dem Code (englisch)</summary>

The button on a draft: the person confirms, and it is carried out as them.

</details>

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `draft_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/ai/drafts/{draft_id}/carry-out' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`, `message`, `url`, `draft`

### `POST /api/ai/drafts/{draft_id}/discard`

**Verwerfen – Entwurf**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `draft_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/ai/drafts/{draft_id}/discard' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`draft`

### `POST /api/ai/feedback`

**Rückmeldung geben – KI-Assistent**

- **Wer darf:** Jede angemeldete Person
- **JSON-Body:** `question`, `refs`, `good`, `logId`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/ai/feedback' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"question": "…", "refs": "…", "good": "…", "logId": "…"}'
```

**Liefert**

`ok`

### `GET /api/ai/pages-export.{fmt}`

**Pages export.<fmt> als Datei exportieren**

<details><summary>Details aus dem Code (englisch)</summary>

A list of pages as a file - PDF, Excel or CSV - with this person's rights: the spaces
they may see, every page restriction included, as the list in the box.

</details>

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `fmt` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/ai/pages-export.{fmt}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

JSON.

### `POST /api/ai/query`

**Abfrage senden**

<details><summary>Details aus dem Code (englisch)</summary>

The assistant's read-only query, for a caller with the same rights - the probe run and MGHub.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/ai/query' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `GET /api/ai/schema`

**Schema lesen**

<details><summary>Details aus dem Code (englisch)</summary>

The views the assistant queries, as it is told about them - for this person.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/ai/schema' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `views` | string | `"pages(id: page number (join versions.page_id, comments.page` |

<details><summary>Beispielantwort</summary>

```json
{
  "views": "pages(id: page number (join versions.page_id, comments.page_id …), title: its…"
}
```

</details>

### `POST /api/ai/search`

**Suche senden**

- **Wer darf:** Jede angemeldete Person
- **JSON-Body:** `question`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/ai/search' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"question": "…"}'
```

**Liefert**

`items`

### `GET /api/ai/state`

**Zustand lesen – KI-Assistent**

<details><summary>Details aus dem Code (englisch)</summary>

For the box: whether it is shown to this person at all.

</details>

- **Wer darf:** Ohne Anmeldung

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/ai/state' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `box` | boolean | `false` |
| `signedIn` | boolean | `true` |
| `product` | string | `"mgwiki"` |
| `user` | string | `"Administrator"` |

<details><summary>Beispielantwort</summary>

```json
{
  "box": false,
  "signedIn": true,
  "product": "mgwiki",
  "user": "Administrator"
}
```

</details>


## Bereich: `applinks`

<a id="area-applinks"></a>

Anwendungslinks zwischen MGWiki, MGProject und MGService: was eine Installation ist, der Schlüsseltausch beim Verknüpfen durch einen Administrator, das Entfernen eines Links und als wer eine verknüpfte Anfrage gesehen wird.

### `GET /api/applinks/about`

**Lesen, was das ist – applinks**

<details><summary>Details aus dem Code (englisch)</summary>

What this installation is - the first question of an application setting up a link. Open to all.

</details>

- **Wer darf:** Ohne Anmeldung

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/applinks/about' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `product` | string | `"mgwiki"` |
| `product_name` | string | `"MGWiki"` |
| `applinks` | integer | `1` |

<details><summary>Beispielantwort</summary>

```json
{
  "product": "mgwiki",
  "product_name": "MGWiki",
  "applinks": 1
}
```

</details>

### `POST /api/applinks/handshake`

**Schlüssel tauschen – applinks**

<details><summary>Details aus dem Code (englisch)</summary>

The other side of setting up a link: an administrator of this installation (by API token or signed in)
accepts the other application's key and hands over this one's.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/applinks/handshake' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `code`

### `POST /api/applinks/unlink`

**Link entfernen – applinks**

<details><summary>Details aus dem Code (englisch)</summary>

The linked application removed the link - signed by the link itself.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/applinks/unlink' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`

### `GET /api/applinks/whoami`

**Lesen, als wer – applinks**

<details><summary>Details aus dem Code (englisch)</summary>

As whom a request over an application link is seen here - the test of a link.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/applinks/whoami' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `product` | string | `"mgwiki"` |
| `product_name` | string | `"MGWiki"` |
| `username` | string | `"admin"` |
| `display_name` | string | `"Administrator"` |
| `email` | string | `""` |
| `matched_by` | null | `null` |

<details><summary>Beispielantwort</summary>

```json
{
  "product": "mgwiki",
  "product_name": "MGWiki",
  "username": "admin",
  "display_name": "Administrator",
  "email": "",
  "matched_by": null
}
```

</details>


## Bereich: `archive`

<a id="area-archive"></a>

Das Archiv: archivierte Bereiche und Seiten - was darin ist, Seiten und Bereiche dorthin verschieben und wieder herausholen.

### `GET /api/archive`

**Archivieren**

<details><summary>Details aus dem Code (englisch)</summary>

The archive: every space you may read that is archived, or has archived pages you may read, with how
many. Takes "View the archive".

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/archive' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `spaces` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "spaces": []
}
```

</details>

### `GET /api/archive/{key}`

**Archivieren**

<details><summary>Details aus dem Code (englisch)</summary>

One space in the archive: the space (archived or active, with when and by whom), its archived pages
you may read and what you may do with them. Takes "View the archive".

</details>

- **Wer darf:** Berechtigung: `SPACE_VIEW`
- **Pfadparameter:** `key` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/archive/{key}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `space`, `pages`


## Bereich: `attachments`

<a id="area-attachments"></a>

Dateien an Vorgängen oder Seiten: lesen, herunterladen, die Vorschau von Office-Dokumenten, ändern, wer sie sehen darf, und entfernen.

### `GET /api/attachments/{attachment_id}`

**Anhang lesen**

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `attachment_id` (integer)
- **Abfrageparameter:** `dl` (string), `download` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/attachments/{attachment_id}?dl=…&download=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `DELETE /api/attachments/{attachment_id}`

**Anhang löschen**

- **Wer darf:** Berechtigung: `ATTACHMENT_DELETE`
- **Pfadparameter:** `attachment_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/attachments/{attachment_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`

### `GET /api/attachments/{attachment_id}/preview`

**Vorschau – Anhang**

<details><summary>Details aus dem Code (englisch)</summary>

An office document as PDF, converted by LibreOffice on the server.

Without LibreOffice, or for a format it cannot read, this answers 415 and
the viewer offers the download instead.

</details>

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `attachment_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/attachments/{attachment_id}/preview' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `libreoffice`, `mime`, `detail`


## Bereich: `auth`

<a id="area-auth"></a>

An- und Abmelden und das eigene Konto: Passwort, Passkeys, API-Tokens und persönliche Einstellungen.

### `POST /api/auth/login`

**Anmelden – Anmeldung**

- **Wer darf:** Ohne Anmeldung
- **JSON-Body:** `username`, `password`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/auth/login' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"username": "…", "password": "…"}'
```

**Liefert**

`error`, `user`

### `POST /api/auth/logout`

**Abmelden – Anmeldung**

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/auth/logout' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`

### `GET /api/auth/me`

**Eigenes Konto lesen**

- **Wer darf:** Ohne Anmeldung

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/auth/me' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `user` | object |  |
| `user.id` | integer | `1` |
| `user.username` | string | `"admin"` |
| `user.email` | string | `""` |
| `user.display_name` | string | `"Administrator"` |
| `user.avatar_color` | string | `"#1F9D6B"` |
| `user.job_title` | null | `null` |
| `user.is_admin` | boolean | `true` |
| `user.source` | string | `"local"` |
| `user.must_change_password` | boolean | `false` |
| `user.white_pages` | string | `""` |
| `user.personal_space` | null | `null` |
| `user.may_create_personal_space` | boolean | `true` |
| `permissions` | array |  |
| `microsoft_enabled` | boolean | `false` |

<details><summary>Beispielantwort</summary>

```json
{
  "user": {
    "id": 1,
    "username": "admin",
    "email": "",
    "display_name": "Administrator",
    "avatar_color": "#1F9D6B",
    "job_title": null,
    "is_admin": true,
    "source": "local",
    "must_change_password": false,
    "white_pages": "",
    "personal_space": null,
    "may_create_personal_space": true
  },
  "permissions": [
    "ARCHIVE",
    "ATTACH_PROFILE",
    "…"
  ],
  "microsoft_enabled": false
}
```

</details>

### `PUT /api/auth/me/appearance`

**Appearance ändern**

<details><summary>Details aus dem Code (englisch)</summary>

In the dark theme, pages and/or the editor white - everything around them stays dark. Per person.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/auth/me/appearance' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `white_pages`

### `POST /api/auth/password`

**Passwort senden**

<details><summary>Details aus dem Code (englisch)</summary>

Used both for the forced change at first sign-in and voluntarily.

</details>

- **Wer darf:** Jede angemeldete Person
- **JSON-Body:** `current_password`, `new_password`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/auth/password' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"current_password": "…", "new_password": "…"}'
```

**Liefert**

`error`, `ok`


## Bereich: `comments`

<a id="area-comments"></a>

Kommentare: ändern und löschen. Neue Kommentare werden am Vorgang bzw. an der Seite angelegt.

### `PUT /api/comments/{comment_id}`

**Kommentar ändern**

<details><summary>Details aus dem Code (englisch)</summary>

Correct a comment.

Own words are one's own to correct. Somebody else's take the right to
moderate comments in that space - the same right that allows deleting them,
because being able to rewrite what another person said is at least as
far-reaching as removing it.

The page it belongs to never changes, and neither does the author: an edit
corrects what was said, it does not transfer it.

</details>

- **Wer darf:** Berechtigung: `COMMENT_DELETE`
- **Pfadparameter:** `comment_id` (integer)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/comments/{comment_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `DELETE /api/comments/{comment_id}`

**Kommentar löschen**

- **Wer darf:** Berechtigung: `COMMENT_DELETE`
- **Pfadparameter:** `comment_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/comments/{comment_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`


## Bereich: `dashboard`

<a id="area-dashboard"></a>

Die Startseite einer Person: was auf sie wartet.

### `GET /api/dashboard`

**Dashboard lesen**

- **Wer darf:** Ohne Anmeldung

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/dashboard' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `recent` | array |  |
| `recent[].id` | integer | `1` |
| `recent[].space_id` | integer | `1` |
| `recent[].parent_id` | null | `null` |
| `recent[].type` | string | `"page"` |
| `recent[].title` | string | `"MGWiki demo"` |
| `recent[].slug` | string | `"mgwiki-demo"` |
| `recent[].version` | integer | `1` |
| `recent[].status` | string | `"current"` |
| `recent[].excerpt` | string | `"Welcome"` |
| `recent[].created_by` | object |  |
| `recent[].created_at` | string | `"2026-11-22 07:46:50"` |
| `recent[].updated_by` | object |  |
| `recent[].updated_at` | string | `"2026-11-22 07:46:50"` |
| `recent[].space` | object |  |
| `my_pages` | array |  |
| `my_pages[].id` | integer | `1` |
| `my_pages[].space_id` | integer | `1` |
| `my_pages[].parent_id` | null | `null` |
| `my_pages[].type` | string | `"page"` |
| `my_pages[].title` | string | `"MGWiki demo"` |
| `my_pages[].slug` | string | `"mgwiki-demo"` |
| `my_pages[].version` | integer | `1` |
| `my_pages[].status` | string | `"current"` |
| `my_pages[].excerpt` | string | `"Welcome"` |
| `my_pages[].created_by` | object |  |
| `my_pages[].created_at` | string | `"2026-11-22 07:46:50"` |
| `my_pages[].updated_by` | object |  |
| `my_pages[].updated_at` | string | `"2026-11-22 07:46:50"` |
| `my_pages[].space` | object |  |
| `favourites` | array |  |
| `viewed` | array |  |
| `viewed[].id` | integer | `1` |
| `viewed[].space_id` | integer | `1` |
| `viewed[].parent_id` | null | `null` |
| `viewed[].type` | string | `"page"` |
| `viewed[].title` | string | `"MGWiki demo"` |
| `viewed[].slug` | string | `"mgwiki-demo"` |
| `viewed[].version` | integer | `1` |
| `viewed[].status` | string | `"current"` |

<details><summary>Beispielantwort</summary>

```json
{
  "recent": [
    {
      "id": 1,
      "space_id": 1,
      "parent_id": null,
      "type": "page",
      "title": "MGWiki demo",
      "slug": "mgwiki-demo",
      "version": 1,
      "status": "current",
      "excerpt": "Welcome",
      "created_by": {
        "id": 1,
        "username": "admin",
        "display_name": "Administrator",
        "avatar_color": "#1F9D6B",
        "active": true
      },
      "created_at": "2026-11-22 07:46:50",
      "updated_by": {
        "id": 1,
        "username": "admin",
        "display_name": "Administrator",
        "avatar_color": "#1F9D6B",
        "active": true
      },
      "updated_at": "2026-11-22 07:46:50",
      "space": {
        "key": "MG",
        "name": "MGWiki demo",
        "color": "#E07B39"
      }
    }
  ],
  "my_pages": [
    {
      "id": 1,
      "space_id": 1,
      "parent_id": null,
      "type": "page",
      "title": "MGWiki demo",
      "slug": "mgwiki-demo",
      "version": 1,
      "status": "current",
      "excerpt": "Welcome",
      "created_by": {
        "id": 1,
        "username": "admin",
        "display_name": "Administrator",
        "avatar_color": "#1F9D6B",
        "active": true
      },
      "created_at": "2026-11-22 07:46:50",
      "updated_by": {
        "id": 1,
        "username": "admin",
        "display_name": "Administrator",
        "avatar_color": "#1F9D6B",
        "active": true
      },
      "updated_at": "2026-11-22 07:46:50",
      "space": {
        "key": "MG",
        "name": "MGWiki demo",
        "color": "#E07B39"
      }
    }
  ],
  "favourites": [],
  "viewed": [
    {
      "id": 1,
      "space_id": 1,
      "parent_id": null,
      "type": "page",
      "title": "MGWiki demo",
      "slug": "mgwiki-demo",
      "version": 1,
      "status"
…
```

</details>


## Bereich: `health`

<a id="area-health"></a>

Für die Überwachung: ob der Dienst antwortet und im Detail, wie es um ihn steht.

### `GET /api/health`

**Gesundheitsprüfung lesen**

<details><summary>Details aus dem Code (englisch)</summary>

Is the service there at all - the question a load balancer asks.

Deliberately thin: the details live one level down, so that something a
monitoring system wants to see cannot make a deployment or a balancer
believe the service is unwell.

</details>

- **Wer darf:** Ohne Anmeldung

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/health' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `product` | string | `"mgwiki"` |
| `status` | string | `"ok"` |
| `version` | string | `"5.9.0"` |

<details><summary>Beispielantwort</summary>

```json
{
  "product": "mgwiki",
  "status": "ok",
  "version": "5.9.0"
}
```

</details>

### `GET /api/health/details`

**Details lesen**

<details><summary>Details aus dem Code (englisch)</summary>

For monitoring: answers to an administrator, or to the server itself.

</details>

- **Wer darf:** Ohne Anmeldung

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/health/details' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `status` | string | `"degraded"` |
| `version` | string | `"5.9.0"` |
| `checks` | object |  |
| `checks.database` | object |  |
| `checks.database.ok` | boolean | `true` |
| `checks.database.backend` | string | `"postgres"` |
| `checks.database.latencyMs` | number | `0.2` |
| `checks.migrations` | object |  |
| `checks.migrations.ok` | boolean | `true` |
| `checks.migrations.current` | integer | `35` |
| `checks.migrations.latest` | integer | `35` |
| `checks.backgroundJobs` | object |  |
| `checks.backgroundJobs.ok` | boolean | `false` |
| `checks.backgroundJobs.leaseUntil` | null | `null` |
| `checks.backgroundJobs.holder` | null | `null` |
| `checks.backgroundJobs.note` | string | `"no background process has reported yet"` |
| `checks.disk` | object |  |
| `checks.disk.ok` | boolean | `true` |
| `checks.disk.freeMb` | integer | `85129` |

<details><summary>Beispielantwort</summary>

```json
{
  "status": "degraded",
  "version": "5.9.0",
  "checks": {
    "database": {
      "ok": true,
      "backend": "postgres",
      "latencyMs": 0.2
    },
    "migrations": {
      "ok": true,
      "current": 35,
      "latest": 35
    },
    "backgroundJobs": {
      "ok": false,
      "leaseUntil": null,
      "holder": null,
      "note": "no background process has reported yet"
    },
    "disk": {
      "ok": true,
      "freeMb": 85129
    }
  }
}
```

</details>


## Bereich: `links`

<a id="area-links"></a>

Verknüpfungen zwischen Vorgängen (blockiert, hängt zusammen mit …) bzw. die Schnelllinks der Navigation.

### `GET /api/links`

**Verknüpfungen auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

What the menu shows everybody. The address comes along because the menu
has to link somewhere; only the text is drawn.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/links' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `links` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "links": []
}
```

</details>


## Bereich: `macros`

<a id="area-macros"></a>

Daten hinter den Makros in Seiten.

### `POST /api/macros/axproject`

**Anbindung an MGProject senden**

<details><summary>Details aus dem Code (englisch)</summary>

What one macro on a page should show, fetched now.

Called every time a page is opened, and again when somebody presses the
refresh arrow - the point of the macro is that it is not a copy of how
things looked when the page was written.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/macros/axproject' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `GET /api/macros/fields`

**Felder auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

Every field the MGProject and the MGService macro can show, and what each shows by default.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/macros/fields' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `axproject` | object |  |
| `axproject.fields` | array |  |
| `axproject.fields[].key` | string | `"key"` |
| `axproject.fields[].label` | string | `"Key"` |
| `axproject.defaults` | array |  |
| `mgservice` | object |  |
| `mgservice.fields` | array |  |
| `mgservice.fields[].key` | string | `"key"` |
| `mgservice.fields[].label` | string | `"Key"` |
| `mgservice.defaults` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "axproject": {
    "fields": [
      {
        "key": "key",
        "label": "Key"
      },
      {
        "key": "summary",
        "label": "Summary"
      },
      "…"
    ],
    "defaults": [
      "key",
      "summary",
      "…"
    ]
  },
  "mgservice": {
    "fields": [
      {
        "key": "key",
        "label": "Key"
      },
      {
        "key": "summary",
        "label": "Summary"
      },
      "…"
    ],
    "defaults": [
      "key",
      "summary",
      "…"
    ]
  }
}
```

</details>

### `POST /api/macros/mgservice`

**Anbindung an MGService senden**

<details><summary>Details aus dem Code (englisch)</summary>

What one MGService macro on a page shows, fetched now, as you: the open tickets of a service project
(mode project) or the tickets matching a query (mode mql).

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/macros/mgservice' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`


## Bereich: `me`

<a id="area-me"></a>

Die angemeldete Person: Profil, Einstellungen, beobachtete oder eigene Seiten.

### `GET /api/me/axproject`

**Anbindung an MGProject lesen**

<details><summary>Details aus dem Code (englisch)</summary>

Whether there is an application link to MGProject (5.8.0: set up by an administrator, no personal
connection any more).

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/me/axproject' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `configured` | boolean | `false` |
| `base_url` | string | `""` |
| `name` | string | `""` |

<details><summary>Beispielantwort</summary>

```json
{
  "configured": false,
  "base_url": "",
  "name": ""
}
```

</details>

### `GET /api/me/axproject/boards`

**Boards auflisten**

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/me/axproject/boards' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`boards`

### `GET /api/me/axproject/boards/{board_id}/sprints`

**Sprints auflisten (Board)**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `board_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/me/axproject/boards/{board_id}/sprints' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`sprints`

### `GET /api/me/mgservice`

**Anbindung an MGService lesen**

<details><summary>Details aus dem Code (englisch)</summary>

Whether there is an application link to MGService.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/me/mgservice' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `configured` | boolean | `false` |
| `base_url` | string | `""` |
| `name` | string | `""` |

<details><summary>Beispielantwort</summary>

```json
{
  "configured": false,
  "base_url": "",
  "name": ""
}
```

</details>

### `GET /api/me/mgservice/projects`

**Projekte auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

The service projects you see in MGService - for the macro dialog.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/me/mgservice/projects' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`projects`

### `GET /api/me/tokens`

**API-Tokens auflisten**

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/me/tokens' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `tokens` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "tokens": []
}
```

</details>

### `POST /api/me/tokens`

**API-Token anlegen**

<details><summary>Details aus dem Code (englisch)</summary>

Issue a token. The plain text is in this answer and nowhere else.

</details>

- **Wer darf:** Jede angemeldete Person
- **JSON-Body:** `days`, `name`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/me/tokens' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"days": "…", "name": "…"}'
```

**Liefert**

Wie `GET /api/me/tokens`.

### `DELETE /api/me/tokens/{token_id}`

**API-Token löschen**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `token_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/me/tokens/{token_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`


## Bereich: `notifications`

<a id="area-notifications"></a>

Hinweise im Browser für die angemeldete Person.

### `GET /api/notifications/pending`

**Offene Einträge auflisten**

<details><summary>Details aus dem Code (englisch)</summary>

What the browser has not shown yet, handed over once.

Marked as delivered as it is read: a message shown twice is worse than one
missed, and a second tab would otherwise repeat everything.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/notifications/pending' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `notices` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "notices": []
}
```

</details>

### `POST /api/notifications/test`

**Testen – Benachrichtigung**

<details><summary>Details aus dem Code (englisch)</summary>

Put one notice in this person's own queue.

The whole chain is otherwise hard to check: whoever does something is left
out of its notices on purpose, so the obvious test - edit a page and watch -
shows nothing and looks broken.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/notifications/test' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`queued`


## Bereich: `pages`

<a id="area-pages"></a>

Seiten: lesen, schreiben, Versionen, der Seitenbaum, Kommentare, Anhänge, Labels, Einschränkungen, Beobachten, Export.

### `POST /api/pages`

**Seite anlegen**

- **Wer darf:** Jede angemeldete Person
- **JSON-Body:** `space_id`, `parent_id`, `type`, `body`, `title`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"space_id": "…", "parent_id": "…", "type": "…", "body": "…", "title": "…"}'
```

**Liefert**

`error`, `page`

### `PUT /api/pages/order`

**Reihenfolge ändern**

<details><summary>Details aus dem Code (englisch)</summary>

The order somebody dragged a set of siblings into.

All of them are numbered, not only the one that moved: half a list with
numbers and half without would order by the numbers first and look shuffled.

</details>

- **Wer darf:** Berechtigung: `PAGE_EDIT`
- **JSON-Body:** `ids`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/pages/order' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"ids": "…"}'
```

**Liefert**

`error`, `ok`

### `POST /api/pages/order/reset`

**Zurücksetzen – Reihenfolge**

<details><summary>Details aus dem Code (englisch)</summary>

Back to the alphabet for one group.

Setting every position to nought is what alphabetical means here, so this
is genuinely undoing the arrangement rather than replacing it with another.

</details>

- **Wer darf:** Berechtigung: `PAGE_EDIT`
- **JSON-Body:** `space_id`, `parent_id`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/order/reset' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"space_id": "…", "parent_id": "…"}'
```

**Liefert**

`error`, `ok`

### `GET /api/pages/{page_id}`

**Seite lesen**

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pages/{page_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `page` | object |  |
| `page.id` | integer | `1` |
| `page.space_id` | integer | `1` |
| `page.parent_id` | null | `null` |
| `page.type` | string | `"page"` |
| `page.title` | string | `"MGWiki demo"` |
| `page.slug` | string | `"mgwiki-demo"` |
| `page.version` | integer | `1` |
| `page.status` | string | `"current"` |
| `page.excerpt` | string | `"Welcome"` |
| `page.created_by` | object |  |
| `page.created_by.id` | integer | `1` |
| `page.created_by.username` | string | `"admin"` |
| `page.created_by.display_name` | string | `"Administrator"` |
| `page.created_by.avatar_color` | string | `"#1F9D6B"` |
| `page.created_by.active` | boolean | `true` |
| `page.created_at` | string | `"2026-11-22 07:46:50"` |
| `page.updated_by` | object |  |
| `page.updated_by.id` | integer | `1` |
| `page.updated_by.username` | string | `"admin"` |
| `page.updated_by.display_name` | string | `"Administrator"` |
| `page.updated_by.avatar_color` | string | `"#1F9D6B"` |
| `page.updated_by.active` | boolean | `true` |
| `page.updated_at` | string | `"2026-11-22 07:46:50"` |
| `page.body` | string | `"<h2>Welcome</h2><p>This is the home page of the demo space.` |
| `page.toc` | array |  |
| `page.space` | object |  |
| `page.space.id` | integer | `1` |
| `page.space.key` | string | `"MG"` |
| `page.space.name` | string | `"MGWiki demo"` |
| `page.space.color` | string | `"#E07B39"` |
| `page.space.personal` | boolean | `false` |
| `page.breadcrumbs` | array |  |
| `page.labels` | array |  |
| `page.can_edit` | boolean | `true` |
| `page.archived` | null | `null` |
| `page.can_archive` | boolean | `true` |
| `page.can_restore` | boolean | `false` |
| `page.archive_visible` | boolean | `true` |
| `page.archive_children` | integer | `0` |

<details><summary>Beispielantwort</summary>

```json
{
  "page": {
    "id": 1,
    "space_id": 1,
    "parent_id": null,
    "type": "page",
    "title": "MGWiki demo",
    "slug": "mgwiki-demo",
    "version": 1,
    "status": "current",
    "excerpt": "Welcome",
    "created_by": {
      "id": 1,
      "username": "admin",
      "display_name": "Administrator",
      "avatar_color": "#1F9D6B",
      "active": true
    },
    "created_at": "2026-11-22 07:46:50",
    "updated_by": {
      "id": 1,
      "username": "admin",
      "display_name": "Administrator",
      "avatar_color": "#1F9D6B",
      "active": true
    },
    "updated_at": "2026-11-22 07:46:50",
    "body": "<h2>Welcome</h2><p>This is the home page of the demo space. Use <b>Create</b>…",
    "toc": [],
    "space": {
      "id": 1,
      "key": "MG",
      "name": "MGWiki demo",
      "color": "#E07B39",
      "personal": false
    },
    "breadcrumbs": [],
    "labels": [],
    "can_edit": true,
    "archived": null,
    "can_archive": true,
    "can_restore": false,
    "archive_visible": true,
    "archive_children": 0,
    "can_export_pdf": true
  }
}
```

</details>

### `PUT /api/pages/{page_id}`

**Seite ändern**

- **Wer darf:** Berechtigung: `edit`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `title`, `body`, `base_version`, `comment`, `minor_edit`, `parent_id`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/pages/{page_id}' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"title": "…", "body": "…", "base_version": "…", "comment": "…", "minor_edit": "…", "parent_id": "…"}'
```

**Liefert**

`error`, `code`, `page`, `merged`, `conflicts`

### `DELETE /api/pages/{page_id}`

**Seite löschen**

- **Wer darf:** Berechtigung: `PAGE_DELETE`
- **Pfadparameter:** `page_id` (integer)
- **Abfrageparameter:** `purge` (string)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/pages/{page_id}?purge=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`

### `POST /api/pages/{page_id}/archive`

**Archivieren – Seite**

<details><summary>Details aus dem Code (englisch)</summary>

Archive a page - with the pages below it (children: true, the default) or without them: then they move
up a level and stay. Takes "Archive pages" in its space.

</details>

- **Wer darf:** Berechtigung: `view`, `PAGE_ARCHIVE`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `children`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/archive' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"children": "…"}'
```

**Liefert**

`error`, `ok`, `archived`, `visible`

### `POST /api/pages/{page_id}/attachments`

**Anhang anlegen (Seite)**

- **Wer darf:** Berechtigung: `ATTACHMENT_ADD`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `(multipart form: file)`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/attachments' \
  -H 'Authorization: Bearer $TOKEN' \
  -F 'file=@/path/to/file'
```

**Liefert**

`error`, `attachment`, `id`, `filename`, `size_bytes`, `mime_type`

### `PUT /api/pages/{page_id}/attachments/order`

**Reihenfolge ändern (Seite)**

<details><summary>Details aus dem Code (englisch)</summary>

The order somebody dragged them into.

</details>

- **Wer darf:** Berechtigung: `edit`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/pages/{page_id}/attachments/order' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`

### `GET /api/pages/{page_id}/comments`

**Kommentare auflisten (Seite)**

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pages/{page_id}/comments' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `comments` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "comments": []
}
```

</details>

### `POST /api/pages/{page_id}/comments`

**Kommentar anlegen (Seite)**

- **Wer darf:** Berechtigung: `view`, `COMMENT_ADD`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `body`, `parent_id`, `anchor`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/comments' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"body": "…", "parent_id": "…", "anchor": "…"}'
```

**Liefert**

`error`, `comment`

### `GET /api/pages/{page_id}/draft`

**Entwurf anlegen – Seite**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pages/{page_id}/draft' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `draft` | null | `null` |

<details><summary>Beispielantwort</summary>

```json
{
  "draft": null
}
```

</details>

### `POST /api/pages/{page_id}/draft`

**Entwurf anlegen – Seite**

<details><summary>Details aus dem Code (englisch)</summary>

Keep unsaved work where a closed browser cannot take it with it.

The draft belongs to one person on one page: it is what they were writing,
not a version of the page, and nobody else ever sees it.

</details>

- **Wer darf:** Berechtigung: `edit`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `title`, `body`, `base_version`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/draft' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"title": "…", "body": "…", "base_version": "…"}'
```

**Liefert**

`error`, `ok`, `saved_at`

### `PUT /api/pages/{page_id}/draft`

**Entwurf anlegen – Seite**

<details><summary>Details aus dem Code (englisch)</summary>

Keep unsaved work where a closed browser cannot take it with it.

The draft belongs to one person on one page: it is what they were writing,
not a version of the page, and nobody else ever sees it.

</details>

- **Wer darf:** Berechtigung: `edit`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `title`, `body`, `base_version`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/pages/{page_id}/draft' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"title": "…", "body": "…", "base_version": "…"}'
```

**Liefert**

`error`, `ok`, `saved_at`

### `DELETE /api/pages/{page_id}/draft`

**Entwurf anlegen – Seite**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/pages/{page_id}/draft' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`ok`

### `POST /api/pages/{page_id}/editing`

**Als in Bearbeitung markieren – Seite**

<details><summary>Details aus dem Code (englisch)</summary>

A heartbeat from somebody with the page open, and who else is in it.

Deliberately one call: the browser has to say it is still here anyway, and
making it ask separately who else is here would double the traffic for
nothing.

</details>

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `block`, `leaving`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/editing' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"block": "…", "leaving": "…"}'
```

**Liefert**

`error`, `editors`

### `GET /api/pages/{page_id}/export.pdf`

**Exportieren – Seite**

<details><summary>Details aus dem Code (englisch)</summary>

The page as a PDF (pdf_export.py) - for whoever may open it and has "Export pages as PDF". POST takes a
header and a footer (5.6.0): {header_html, footer_html, first_page_different} - printed on every page, or
from the second page on; {page}, {pages}, {title}, {space}, {date} and {user} are filled in.

</details>

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pages/{page_id}/export.pdf' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

Eine Datei (application/pdf).

### `POST /api/pages/{page_id}/export.pdf`

**Exportieren – Seite**

<details><summary>Details aus dem Code (englisch)</summary>

The page as a PDF (pdf_export.py) - for whoever may open it and has "Export pages as PDF". POST takes a
header and a footer (5.6.0): {header_html, footer_html, first_page_different} - printed on every page, or
from the second page on; {page}, {pages}, {title}, {space}, {date} and {user} are filled in.

</details>

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/export.pdf' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`

### `POST /api/pages/{page_id}/favourite`

**Favorit anlegen (Seite)**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/favourite' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`favourite`

### `PUT /api/pages/{page_id}/labels`

**Labels ändern (Seite)**

- **Wer darf:** Berechtigung: `edit`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/pages/{page_id}/labels' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `labels`

### `POST /api/pages/{page_id}/move`

**Verschieben – Seite**

- **Wer darf:** Berechtigung: `edit`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `parent_id`, `space_id`, `position`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/move' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"parent_id": "…", "space_id": "…", "position": "…"}'
```

**Liefert**

`error`, `ok`

### `POST /api/pages/{page_id}/restore`

**Wiederherstellen – Seite**

<details><summary>Details aus dem Code (englisch)</summary>

Take an archived page out of the archive, with what was archived below it: back where it was - or,
with parent_id, under that active page of the same space (null: the top). Takes "View the archive" and
"Archive pages" in its space; a page of an archived space comes back with the space.

</details>

- **Wer darf:** Berechtigung: `view`, `PAGE_ARCHIVE`
- **Pfadparameter:** `page_id` (integer)
- **JSON-Body:** `parent_id`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/restore' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"parent_id": "…"}'
```

**Liefert**

`error`

### `GET /api/pages/{page_id}/restrictions`

**Einschränkungen auflisten (Seite)**

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pages/{page_id}/restrictions' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `restrictions` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "restrictions": []
}
```

</details>

### `PUT /api/pages/{page_id}/restrictions`

**Einschränkungen ändern (Seite)**

- **Wer darf:** Berechtigung: `RESTRICTIONS_SET`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/pages/{page_id}/restrictions' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`, `withdrawn_from_help_site`

### `GET /api/pages/{page_id}/subtree`

**Teilbaum lesen (Seite)**

<details><summary>Details aus dem Code (englisch)</summary>

The pages under this one, as deep as asked for.

Each level is filtered by what the person asking may see, so a restricted
branch simply is not there rather than showing as a title they cannot open.

</details>

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer)
- **Abfrageparameter:** `depth` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pages/{page_id}/subtree?depth=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `pages` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "pages": []
}
```

</details>

### `GET /api/pages/{page_id}/versions`

**Versionen auflisten (Seite)**

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pages/{page_id}/versions' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `versions` | array |  |
| `versions[].id` | integer | `1` |
| `versions[].version` | integer | `1` |
| `versions[].title` | string | `"MGWiki demo"` |
| `versions[].comment` | string | `"Created"` |
| `versions[].minor_edit` | integer | `0` |
| `versions[].created_at` | string | `"2026-11-22 07:46:50"` |
| `versions[].editor` | object |  |

<details><summary>Beispielantwort</summary>

```json
{
  "versions": [
    {
      "id": 1,
      "version": 1,
      "title": "MGWiki demo",
      "comment": "Created",
      "minor_edit": 0,
      "created_at": "2026-11-22 07:46:50",
      "editor": {
        "id": 1,
        "username": "admin",
        "display_name": "Administrator",
        "avatar_color": "#1F9D6B",
        "active": true
      }
    }
  ]
}
```

</details>

### `GET /api/pages/{page_id}/versions/{version}`

**Version lesen (Seite)**

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `page_id` (integer), `version` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pages/{page_id}/versions/{version}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `version` | object |  |
| `version.id` | integer | `1` |
| `version.page_id` | integer | `1` |
| `version.version` | integer | `1` |
| `version.title` | string | `"MGWiki demo"` |
| `version.body` | string | `"<h2>Welcome</h2>"` |
| `version.comment` | string | `"Created"` |
| `version.minor_edit` | integer | `0` |
| `version.created_at` | string | `"2026-11-22 07:46:50"` |
| `version.editor` | object |  |
| `version.editor.id` | integer | `1` |
| `version.editor.username` | string | `"admin"` |
| `version.editor.display_name` | string | `"Administrator"` |
| `version.editor.avatar_color` | string | `"#1F9D6B"` |
| `version.editor.active` | boolean | `true` |

<details><summary>Beispielantwort</summary>

```json
{
  "version": {
    "id": 1,
    "page_id": 1,
    "version": 1,
    "title": "MGWiki demo",
    "body": "<h2>Welcome</h2>",
    "comment": "Created",
    "minor_edit": 0,
    "created_at": "2026-11-22 07:46:50",
    "editor": {
      "id": 1,
      "username": "admin",
      "display_name": "Administrator",
      "avatar_color": "#1F9D6B",
      "active": true
    }
  }
}
```

</details>

### `POST /api/pages/{page_id}/versions/{version}/restore`

**Wiederherstellen – Version**

- **Wer darf:** Berechtigung: `edit`
- **Pfadparameter:** `page_id` (integer), `version` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/versions/{version}/restore' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`, `version`

### `POST /api/pages/{page_id}/watch`

**Beobachten oder nicht mehr beobachten – Seite**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `page_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pages/{page_id}/watch' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`watching`


## Bereich: `pdf-layouts`

<a id="area-pdf-layouts"></a>

### `GET /api/pdf-layouts`

**Pdf layouts lesen**

<details><summary>Details aus dem Code (englisch)</summary>

This person's headers and footers - each belongs to whoever kept it, nobody else sees it.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/pdf-layouts' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `layouts` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "layouts": []
}
```

</details>

### `POST /api/pdf-layouts`

**Pdf layouts senden**

<details><summary>Details aus dem Code (englisch)</summary>

Kept under a name; the same name again replaces it.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/pdf-layouts' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `layout`

### `DELETE /api/pdf-layouts/{layout_id}`

**Pdf layouts löschen**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `layout_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/pdf-layouts/{layout_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`


## Bereich: `search`

<a id="area-search"></a>

Vorgänge mit MQL suchen und das Ergebnis exportieren.

### `GET /api/search`

**Suche lesen**

<details><summary>Details aus dem Code (englisch)</summary>

Pages and spaces by a piece of text (q, at least 2 characters) - optionally in one space (space_id);
archived=1 takes in the archived pages too, for whoever may see the archive.

</details>

- **Wer darf:** Berechtigung: `view`
- **Abfrageparameter:** `q` (string), `space_id` (string), `archived` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/search?q=…&space_id=…&archived=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `results` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "results": []
}
```

</details>


## Bereich: `spaces`

<a id="area-spaces"></a>

Bereiche: anlegen, ihre Berechtigungen, der Seitenbaum, Vorlagen und Labels.

### `GET /api/spaces`

**Bereiche auflisten**

- **Wer darf:** Ohne Anmeldung
- **Abfrageparameter:** `archived` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/spaces?archived=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `spaces` | array |  |
| `spaces[].id` | integer | `1` |
| `spaces[].key` | string | `"MG"` |
| `spaces[].name` | string | `"MGWiki demo"` |
| `spaces[].description` | string | `"A place to try things out"` |
| `spaces[].type` | string | `"global"` |
| `spaces[].icon` | string | `"book"` |
| `spaces[].color` | string | `"#E07B39"` |
| `spaces[].status` | string | `"current"` |
| `spaces[].homepage_id` | integer | `1` |
| `spaces[].owner_id` | integer | `1` |
| `spaces[].personal` | boolean | `false` |
| `spaces[].owner_name` | null | `null` |
| `spaces[].permissions` | array |  |
| `spaces[].can_delete` | boolean | `true` |
| `spaces[].archived_at` | null | `null` |

<details><summary>Beispielantwort</summary>

```json
{
  "spaces": [
    {
      "id": 1,
      "key": "MG",
      "name": "MGWiki demo",
      "description": "A place to try things out",
      "type": "global",
      "icon": "book",
      "color": "#E07B39",
      "status": "current",
      "homepage_id": 1,
      "owner_id": 1,
      "personal": false,
      "owner_name": null,
      "permissions": [
        "ATTACHMENT_ADD",
        "ATTACHMENT_DELETE",
        "…"
      ],
      "can_delete": true,
      "archived_at": null
    }
  ]
}
```

</details>

### `POST /api/spaces`

**Bereich anlegen**

- **Wer darf:** Berechtigung: `CREATE_SPACE`
- **JSON-Body:** `name`, `key`, `color`, `description`, `icon`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/spaces' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name": "…", "key": "…", "color": "…", "description": "…", "icon": "…"}'
```

**Liefert**

`error`, `space`

### `GET /api/spaces/palette`

**Farbpalette lesen**

<details><summary>Details aus dem Code (englisch)</summary>

The colours a space may carry, and the one that would be picked now.

The suggestion is what happens if nobody chooses: away from what the last
few spaces took. Offering it rather than imposing it means the common case
stays one click and the deliberate case stays possible.

</details>

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/spaces/palette' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `colors` | array |  |
| `suggested` | string | `"#5B8C2A"` |

<details><summary>Beispielantwort</summary>

```json
{
  "colors": [
    "#50226B",
    "#6B5BC4",
    "…"
  ],
  "suggested": "#5B8C2A"
}
```

</details>

### `POST /api/spaces/personal`

**Personal senden**

<details><summary>Details aus dem Code (englisch)</summary>

One's own personal space - with "Create a personal space" alone, also for somebody who may otherwise only
edit what exists. One each; asked again, it answers the one there is.

</details>

- **Wer darf:** Berechtigung: `PERSONAL_SPACE`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/spaces/personal' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `space`, `existing`

### `GET /api/spaces/{key}`

**Bereich lesen**

- **Wer darf:** Berechtigung: `view`
- **Pfadparameter:** `key` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/spaces/{key}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `space` | object |  |
| `space.id` | integer | `1` |
| `space.key` | string | `"MG"` |
| `space.name` | string | `"MGWiki demo"` |
| `space.description` | string | `"A place to try things out"` |
| `space.type` | string | `"global"` |
| `space.icon` | string | `"book"` |
| `space.color` | string | `"#E07B39"` |
| `space.status` | string | `"current"` |
| `space.homepage_id` | integer | `1` |
| `space.owner_id` | integer | `1` |
| `space.personal` | boolean | `false` |
| `space.owner_name` | null | `null` |
| `space.permissions` | array |  |
| `space.can_delete` | boolean | `true` |
| `space.archived_at` | null | `null` |

<details><summary>Beispielantwort</summary>

```json
{
  "space": {
    "id": 1,
    "key": "MG",
    "name": "MGWiki demo",
    "description": "A place to try things out",
    "type": "global",
    "icon": "book",
    "color": "#E07B39",
    "status": "current",
    "homepage_id": 1,
    "owner_id": 1,
    "personal": false,
    "owner_name": null,
    "permissions": [
      "ATTACHMENT_ADD",
      "ATTACHMENT_DELETE",
      "…"
    ],
    "can_delete": true,
    "archived_at": null
  }
}
```

</details>

### `PUT /api/spaces/{space_id}`

**Bereich ändern**

- **Wer darf:** Berechtigung: `SPACE_ADMIN`, `SPACE_ARCHIVE`
- **Pfadparameter:** `space_id` (integer)
- **JSON-Body:** `status`, `space_key`, `key`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/spaces/{space_id}' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"status": "…", "space_key": "…", "key": "…"}'
```

**Liefert**

`error`, `space`

### `DELETE /api/spaces/{space_id}`

**Bereich löschen**

- **Wer darf:** Berechtigung: `SPACE_ADMIN`
- **Pfadparameter:** `space_id` (integer)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/spaces/{space_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`, `name`, `pages`, `files`

### `GET /api/spaces/{space_id}/access-log`

**Access log lesen (Bereich)**

<details><summary>Details aus dem Code (englisch)</summary>

Who of the administrators opened or changed something in this personal space - for its owner (and the
administrators). Looked at by the owner, nothing in it counts as new any more.

</details>

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `space_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/spaces/{space_id}/access-log' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `entries`, `unseen`

### `PUT /api/spaces/{space_id}/admin-access`

**Admin access ändern (Bereich)**

<details><summary>Details aus dem Code (englisch)</summary>

The owner of a personal space shuts administrators out - or lets them in again. Shut, nobody but the owner
gets in: not the space, its pages and files, the list of spaces, the search, the AI or the database pages
of System settings. The owner's decision alone; written into the audit log.

</details>

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `space_id` (integer)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/spaces/{space_id}/admin-access' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `admins_excluded`

### `POST /api/spaces/{space_id}/archive`

**Archivieren – Bereich**

<details><summary>Details aus dem Code (englisch)</summary>

Archive a whole space with all its pages. Takes "Archive the space" in it; a personal space its owner.

</details>

- **Wer darf:** Berechtigung: `SPACE_ARCHIVE`
- **Pfadparameter:** `space_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/spaces/{space_id}/archive' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`, `pages`, `visible`

### `GET /api/spaces/{space_id}/members`

**Mitglieder auflisten (Bereich)**

<details><summary>Details aus dem Code (englisch)</summary>

Who can be mentioned here: the people who may read this space.

Anyone else would be told about a page they cannot open, which is worse
than not being told at all.

</details>

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `space_id` (integer)
- **Abfrageparameter:** `q` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/spaces/{space_id}/members?q=…' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `members` | array |  |
| `members[].id` | integer | `1` |
| `members[].username` | string | `"admin"` |
| `members[].display_name` | string | `"Administrator"` |
| `members[].avatar_color` | string | `"#1F9D6B"` |

<details><summary>Beispielantwort</summary>

```json
{
  "members": [
    {
      "id": 1,
      "username": "admin",
      "display_name": "Administrator",
      "avatar_color": "#1F9D6B"
    }
  ]
}
```

</details>

### `GET /api/spaces/{space_id}/permissions`

**Berechtigungen auflisten (Bereich)**

- **Wer darf:** Berechtigung: `SPACE_ADMIN`
- **Pfadparameter:** `space_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/spaces/{space_id}/permissions' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `available` | array |  |
| `available[].key` | string | `"SPACE_VIEW"` |
| `available[].label` | string | `"View the space"` |
| `subjects` | array |  |
| `subjects[].subject_type` | string | `"group"` |
| `subjects[].subject_id` | integer | `1` |
| `subjects[].name` | string | `"wiki-administrators"` |
| `subjects[].permissions` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "available": [
    {
      "key": "SPACE_VIEW",
      "label": "View the space"
    },
    {
      "key": "PAGE_ADD",
      "label": "Add pages"
    },
    "…"
  ],
  "subjects": [
    {
      "subject_type": "group",
      "subject_id": 1,
      "name": "wiki-administrators",
      "permissions": [
        "SPACE_VIEW",
        "PAGE_ADD",
        "…"
      ]
    },
    {
      "subject_type": "group",
      "subject_id": 2,
      "name": "wiki-users",
      "permissions": [
        "SPACE_VIEW",
        "PAGE_ADD",
        "…"
      ]
    }
  ]
}
```

</details>

### `PUT /api/spaces/{space_id}/permissions`

**Berechtigungen ändern (Bereich)**

- **Wer darf:** Berechtigung: `SPACE_ADMIN`
- **Pfadparameter:** `space_id` (integer)
- **JSON-Body:** `subjects`

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/spaces/{space_id}/permissions' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"subjects": "…"}'
```

**Liefert**

`error`, `ok`

### `POST /api/spaces/{space_id}/restore`

**Wiederherstellen – Bereich**

<details><summary>Details aus dem Code (englisch)</summary>

Take an archived space out of the archive, with the pages archived with it. Takes "View the archive"
and "Archive the space" in it.

</details>

- **Wer darf:** Berechtigung: `SPACE_ARCHIVE`
- **Pfadparameter:** `space_id` (integer)

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/spaces/{space_id}/restore' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `ok`, `pages`, `key`

### `GET /api/spaces/{space_id}/templates`

**Vorlagen auflisten (Bereich)**

<details><summary>Details aus dem Code (englisch)</summary>

What somebody creating a page here can start from: this space's own
templates and the ones that belong to no space in particular.

</details>

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `space_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/spaces/{space_id}/templates' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `templates` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "templates": []
}
```

</details>

### `GET /api/spaces/{space_id}/tree`

**Seitenbaum lesen (Bereich)**

- **Wer darf:** Berechtigung: `SPACE_VIEW`
- **Pfadparameter:** `space_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/spaces/{space_id}/tree' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `tree` | array |  |
| `tree[].id` | integer | `1` |
| `tree[].title` | string | `"MGWiki demo"` |
| `tree[].type` | string | `"page"` |
| `tree[].parent_id` | null | `null` |
| `tree[].position` | integer | `0` |
| `tree[].children` | array |  |

<details><summary>Beispielantwort</summary>

```json
{
  "tree": [
    {
      "id": 1,
      "title": "MGWiki demo",
      "type": "page",
      "parent_id": null,
      "position": 0,
      "children": []
    }
  ]
}
```

</details>


## Bereich: `templates`

<a id="area-templates"></a>

Seitenvorlagen.

### `GET /api/templates/{template_id}`

**Vorlage lesen**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `template_id` (integer)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/templates/{template_id}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

`error`, `template`


## Bereich: `third-party`

<a id="area-third-party"></a>

### `GET /api/third-party`

**Third party lesen**

- **Wer darf:** Jede angemeldete Person

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/third-party' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

| Feld | Typ | Beispiel |
|---|---|---|
| `product` | string | `"mgwiki5"` |
| `version` | string | `"5.9.0"` |
| `made` | string | `""` |
| `components` | array |  |
| `components[].name` | string | `"draw.io"` |
| `components[].version` | string | `"32.7.4"` |
| `components[].kind` | string | `"Diagram editor"` |
| `components[].url` | string | `"https://github.com/jgraph/drawio"` |
| `components[].licences` | array |  |
| `components[].description` | string | `"The diagram editor of the page editor, served from static/d` |
| `components[].texts` | array |  |
| `source` | string | `"installation"` |

<details><summary>Beispielantwort</summary>

```json
{
  "product": "mgwiki5",
  "version": "5.9.0",
  "made": "",
  "components": [
    {
      "name": "draw.io",
      "version": "32.7.4",
      "kind": "Diagram editor",
      "url": "https://github.com/jgraph/drawio",
      "licences": [
        "Apache-2.0"
      ],
      "description": "The diagram editor of the page editor, served from static/drawio",
      "texts": [
        {
          "file": "LICENSE (Apache 2.0, the program)",
          "text": "                                 Apache License\n                           Ve…"
        },
        {
          "file": "templates/LICENSE (CC BY 4.0, the diagram templates)",
          "text": "Creative Commons Attribution 4.0 International Public License\n\nBy exercising …"
        },
        "…"
      ]
    },
    {
      "name": "Barlow (font)",
      "version": "",
      "kind": "Font",
      "url": "",
      "licences": [
        "OFL-1.1"
      ],
      "description": "",
      "texts": [
        {
          "file": "LICENSE-barlow-condensed.txt",
          "text": "Copyright 2017 The Barlow Project Authors (https://github.com/jpt/barlow) Bar…"
        }
      ],
      "files": [
        "barlow-condensed-600.woff2",
        "barlow-condensed-700.woff2"
      ]
    },
    "…"
  ],
  "source": "installation"
}
```

</details>


## Bereich: `uploads`

<a id="area-uploads"></a>

Große Dateien in Teilen: beginnen, Teil für Teil senden, Stand abfragen, abbrechen.

### `POST /api/uploads`

**Upload anlegen**

<details><summary>Details aus dem Code (englisch)</summary>

Begin a big file in pieces: its name and size, checked against the limit first.

</details>

- **Wer darf:** Jede angemeldete Person
- **JSON-Body:** `filename`, `size`

**Aufruf**

```bash
curl -s -X POST 'http://127.0.0.1:8719/api/uploads' \
  -H 'Authorization: Bearer $TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"filename": "…", "size": "…"}'
```

**Liefert**

JSON.

### `GET /api/uploads/{uid}`

**Upload lesen**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `uid` (string)

**Aufruf**

```bash
curl -s -X GET 'http://127.0.0.1:8719/api/uploads/{uid}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

JSON.

### `DELETE /api/uploads/{uid}`

**Upload löschen**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `uid` (string)

**Aufruf**

```bash
curl -s -X DELETE 'http://127.0.0.1:8719/api/uploads/{uid}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

Wie `GET /api/uploads/{uid}`.

### `PUT /api/uploads/{uid}/{index}`

**Upload ändern**

- **Wer darf:** Jede angemeldete Person
- **Pfadparameter:** `uid` (string), `index` (integer)

**Aufruf**

```bash
curl -s -X PUT 'http://127.0.0.1:8719/api/uploads/{uid}/{index}' \
  -H 'Authorization: Bearer $TOKEN'
```

**Liefert**

JSON.

