---
title: "Bericht erstellen"
description: "Erstellt eine organisationsweite Berichtskonfiguration. Erfordert einen Tarif mit Organisationsberichten und freies Berichtskontingent."
---

`POST /api/organization/reports`

Erstellt einen wiederkehrenden Organisationsbericht. Die Organisation wird aus Ihrer authentifizierten Sitzung oder Ihrem API-Token abgeleitet. Erfordert die Rolle **admin** der Organisation (API-Tokens gelten als Organisations-Admins). Nur-Lese-Benutzer können keine Berichte erstellen.

## Request-Body

| Feld | Typ | Erforderlich | Hinweise |
|---|---|---|---|
| `name` | string | ja | 1-200 Zeichen. |
| `enabled` | boolean | nein | Standard `true`. |
| `frequency` | `"daily" \| "weekly" \| "monthly"` | nein | Standard `monthly`. |
| `weekday` | integer 0-6 | bei `weekly` | 0 = Sonntag. |
| `dayOfMonth` | integer 1-28 | bei `monthly` | Auf 28 begrenzt. |
| `sendHour` | integer 0-23 | nein | Standard `2`, in `timezone`. |
| `timezone` | string | nein | IANA-Zeitzone, Standard `Europe/Berlin`. |
| `scopeMode` | `"all" \| "customers" \| "tags"` | nein | Standard `all`. |
| `scopeCustomerIds` | integer[] | bei `customers` | Müssen zu Ihrer Organisation gehören. |
| `scopeTagIds` | integer[] | bei `tags` | Müssen zu Ihrer Organisation gehören. |
| `inclusionMode` | `"all" \| "problems" \| "threshold"` | nein | Standard `all`. |
| `problemSignals` | object | nein | `{ incident, downtimeMinutes, sslDaysLt, responseBreach }`. |
| `thresholdUptimeLt` | number | bei `threshold` | z. B. `99.9`. |
| `thresholdResponseGt` | integer (ms) | bei `threshold` | |
| `sendWhenEmpty` | boolean | nein | „Alles in Ordnung"-Bericht senden, wenn keine Website zutrifft. Standard `false`. |
| `sections` | object | nein | Sechs Booleans zum Ein-/Ausschalten der Abschnitte. |
| `monitorTypes` | string[] | nein | Welche Monitor-Typen der Bericht umfasst. Ein oder mehrere aus `website`, `dns`, `dnsbl`, `domain`, `icmp`, `smtp`, `ssh`, `tcp`, `ftp`, `imap`. Standard: alle 10. Muss mindestens einen Eintrag enthalten. |
| `sectionsByType` | object | nein | Abschnitts-Umschalter pro Typ: `{ "<monitorType>": { "<sectionKey>": boolean } }`. Welche `sectionKey`s zulässig sind, hängt vom Typ ab: siehe [Abschnitts-Schlüssel pro Monitor-Typ](#abschnitts-schlüssel-pro-monitor-typ) unten. Wird ein für seinen Typ unzulässiger Abschnitts-Schlüssel gesendet, schlägt die Anfrage mit `400 Bad Request` fehl. |
| `groupByCustomer` | boolean | nein | Untergliedert die Tabelle jedes Monitor-Typs zusätzlich nach Kunde. Standard `false`. |
| `format` | `"email" \| "email_pdf"` | nein | Standard `email_pdf`. |
| `recipientEmails` | string[] | nein | Empfänger auf Agenturseite (max. 50). |
| `recipientUserIds` | string[] | nein | Benutzer-IDs der Teammitglieder (max. 50). |

### Abschnitts-Schlüssel pro Monitor-Typ

| Monitor-Typ | Zulässige `sectionKey`s |
|---|---|
| `website`, `dns`, `icmp`, `smtp`, `ssh`, `tcp`, `ftp`, `imap` | `fleetSummary`, `worstPerformers`, `perMonitorTable`, `incidentLog` |
| `website` (zusätzlich) | `sslExpiry` |
| `dnsbl` | `dnsblStatus` |
| `domain` | `domainExpiry` |

## Beispiel (cURL)

```bash
BASE_URL="https://uptimeify.io"
TOKEN="<ihr-api-token>"

curl -X POST "$BASE_URL/api/organization/reports" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Wöchentlicher Ops-Bericht",
    "frequency": "weekly",
    "weekday": 1,
    "scopeMode": "all",
    "inclusionMode": "problems",
    "format": "email_pdf",
    "recipientEmails": ["ops@agentur.io"]
  }'
```

## Antwort

```json
{
  "id": "3f1c9c1e-8d2a-4c7e-9b1a-2d5f6a7b8c90",
  "name": "Wöchentlicher Ops-Bericht",
  "enabled": true,
  "frequency": "weekly",
  "monitorTypes": ["website", "dns", "dnsbl", "domain", "icmp", "smtp", "ssh", "tcp", "ftp", "imap"],
  "sectionsByType": {},
  "groupByCustomer": false,
  "format": "email_pdf",
  "recipientEmails": ["ops@agentur.io"]
}
```

## Häufige Fehler

- `401 Unauthorized`: nicht authentifiziert.
- `403 Forbidden` (`forbidden`): kein Organisations-Admin.
- `400` (`invalidReportSchedule`): `weekly` ohne `weekday` oder `monthly` ohne `dayOfMonth`.
- `400` (`invalidReportScope`): Scope-IDs gehören nicht zu Ihrer Organisation, oder `threshold` ohne Schwellenwert.
- `400 Bad Request`: ein `sectionsByType`-Eintrag enthält einen `sectionKey`, der für seinen Monitor-Typ nicht zulässig ist (siehe [Abschnitts-Schlüssel pro Monitor-Typ](#abschnitts-schlüssel-pro-monitor-typ)), oder `monitorTypes` ist ein leeres Array.
