{
    "openapi": "3.1.0",
    "info": {
        "title": "Medienverarbeitung API",
        "version": "v1",
        "description": "Asynchrone Video-, Bild- und Audioverarbeitung: skalieren, komprimieren, Wasserzeichen, Vorschaubilder, Kursvideos und Tonspuren, mit signierten Rückmeldungen."
    },
    "servers": [
        {
            "url": "https://api.flowdata.one/v1",
            "description": "FlowData API"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "pipelines",
            "description": "Pipelines & Presets"
        },
        {
            "name": "jobs",
            "description": "Aufträge"
        },
        {
            "name": "assets",
            "description": "Wasserzeichen"
        },
        {
            "name": "callbacks",
            "description": "Rückmeldungen (Webhooks)"
        }
    ],
    "paths": {
        "/media/presets": {
            "get": {
                "operationId": "presets-list",
                "summary": "Presets auflisten",
                "description": "Alle System-Pipelines (system: true) und die Presets deines Teams.",
                "tags": [
                    "pipelines"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": [
                                        {
                                            "key": "ugc_video",
                                            "system": true,
                                            "pipeline": "ugc_video",
                                            "outputs": [
                                                "watermarked",
                                                "clean",
                                                "thumbnail"
                                            ]
                                        },
                                        {
                                            "key": "ugc_hd",
                                            "system": false,
                                            "name": "UGC in HD",
                                            "pipeline": "ugc_video",
                                            "options": {
                                                "width": 720,
                                                "height": 1280
                                            },
                                            "outputs": {
                                                "clean": {
                                                    "crf": 20
                                                }
                                            },
                                            "updated_at": "2026-09-28T10:00:00Z"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "presets-store",
                "summary": "Preset anlegen oder ersetzen",
                "description": "Legt ein Team-Preset an (201) oder ersetzt eines mit gleichem Schlüssel (200). System-Namen sind reserviert.",
                "tags": [
                    "pipelines"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "key": "ugc_hd",
                                    "system": false,
                                    "name": "UGC in HD",
                                    "pipeline": "ugc_video",
                                    "options": {
                                        "width": 720,
                                        "height": 1280,
                                        "watermark": {
                                            "asset": "brand_white",
                                            "opacity": 0.3
                                        }
                                    },
                                    "outputs": {
                                        "clean": {
                                            "crf": 20
                                        }
                                    },
                                    "updated_at": "2026-09-28T10:00:00Z"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "key": {
                                        "type": "string",
                                        "description": "1 bis 64 Zeichen aus a-z, 0-9, _ und -"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Bezeichnung, höchstens 191 Zeichen"
                                    },
                                    "pipeline": {
                                        "type": "string",
                                        "description": "Basis-Pipeline, zum Beispiel ugc_video"
                                    },
                                    "options": {
                                        "type": "object",
                                        "description": "Optionen für alle Ausgaben inklusive watermark"
                                    },
                                    "outputs": {
                                        "type": "object",
                                        "description": "Überschreibungen je Ausgabename"
                                    }
                                },
                                "required": [
                                    "key",
                                    "pipeline"
                                ]
                            },
                            "example": {
                                "key": "ugc_hd",
                                "name": "UGC in HD",
                                "pipeline": "ugc_video",
                                "options": {
                                    "width": 720,
                                    "height": 1280,
                                    "watermark": {
                                        "asset": "brand_white",
                                        "opacity": 0.3
                                    }
                                },
                                "outputs": {
                                    "clean": {
                                        "crf": 20
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/media/presets/{key}": {
            "delete": {
                "operationId": "presets-delete",
                "summary": "Preset löschen",
                "description": "Löscht ein Team-Preset. Bereits angelegte Aufträge sind nicht betroffen, sie tragen eine Kopie ihrer Einstellungen.",
                "tags": [
                    "pipelines"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "deleted": true,
                                    "key": "ugc_hd"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/media/jobs": {
            "post": {
                "operationId": "jobs-create",
                "summary": "Auftrag anlegen",
                "description": "Legt einen Auftrag an und antwortet mit 202 und queue_position. Genau eines von pipeline und preset, genau eines von input.url und input.upload_id, je Ausgabe genau eines von put_url und managed: true. Alle URLs müssen https sein und auf öffentliche Adressen zeigen.",
                "tags": [
                    "jobs"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "01J8Z6Q4T0M3S1V7B2X9K5N4RD",
                                    "status": "queued",
                                    "pipeline": "ugc_video",
                                    "reference": "orderfile:12345",
                                    "priority": "normal",
                                    "outputs": {
                                        "watermarked": {
                                            "status": "pending",
                                            "target": "put"
                                        },
                                        "clean": {
                                            "status": "pending",
                                            "target": "managed",
                                            "download_url": null,
                                            "expires_at": null
                                        },
                                        "thumbnail": {
                                            "status": "pending",
                                            "target": "put"
                                        }
                                    },
                                    "error": null,
                                    "queue_position": 1
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "pipeline": {
                                        "type": "string",
                                        "description": "System-Pipeline (siehe Tabelle), alternativ preset"
                                    },
                                    "preset": {
                                        "type": "string",
                                        "description": "Schlüssel eines Team-Presets, alternativ pipeline"
                                    },
                                    "reference": {
                                        "type": "string",
                                        "description": "Deine eigene Kennung (höchstens 191 Zeichen), abfragbar über GET /jobs?reference="
                                    },
                                    "priority": {
                                        "type": "string",
                                        "description": "high, normal (Standard) oder low; course_video ist standardmäßig low"
                                    },
                                    "input": {
                                        "type": "object",
                                        "properties": {
                                            "url": {
                                                "type": "string",
                                                "description": "Öffentliche https-URL der Quelle, bis zu 3 Weiterleitungen"
                                            },
                                            "upload_id": {
                                                "type": "string",
                                                "description": "ID aus POST /uploads, einmal verwendbar"
                                            },
                                            "filename": {
                                                "type": "string",
                                                "description": "Originaler Dateiname (nur zur Anzeige)"
                                            },
                                            "size": {
                                                "type": "integer",
                                                "description": "Größe in Bytes; wird vorab gegen das Limit geprüft und verbessert die Kostenreservierung"
                                            }
                                        }
                                    },
                                    "outputs": {
                                        "type": "object",
                                        "properties": {
                                            "<name>.put_url": {
                                                "type": "string",
                                                "description": "Presigned PUT-URL für das Ergebnis"
                                            },
                                            "<name>.managed": {
                                                "type": "boolean",
                                                "description": "true: wir speichern das Ergebnis 7 Tage"
                                            },
                                            "<name>.content_type": {
                                                "type": "string",
                                                "description": "Content-Type beim PUT, Standard passend zum Format"
                                            },
                                            "<name>.*": {
                                                "type": "object",
                                                "description": "Überschreibungen wie width, height, fit, crf, format, quality, watermark"
                                            }
                                        }
                                    },
                                    "options": {
                                        "type": "object",
                                        "description": "Optionen für alle Ausgaben, inklusive watermark.asset"
                                    },
                                    "callback": {
                                        "type": "object",
                                        "properties": {
                                            "endpoint_id": {
                                                "type": "string",
                                                "description": "ID eines registrierten Webhook-Endpunkts"
                                            },
                                            "url": {
                                                "type": "string",
                                                "description": "Freie https-URL; signiert mit dem Geheimnis des Standard-Endpunkts, sonst unsigniert"
                                            },
                                            "events": {
                                                "type": "array",
                                                "items": [],
                                                "description": "job.finished und/oder job.failed (Standard: beide)"
                                            }
                                        }
                                    },
                                    "metadata": {
                                        "type": "object",
                                        "description": "Beliebiges JSON bis 4 KB, kommt unverändert in der Rückmeldung zurück"
                                    }
                                }
                            },
                            "example": {
                                "pipeline": "ugc_video",
                                "reference": "orderfile:12345",
                                "input": {
                                    "url": "https://files.example.com/in/abc.mov?X-Amz-Signature=…",
                                    "filename": "abc.mov"
                                },
                                "outputs": {
                                    "watermarked": {
                                        "put_url": "https://uploads.example.com/out/wm.mp4?X-Amz-Signature=…"
                                    },
                                    "clean": {
                                        "managed": true
                                    },
                                    "thumbnail": {
                                        "put_url": "https://uploads.example.com/out/thumb.jpg?X-Amz-Signature=…"
                                    }
                                },
                                "options": {
                                    "watermark": {
                                        "asset": "brand_white"
                                    }
                                },
                                "callback": {
                                    "endpoint_id": "01J8Z6Q4T0M3S1V7B2X9K5N4WH"
                                },
                                "metadata": {
                                    "entity": "order_file"
                                }
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "jobs-by-reference",
                "summary": "Aufträge nach Referenz suchen",
                "description": "Die bis zu 20 neuesten Aufträge mit dieser reference.",
                "tags": [
                    "jobs"
                ],
                "parameters": [
                    {
                        "name": "reference",
                        "in": "query",
                        "required": true,
                        "description": "Deine Referenz aus POST /jobs",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": "01J8Z6Q4T0M3S1V7B2X9K5N4RD",
                                            "status": "finished",
                                            "pipeline": "ugc_video",
                                            "preset": null,
                                            "reference": "orderfile:12345",
                                            "priority": "normal",
                                            "created_at": "2026-09-28T10:00:00Z",
                                            "started_at": "2026-09-28T10:00:02Z",
                                            "finished_at": "2026-09-28T10:00:31Z",
                                            "input": {
                                                "size": 48211234,
                                                "duration": 27.4,
                                                "width": 1080,
                                                "height": 1920,
                                                "video_codec": "hevc",
                                                "has_audio": true
                                            },
                                            "outputs": {
                                                "watermarked": {
                                                    "status": "uploaded",
                                                    "target": "put",
                                                    "size": 6123456,
                                                    "width": 540,
                                                    "height": 960,
                                                    "duration": 27.4,
                                                    "sha256": "9f2c…"
                                                },
                                                "clean": {
                                                    "status": "uploaded",
                                                    "target": "managed",
                                                    "size": 6101234,
                                                    "width": 540,
                                                    "height": 960,
                                                    "duration": 27.4,
                                                    "sha256": "4b1a…",
                                                    "download_url": "https://…",
                                                    "expires_at": "2026-10-05T10:00:31Z"
                                                }
                                            },
                                            "options": {
                                                "watermark": {
                                                    "asset": "brand_white",
                                                    "asset_sha256": "c0ff…"
                                                }
                                            },
                                            "error": null,
                                            "processing_seconds": 28.6,
                                            "cancel_requested": false
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/media/jobs/{job_id}": {
            "get": {
                "operationId": "jobs-show",
                "summary": "Auftrag abrufen",
                "description": "Liefert den Auftrag in derselben Form wie die Rückmeldung. Bei managed-Ausgaben enthält download_url einen signierten Link, der bis expires_at gilt.",
                "tags": [
                    "jobs"
                ],
                "parameters": [
                    {
                        "name": "job_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "01J8Z6Q4T0M3S1V7B2X9K5N4RD",
                                    "status": "finished",
                                    "pipeline": "ugc_video",
                                    "preset": null,
                                    "reference": "orderfile:12345",
                                    "priority": "normal",
                                    "created_at": "2026-09-28T10:00:00Z",
                                    "started_at": "2026-09-28T10:00:02Z",
                                    "finished_at": "2026-09-28T10:00:31Z",
                                    "input": {
                                        "size": 48211234,
                                        "duration": 27.4,
                                        "width": 1080,
                                        "height": 1920,
                                        "video_codec": "hevc",
                                        "has_audio": true
                                    },
                                    "outputs": {
                                        "watermarked": {
                                            "status": "uploaded",
                                            "target": "put",
                                            "size": 6123456,
                                            "width": 540,
                                            "height": 960,
                                            "duration": 27.4,
                                            "sha256": "9f2c…"
                                        },
                                        "clean": {
                                            "status": "uploaded",
                                            "target": "managed",
                                            "size": 6101234,
                                            "width": 540,
                                            "height": 960,
                                            "duration": 27.4,
                                            "sha256": "4b1a…",
                                            "download_url": "https://…",
                                            "expires_at": "2026-10-05T10:00:31Z"
                                        }
                                    },
                                    "options": {
                                        "watermark": {
                                            "asset": "brand_white",
                                            "asset_sha256": "c0ff…"
                                        }
                                    },
                                    "error": null,
                                    "processing_seconds": 28.6,
                                    "cancel_requested": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "jobs-cancel",
                "summary": "Auftrag abbrechen",
                "description": "Ein wartender Auftrag wird sofort cancelled (ohne Rückmeldung, Reservierung wird freigegeben). Ein laufender Auftrag erhält eine Abbruchanforderung (cancel_requested: true), der Worker stoppt innerhalb weniger Sekunden und meldet job.failed mit error.code = cancelled. Ein beendeter Auftrag ergibt 409 conflict.",
                "tags": [
                    "jobs"
                ],
                "parameters": [
                    {
                        "name": "job_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "01J8Z6Q4T0M3S1V7B2X9K5N4RD",
                                    "status": "cancelled",
                                    "error": null,
                                    "cancel_requested": false
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/media/uploads": {
            "post": {
                "operationId": "uploads-create",
                "summary": "Direkt-Upload anlegen",
                "description": "Für Quellen ohne öffentliche URL: liefert eine presigned PUT-URL in unseren Speicher. Die Datei dort hochladen und danach als input.upload_id verwenden. Gültig 24 Stunden, einmal verwendbar. Je Team sind höchstens acht Direkt-Uploads und zusammen 10 GB gemeldete Größe gleichzeitig offen. Ein Upload zählt weiter, nachdem er einem Auftrag zugeordnet wurde, bis die Zeile entfernt ist.",
                "tags": [
                    "jobs"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "01J8Z6Q4T0M3S1V7B2X9K5N4UP",
                                    "upload_url": "https://…",
                                    "method": "PUT",
                                    "headers": {
                                        "Content-Type": "video/mp4",
                                        "Content-Length": "734003200"
                                    },
                                    "expires_at": "2026-09-29T10:00:00Z"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "filename": {
                                        "type": "string",
                                        "description": "Dateiname, höchstens 255 Zeichen"
                                    },
                                    "size": {
                                        "type": "integer",
                                        "description": "Größe in Bytes, Pflicht. Die presigned PUT-URL signiert genau diese Content-Length; ein größerer Körper wird vom Speicher abgelehnt."
                                    },
                                    "content_type": {
                                        "type": "string",
                                        "description": "Content-Type, der beim PUT gesendet werden muss"
                                    }
                                },
                                "required": [
                                    "size"
                                ]
                            },
                            "example": {
                                "filename": "kurs-01.mp4",
                                "size": 734003200,
                                "content_type": "video/mp4"
                            }
                        }
                    }
                }
            }
        },
        "/media/usage": {
            "get": {
                "operationId": "usage",
                "summary": "Nutzung abfragen",
                "description": "Aufträge, Fehlschläge, Rechenzeit und Eingabevolumen im Zeitraum (Standard: aktueller Monat). Kosten und Guthaben stehen im Dashboard unter Abrechnung.",
                "tags": [
                    "jobs"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Startdatum YYYY-MM-DD",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Enddatum YYYY-MM-DD",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "from": "2026-09-01",
                                    "to": "2026-09-30",
                                    "jobs": 2143,
                                    "failed": 12,
                                    "processing_seconds": 61234.5,
                                    "input_bytes": 98765432100,
                                    "by_pipeline": {
                                        "ugc_video": 2051,
                                        "ugc_image": 92
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/media/health": {
            "get": {
                "operationId": "health",
                "summary": "Status",
                "description": "Ohne Anmeldung. ok, degraded (Wartung oder Bildverarbeitung eingeschränkt) oder down, dazu die Länge der Warteschlange.",
                "tags": [
                    "jobs"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "status": "ok",
                                    "queue": {
                                        "pending": 3,
                                        "processing": 4
                                    },
                                    "version": "1.0.0"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/media/assets/{key}": {
            "put": {
                "operationId": "assets-put",
                "summary": "Wasserzeichen hochladen",
                "description": "Body als rohes PNG (Content-Type: image/png) oder multipart mit dem Feld file. Antwort 201 für einen neuen Schlüssel, 200 für eine neue Version.",
                "tags": [
                    "assets"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "key": "brand_white",
                                    "sha256": "c0ffee…",
                                    "width": 800,
                                    "height": 200,
                                    "size": 18234,
                                    "updated_at": "2026-09-28T10:00:00Z"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "PNG mit Alphakanal, höchstens 2 MB"
                                    }
                                },
                                "required": [
                                    "file"
                                ]
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "assets-post",
                "summary": "Wasserzeichen hochladen (POST)",
                "description": "Gleich wie PUT, für Clients, die multipart nur mit POST senden können.",
                "tags": [
                    "assets"
                ],
                "parameters": [
                    {
                        "name": "key",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "key": "brand_white",
                                    "sha256": "c0ffee…",
                                    "width": 800,
                                    "height": 200,
                                    "size": 18234,
                                    "updated_at": "2026-09-28T10:00:00Z"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "file": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "PNG mit Alphakanal, höchstens 2 MB"
                                    }
                                },
                                "required": [
                                    "file"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/media/assets": {
            "get": {
                "operationId": "assets-list",
                "summary": "Wasserzeichen auflisten",
                "description": "Alle Wasserzeichen deines Teams mit aktueller Version.",
                "tags": [
                    "assets"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": [
                                        {
                                            "key": "brand_white",
                                            "sha256": "c0ffee…",
                                            "width": 800,
                                            "height": 200,
                                            "size": 18234,
                                            "updated_at": "2026-09-28T10:00:00Z"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/media/webhook-endpoints": {
            "get": {
                "operationId": "webhook-endpoints-list",
                "summary": "Endpunkte auflisten",
                "description": "Alle Endpunkte deines Teams, ohne Geheimnis.",
                "tags": [
                    "callbacks"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": [
                                        {
                                            "id": "01J8Z6Q4T0M3S1V7B2X9K5N4WH",
                                            "url": "https://example.com/hooks/media",
                                            "description": null,
                                            "events": [
                                                "job.finished",
                                                "job.failed"
                                            ],
                                            "is_default": true,
                                            "active": true,
                                            "previous_secret_expires_at": null,
                                            "created_at": "2026-09-28T10:00:00Z"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "webhook-endpoints-create",
                "summary": "Endpunkt anlegen",
                "description": "Legt einen Endpunkt an und liefert das Geheimnis einmalig im Feld secret. is_default: true nimmt die Markierung einem anderen Endpunkt ab.",
                "tags": [
                    "callbacks"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "01J8Z6Q4T0M3S1V7B2X9K5N4WH",
                                    "url": "https://example.com/hooks/media",
                                    "events": [
                                        "job.finished",
                                        "job.failed"
                                    ],
                                    "is_default": true,
                                    "active": true,
                                    "secret": "whsec_BEISPIEL00000000000000000000000"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "url": {
                                        "type": "string",
                                        "description": "Öffentliche https-URL"
                                    },
                                    "events": {
                                        "type": "array",
                                        "items": [],
                                        "description": "job.finished und/oder job.failed (Standard: beide)"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Höchstens 191 Zeichen"
                                    },
                                    "is_default": {
                                        "type": "boolean",
                                        "description": "Signiert auch freie callback.url"
                                    }
                                },
                                "required": [
                                    "url"
                                ]
                            },
                            "example": {
                                "url": "https://example.com/hooks/media",
                                "events": [
                                    "job.finished",
                                    "job.failed"
                                ],
                                "is_default": true
                            }
                        }
                    }
                }
            }
        },
        "/media/webhook-endpoints/{endpoint_id}/rotate-secret": {
            "post": {
                "operationId": "webhook-endpoints-rotate",
                "summary": "Geheimnis erneuern",
                "description": "Erzeugt ein neues Geheimnis und liefert es einmalig. Das alte signiert 24 Stunden lang mit (previous_secret_expires_at).",
                "tags": [
                    "callbacks"
                ],
                "parameters": [
                    {
                        "name": "endpoint_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "id": "01J8Z6Q4T0M3S1V7B2X9K5N4WH",
                                    "previous_secret_expires_at": "2026-09-29T10:00:00Z",
                                    "secret": "whsec_…"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/media/webhook-endpoints/{endpoint_id}": {
            "delete": {
                "operationId": "webhook-endpoints-delete",
                "summary": "Endpunkt löschen",
                "description": "Löscht den Endpunkt. Offene Zustellungen an ihn werden aufgegeben.",
                "tags": [
                    "callbacks"
                ],
                "parameters": [
                    {
                        "name": "endpoint_id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "deleted": true,
                                    "id": "01J8Z6Q4T0M3S1V7B2X9K5N4WH"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "FlowData-Schlüssel als Authorization: Bearer fd_…"
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            },
                            "type": {
                                "type": "string"
                            },
                            "details": {
                                "type": "object"
                            }
                        }
                    }
                }
            }
        }
    }
}