{
    "openapi": "3.1.0",
    "info": {
        "title": "FlowCall API",
        "version": "v1",
        "description": "REST API für die Telefonie-Projekte: Leads anlegen und bearbeiten, Gesprächsergebnisse festhalten, Wiedervorlagen führen, Listen importieren und exportieren, Rollen vergeben und auswerten."
    },
    "servers": [
        {
            "url": "https://api.flowsuite.one",
            "description": "FlowSuite API"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "context",
            "description": "Überblick"
        },
        {
            "name": "projects",
            "description": "Projekte"
        },
        {
            "name": "guideline",
            "description": "Leitfaden und Formular"
        },
        {
            "name": "imports",
            "description": "Importe"
        },
        {
            "name": "exports",
            "description": "Exporte"
        },
        {
            "name": "leads",
            "description": "Leads"
        },
        {
            "name": "comments",
            "description": "Kommentare"
        },
        {
            "name": "follow-ups",
            "description": "Wiedervorlagen"
        },
        {
            "name": "calls",
            "description": "Anrufe"
        },
        {
            "name": "emails",
            "description": "E-Mails"
        },
        {
            "name": "team",
            "description": "Team und Rollen"
        },
        {
            "name": "call-history",
            "description": "Telefonprotokoll"
        },
        {
            "name": "reports",
            "description": "Auswertungen"
        }
    ],
    "paths": {
        "/flowcall/context": {
            "get": {
                "operationId": "flowcall-context",
                "summary": "Projekte, Rechte und Begriffe abrufen",
                "description": "Liefert alle erreichbaren Telefonie-Projekte mit den eigenen Rechten darin, die zehn Berechtigungsnamen, die üblichen Gesprächsergebnisse und die Angabe, ob dieser Schlüssel als Inhaber handelt. Ein Aufruf, damit ein Programm die Begriffe dieser API nicht fest einbauen muss.",
                "tags": [
                    "context"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "acts_as_owner": false,
                                        "permission_flags": [
                                            "team_verwalten",
                                            "team_rollen_verwalten",
                                            "callhistory_all",
                                            "projekte_verwalten",
                                            "projekt_bearbeiten",
                                            "projekt_alle_leads",
                                            "projekt_leads_export",
                                            "projekt_telefonie",
                                            "projekt_lead_hinzufuegen",
                                            "projekt_unstimmigkeiten"
                                        ],
                                        "lead_statuses": [
                                            "Offen",
                                            "Übersprungen",
                                            "Kein Interesse",
                                            "Keinen erreicht",
                                            "Falsche Rufnummer",
                                            "AP nicht im hause",
                                            "Wiedervorlage",
                                            "E-Mail senden",
                                            "Termin vereinbart"
                                        ],
                                        "projects": [
                                            {
                                                "uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                                "name": "Herbstaktion Handwerk",
                                                "status": "active",
                                                "rights": {
                                                    "projekt_telefonie": true,
                                                    "projekt_alle_leads": true,
                                                    "projekte_verwalten": false
                                                }
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects": {
            "get": {
                "operationId": "flowcall-projects-index",
                "summary": "Telefonie-Projekte auflisten",
                "description": "Alle Telefonie-Projekte, die dieser Schlüssel erreicht, neueste zuerst.",
                "tags": [
                    "projects"
                ],
                "parameters": [
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Einträge pro Seite, 1 bis 200, Standard 25.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seitenzahl, Standard 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                            "name": "Herbstaktion Handwerk",
                                            "status": "active",
                                            "call_again_after_attempts": "3",
                                            "appointment_link": "https://termine.example.com/herbst",
                                            "email_service": true,
                                            "sender_name": "Vertrieb",
                                            "sender_email": "vertrieb@example.com",
                                            "form_fields": [],
                                            "created_at": "2026-09-01T09:00:00+02:00",
                                            "updated_at": "2026-09-18T11:20:00+02:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-projects-store",
                "summary": "Ein Telefonie-Projekt anlegen",
                "description": "Macht aus einem bestehenden Kundenprojekt ein Telefonie-Projekt, oder legt beides in einem Zug an. Genau eines von project_uuid und client_uuid wird benötigt. Trägt das Kundenprojekt bereits eine Telefonie-Konfiguration, antwortet der Aufruf mit HTTP 422 und dem Fehler already_exists. Diese Berechtigung wird teamweit geprüft, weil ein Projekt, das es noch nicht gibt, keine eigene Berechtigungszeile haben kann.",
                "tags": [
                    "projects"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                        "name": "Herbstaktion Handwerk",
                                        "status": "active",
                                        "call_again_after_attempts": "3",
                                        "appointment_link": null,
                                        "email_service": false,
                                        "sender_name": null,
                                        "sender_email": null,
                                        "form_fields": []
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "project_uuid": {
                                        "type": "string",
                                        "description": "Ein bestehendes Kundenprojekt des Teams. Pflicht, wenn client_uuid fehlt."
                                    },
                                    "client_uuid": {
                                        "type": "string",
                                        "description": "Ein Kunde des Teams, unter dem ein neues Projekt entsteht. Pflicht, wenn project_uuid fehlt."
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Name des neuen Projekts, höchstens 255 Zeichen. Pflicht zusammen mit client_uuid."
                                    },
                                    "appointment_link": {
                                        "type": "string",
                                        "description": "Adresse der Terminbuchung, http oder https, höchstens 2048 Zeichen."
                                    },
                                    "call_again_after_attempts": {
                                        "type": "string",
                                        "description": "Nach wie vielen erfolglosen Versuchen erneut angerufen wird. Freitext, höchstens 10 Zeichen, Standard 3."
                                    },
                                    "email_service": {
                                        "type": "boolean",
                                        "description": "Schaltet den E-Mail-Versand des Projekts ein."
                                    },
                                    "sender_name": {
                                        "type": "string",
                                        "description": "Absendername, wird nur bei eingeschaltetem E-Mail-Versand gespeichert."
                                    },
                                    "sender_email": {
                                        "type": "string",
                                        "description": "Absenderadresse, wird nur bei eingeschaltetem E-Mail-Versand gespeichert."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}": {
            "get": {
                "operationId": "flowcall-projects-show",
                "summary": "Ein Telefonie-Projekt abrufen",
                "description": "Ein Projekt mit den eigenen Rechten darin, dem Zeitraum, dem vereinbarten Umfang, der Beschreibung und den Zahlen der Übersicht. Unbearbeitet meint dabei einen Lead ganz ohne Ergebniszeile, was etwas anderes ist als ein Lead mit dem Ergebnis Offen.",
                "tags": [
                    "projects"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                        "name": "Herbstaktion Handwerk",
                                        "status": "active",
                                        "call_again_after_attempts": "3",
                                        "email_service": true,
                                        "form_fields": [],
                                        "rights": {
                                            "projekt_telefonie": true,
                                            "projekt_alle_leads": true
                                        },
                                        "start_date": "2026-09-01",
                                        "end_date": "2026-12-31",
                                        "hours": "40 pro Monat",
                                        "information": "Zielgruppe Handwerksbetriebe ab zehn Mitarbeitenden.",
                                        "stats": {
                                            "leads": 1240,
                                            "locked": 3,
                                            "untouched": 480,
                                            "by_status": {
                                                "Termin vereinbart": 62,
                                                "Kein Interesse": 190
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/settings": {
            "put": {
                "operationId": "flowcall-projects-settings",
                "summary": "Die Einstellungen eines Projekts ändern",
                "description": "Ändert die Telefonie-Einstellungen, die keine Zugangsdaten sind. Ein weggelassenes Feld bleibt unverändert. Wird der E-Mail-Versand abgeschaltet, verliert das Projekt seine Absenderangaben, damit es nie unter einem Absender weiterschreibt, an den sich niemand erinnert. Benötigt projekte_verwalten.",
                "tags": [
                    "projects"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                        "name": "Herbstaktion Handwerk",
                                        "status": "active",
                                        "call_again_after_attempts": "5",
                                        "appointment_link": "https://termine.example.com/herbst",
                                        "email_service": false,
                                        "sender_name": null,
                                        "sender_email": null,
                                        "form_fields": []
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "appointment_link": {
                                        "type": "string",
                                        "description": "Adresse der Terminbuchung, http oder https, höchstens 2048 Zeichen, oder null."
                                    },
                                    "call_again_after_attempts": {
                                        "type": "string",
                                        "description": "Freitext, höchstens 10 Zeichen, oder null."
                                    },
                                    "email_service": {
                                        "type": "boolean",
                                        "description": "Schaltet den E-Mail-Versand des Projekts ein oder aus."
                                    },
                                    "sender_name": {
                                        "type": "string",
                                        "description": "Absendername, höchstens 255 Zeichen, oder null."
                                    },
                                    "sender_email": {
                                        "type": "string",
                                        "description": "Absenderadresse, höchstens 255 Zeichen, oder null."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/dates": {
            "put": {
                "operationId": "flowcall-projects-dates",
                "summary": "Zeitraum, Umfang und Beschreibung ändern",
                "description": "Setzt den Zeitraum, den vereinbarten Umfang und die Projektbeschreibung. Der Umfang ist Freitext, weil dort Angaben wie 40 pro Monat stehen, die eine reine Zahl zurückweisen würde. Benötigt projekte_verwalten.",
                "tags": [
                    "projects"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "start_date": "2026-09-01",
                                        "end_date": "2026-12-31",
                                        "hours": "40 pro Monat",
                                        "information": "Zielgruppe Handwerksbetriebe ab zehn Mitarbeitenden."
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "start_date": {
                                        "type": "string",
                                        "description": "Beginn im Format JJJJ-MM-TT, oder null."
                                    },
                                    "end_date": {
                                        "type": "string",
                                        "description": "Ende im Format JJJJ-MM-TT, nicht vor dem Beginn, oder null."
                                    },
                                    "hours": {
                                        "type": "string",
                                        "description": "Vereinbarter Umfang als Freitext, höchstens 255 Zeichen, oder null."
                                    },
                                    "information": {
                                        "type": "string",
                                        "description": "Beschreibung des Projekts, höchstens 200000 Zeichen, oder null."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/status": {
            "put": {
                "operationId": "flowcall-projects-status",
                "summary": "Ein Projekt ein- oder ausschalten",
                "description": "Setzt den Status des Kundenprojekts auf active oder inactive. Der Status wirkt über FlowCall hinaus, weil er auf dem Kundenprojekt liegt. Benötigt projekte_verwalten.",
                "tags": [
                    "projects"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                        "name": "Herbstaktion Handwerk",
                                        "status": "inactive",
                                        "email_service": true,
                                        "form_fields": []
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "description": "active oder inactive. Ein anderer Wert wird zurückgewiesen."
                                    }
                                },
                                "required": [
                                    "status"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/leads/unworked": {
            "delete": {
                "operationId": "flowcall-projects-leads-unworked",
                "summary": "Unbearbeitete Leads eines Projekts löschen",
                "description": "Entfernt jeden Lead des Projekts, den niemand angefasst hat. Unbearbeitet heißt: weder ein Ergebnis noch ein Kommentar. Ein Lead, der einmal angerufen wurde, wird davon nie erfasst. Benötigt projekte_verwalten.",
                "tags": [
                    "projects"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "deleted": 480
                                    },
                                    "message": "480 unbearbeitete Leads wurden gelöscht."
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/guideline": {
            "get": {
                "operationId": "flowcall-guideline-show",
                "summary": "Den Gesprächsleitfaden abrufen",
                "description": "Liefert den gemeinsamen Leitfaden des Projekts oder die eigene Fassung. Benötigt projekt_bearbeiten oder projekt_telefonie.",
                "tags": [
                    "guideline"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "original oder user. Standard ist original.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "d4a9b021-6e37-4c58-90f1-2b8c5e7d0a63",
                                        "type": "original",
                                        "content": "Guten Tag, mein Name ist ...",
                                        "updated_at": "2026-09-14T10:05:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "flowcall-guideline-update",
                "summary": "Den Gesprächsleitfaden schreiben",
                "description": "Schreibt den Leitfaden. Die gemeinsame Fassung benötigt projekt_bearbeiten, die eigene Fassung projekt_telefonie.",
                "tags": [
                    "guideline"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "d4a9b021-6e37-4c58-90f1-2b8c5e7d0a63",
                                        "type": "original",
                                        "content": "Guten Tag, mein Name ist ...",
                                        "updated_at": "2026-09-20T08:30:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "content": {
                                        "type": "string",
                                        "description": "Der Text, höchstens 200000 Zeichen."
                                    },
                                    "type": {
                                        "type": "string",
                                        "description": "original oder user. Standard ist original."
                                    }
                                },
                                "required": [
                                    "content"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/form": {
            "get": {
                "operationId": "flowcall-form-show",
                "summary": "Das Gesprächsformular abrufen",
                "description": "Die Felder, die während eines Gesprächs ausgefüllt werden. Benötigt projekt_bearbeiten oder projekt_telefonie.",
                "tags": [
                    "guideline"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "fields": [
                                            {
                                                "label": "Anzahl Mitarbeitende",
                                                "typ": "number",
                                                "placeholder": "z. B. 15"
                                            },
                                            {
                                                "label": "Interesse an",
                                                "typ": "select",
                                                "optionen": [
                                                    "Webseite",
                                                    "Wartung"
                                                ]
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "flowcall-form-update",
                "summary": "Das Gesprächsformular ersetzen",
                "description": "Ersetzt die Felderliste vollständig. Eine leere Liste entfernt das Formular. Benötigt projekte_verwalten.",
                "tags": [
                    "guideline"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "fields": [
                                            {
                                                "label": "Anzahl Mitarbeitende",
                                                "typ": "number",
                                                "placeholder": "z. B. 15"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "fields": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Die vollständige Felderliste. Das Feld muss vorhanden sein, darf aber leer sein.",
                                        "properties": {
                                            "*.label": {
                                                "type": "string",
                                                "description": "Beschriftung des Feldes, höchstens 255 Zeichen."
                                            },
                                            "*.typ": {
                                                "type": "string",
                                                "description": "text, textarea, select, checkbox, radio, date oder number."
                                            },
                                            "*.placeholder": {
                                                "type": "string",
                                                "description": "Platzhaltertext, höchstens 255 Zeichen."
                                            },
                                            "*.optionen": {
                                                "type": "array",
                                                "items": [],
                                                "description": "Auswahlmöglichkeiten für select, checkbox und radio, je höchstens 255 Zeichen."
                                            }
                                        }
                                    }
                                },
                                "required": [
                                    "fields"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/imports": {
            "get": {
                "operationId": "flowcall-imports-index",
                "summary": "Importe eines Projekts auflisten",
                "description": "Die hochgeladenen Leadlisten eines Projekts, neueste zuerst. Der Zustand ist eine kleine Kette: uploaded heißt, die Datei liegt vor und nichts ist geschehen, queued heißt, die Zuordnung steht und die Arbeit wartet, processing heißt, sie läuft, danach finished oder failed. Benötigt projekte_verwalten.",
                "tags": [
                    "imports"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Einträge pro Seite, 1 bis 200, Standard 25.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seitenzahl, Standard 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "b20e6c47-91fd-4a35-8c07-3e1b9d5a7f28",
                                            "status": "finished",
                                            "filename": "handwerk-september.csv",
                                            "total_rows": 1240,
                                            "processed_rows": 1240,
                                            "mapping": {
                                                "Firma": "firma",
                                                "Telefon": "phone_numbers:Zentrale",
                                                "Notiz": null
                                            },
                                            "error_message": null,
                                            "created_at": "2026-09-05T14:02:00+02:00",
                                            "updated_at": "2026-09-05T14:09:00+02:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-imports-store",
                "summary": "Eine Leadliste hochladen",
                "description": "Nimmt eine Leadliste als multipart/form-data entgegen und antwortet mit HTTP 201. Ohne mapping trägt die Antwort die Spaltenüberschriften der Datei und die möglichen Zielfelder, und der Import wartet. Mit mapping startet er sofort; eine unbrauchbare Zuordnung antwortet mit HTTP 422 und dem Fehler invalid_mapping. Benötigt projekte_verwalten.",
                "tags": [
                    "imports"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "b20e6c47-91fd-4a35-8c07-3e1b9d5a7f28",
                                        "status": "uploaded",
                                        "filename": "handwerk-september.csv",
                                        "total_rows": 0,
                                        "processed_rows": 0,
                                        "mapping": null,
                                        "error_message": null,
                                        "headers": [
                                            "Firma",
                                            "Telefon",
                                            "Notiz"
                                        ],
                                        "mappable_fields": [
                                            "firma",
                                            "ansprechpartner",
                                            "vorname",
                                            "nachname",
                                            "anschrift",
                                            "strasse",
                                            "hausnummer",
                                            "plz",
                                            "stadt",
                                            "bundesland",
                                            "land",
                                            "phone_numbers",
                                            "emails",
                                            "websites"
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "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": "Die Leadliste als txt, csv, xls oder xlsx, höchstens 50 MB."
                                    },
                                    "mapping": {
                                        "type": "object",
                                        "description": "Zuordnung Spaltenüberschrift zu Zielfeld. Ein Wert darf hinter einem Doppelpunkt die Bezeichnung einer Wertesammlung tragen, etwa emails:Allgemein. null bedeutet, die Spalte wird übergangen."
                                    },
                                    "url": {
                                        "type": "string",
                                        "description": "Wird ausdrücklich zurückgewiesen. Eine Datei wird hochgeladen, nicht von einer Adresse geholt."
                                    }
                                },
                                "required": [
                                    "file"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/imports/{importUuid}/mapping": {
            "put": {
                "operationId": "flowcall-imports-mapping",
                "summary": "Die Spaltenzuordnung eines Imports setzen",
                "description": "Vereinbart die Spaltenzuordnung einer hochgeladenen Liste und übergibt den Import an die Warteschlange. Jede Spaltenüberschrift der Datei gehört in die Zuordnung, auch die, die auf nichts abgebildet wird; sie trägt dann den Wert null. Eine unbrauchbare Zuordnung antwortet mit HTTP 422 und dem Fehler invalid_mapping. Benötigt projekte_verwalten.",
                "tags": [
                    "imports"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "importUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "b20e6c47-91fd-4a35-8c07-3e1b9d5a7f28",
                                        "status": "queued",
                                        "filename": "handwerk-september.csv",
                                        "total_rows": 0,
                                        "processed_rows": 0,
                                        "mapping": {
                                            "Firma": "firma",
                                            "Telefon": "phone_numbers:Zentrale",
                                            "Notiz": null
                                        },
                                        "error_message": null
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "mapping": {
                                        "type": "object",
                                        "description": "Zuordnung Spaltenüberschrift zu Zielfeld, mindestens ein Eintrag. Ein Wert darf hinter einem Doppelpunkt die Bezeichnung einer Wertesammlung tragen, etwa emails:Allgemein. null bedeutet, die Spalte wird übergangen."
                                    }
                                },
                                "required": [
                                    "mapping"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/imports/{importUuid}/retry": {
            "post": {
                "operationId": "flowcall-imports-retry",
                "summary": "Einen Import erneut starten",
                "description": "Startet einen fehlgeschlagenen Import mit der Zuordnung, die er bereits trägt. Ein Import in einem anderen Zustand antwortet mit HTTP 409 und dem Fehler not_retryable. Benötigt projekte_verwalten.",
                "tags": [
                    "imports"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "importUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "b20e6c47-91fd-4a35-8c07-3e1b9d5a7f28",
                                        "status": "queued",
                                        "filename": "handwerk-september.csv",
                                        "total_rows": 1240,
                                        "processed_rows": 0,
                                        "error_message": null
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/exports": {
            "get": {
                "operationId": "flowcall-exports-index",
                "summary": "Exporte eines Projekts auflisten",
                "description": "Die Exporte eines Projekts mit ihrem Zustand und ihrer Ablauffrist. Benötigt projekt_leads_export.",
                "tags": [
                    "exports"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Einträge pro Seite, 1 bis 200, Standard 25.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seitenzahl, Standard 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "6ad3f158-70c2-4b91-a5de-0f4c8b26e719",
                                            "status": "completed",
                                            "recipient_email": "vertrieb@example.com",
                                            "filename": "leads-herbstaktion.xlsx",
                                            "expires_at": "2026-09-21T14:02:00+02:00",
                                            "expired": false,
                                            "created_at": "2026-09-20T14:02:00+02:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-exports-store",
                "summary": "Einen Export starten",
                "description": "Stellt einen Export der Leads in die Warteschlange und antwortet mit HTTP 202. Ohne recipient_email geht die Ankündigung an die eigene Adresse. Benötigt projekt_leads_export.",
                "tags": [
                    "exports"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "6ad3f158-70c2-4b91-a5de-0f4c8b26e719",
                                        "status": "pending",
                                        "recipient_email": "vertrieb@example.com",
                                        "filename": null,
                                        "expires_at": null,
                                        "expired": false,
                                        "created_at": "2026-09-20T14:02:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient_email": {
                                        "type": "string",
                                        "description": "Empfänger der Ankündigung. Standard ist die eigene Adresse."
                                    },
                                    "status": {
                                        "type": "string",
                                        "description": "Schränkt auf ein Gesprächsergebnis ein. Der Wert all umfasst alle Leads und ist der Standard."
                                    },
                                    "include_call_results": {
                                        "type": "boolean",
                                        "description": "Nimmt den Gesprächsverlauf mit in die Datei."
                                    },
                                    "max_call_results": {
                                        "type": "integer",
                                        "description": "Wie viele Einträge des Verlaufs je Lead, 1 bis 100, Standard 5."
                                    },
                                    "include_comments": {
                                        "type": "boolean",
                                        "description": "Nimmt die Kommentare mit in die Datei."
                                    },
                                    "max_comments": {
                                        "type": "integer",
                                        "description": "Wie viele Kommentare je Lead, 1 bis 100, Standard 5."
                                    },
                                    "highlight_rows": {
                                        "type": "boolean",
                                        "description": "Hebt die Zeilen nach ihrem Gesprächsergebnis farblich hervor."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/projects/{uuid}/exports/{exportUuid}/download": {
            "get": {
                "operationId": "flowcall-exports-download",
                "summary": "Eine fertige Exportdatei abrufen",
                "description": "Liefert die fertige Datei als Download. Ein Export, der noch läuft, fehlgeschlagen oder abgelaufen ist, antwortet mit HTTP 409 und dem Fehler not_ready. Ist die Datei nicht mehr vorhanden, antwortet der Abruf mit HTTP 410 und dem Fehler file_missing. Benötigt projekt_leads_export.",
                "tags": [
                    "exports"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "exportUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads": {
            "get": {
                "operationId": "flowcall-leads-index",
                "summary": "Leads auflisten",
                "description": "Die Leads aller erreichbaren Projekte, neueste zuerst, gefiltert und seitenweise. Ohne project_uuid umfasst die Liste jedes Projekt, das dieser Schlüssel sieht.",
                "tags": [
                    "leads"
                ],
                "parameters": [
                    {
                        "name": "project_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Auf ein Telefonie-Projekt einschränken.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Nur Leads mit diesem Gesprächsergebnis, etwa Termin vereinbart.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "assigned_user_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Nur Leads, die diesem Teammitglied zugeordnet sind.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Sucht in Firma, Ansprechpartner, Vorname, Nachname und Stadt.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "follow_up_due",
                        "in": "query",
                        "required": false,
                        "description": "Nur Leads, deren Wiedervorlage heute fällig oder überfällig ist.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "locked",
                        "in": "query",
                        "required": false,
                        "description": "Nur Leads, die gerade in Bearbeitung sind, oder nur die freien.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "untouched",
                        "in": "query",
                        "required": false,
                        "description": "Nur Leads ganz ohne Ergebniszeile.",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Einträge pro Seite, 1 bis 200, Standard 25.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seitenzahl, Standard 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                            "project_uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                            "company": "Mustermann Bedachungen",
                                            "contact_person": "Frau Keller",
                                            "first_name": null,
                                            "last_name": null,
                                            "address": null,
                                            "street": "Hauptstraße",
                                            "house_number": "12",
                                            "postcode": "50667",
                                            "city": "Köln",
                                            "state": "Nordrhein-Westfalen",
                                            "country": "Deutschland",
                                            "phone_numbers": [
                                                {
                                                    "label": "Zentrale",
                                                    "value": "0221 1234567"
                                                }
                                            ],
                                            "emails": [
                                                {
                                                    "label": "Allgemein",
                                                    "value": "info@example.com"
                                                }
                                            ],
                                            "websites": [],
                                            "extra": [],
                                            "form_data": [],
                                            "locked": false,
                                            "locked_until": null,
                                            "status": "Wiedervorlage",
                                            "created_at": "2026-09-05T14:09:00+02:00",
                                            "updated_at": "2026-09-19T16:42:00+02:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-leads-store",
                "summary": "Einen Lead anlegen",
                "description": "Legt einen Lead in einem Telefonie-Projekt an und antwortet mit HTTP 201. Die Kennung vergibt die Plattform; eine eigene Referenz gehört in extra. Benötigt projekt_lead_hinzufuegen.",
                "tags": [
                    "leads"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "project_uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                        "company": "Mustermann Bedachungen",
                                        "contact_person": "Frau Keller",
                                        "city": "Köln",
                                        "phone_numbers": [
                                            {
                                                "label": "Zentrale",
                                                "value": "0221 1234567"
                                            }
                                        ],
                                        "emails": [],
                                        "websites": [],
                                        "extra": [],
                                        "form_data": [],
                                        "locked": false,
                                        "locked_until": null
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "project_uuid": {
                                        "type": "string",
                                        "description": "Das Telefonie-Projekt, angesprochen über die UUID des Kundenprojekts."
                                    },
                                    "company": {
                                        "type": "string",
                                        "description": "Firma, höchstens 255 Zeichen."
                                    },
                                    "contact_person": {
                                        "type": "string",
                                        "description": "Ansprechpartner, höchstens 255 Zeichen."
                                    },
                                    "first_name": {
                                        "type": "string",
                                        "description": "Vorname, höchstens 255 Zeichen."
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "description": "Nachname, höchstens 255 Zeichen."
                                    },
                                    "address": {
                                        "type": "string",
                                        "description": "Vollständige Anschrift als ein Feld, höchstens 1000 Zeichen."
                                    },
                                    "street": {
                                        "type": "string",
                                        "description": "Straße, höchstens 255 Zeichen."
                                    },
                                    "house_number": {
                                        "type": "string",
                                        "description": "Hausnummer, höchstens 50 Zeichen."
                                    },
                                    "postcode": {
                                        "type": "string",
                                        "description": "Postleitzahl, höchstens 20 Zeichen."
                                    },
                                    "city": {
                                        "type": "string",
                                        "description": "Stadt, höchstens 255 Zeichen."
                                    },
                                    "state": {
                                        "type": "string",
                                        "description": "Bundesland, höchstens 255 Zeichen."
                                    },
                                    "country": {
                                        "type": "string",
                                        "description": "Land, höchstens 255 Zeichen."
                                    },
                                    "phone_numbers": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Liste aus Paaren mit label und value. Ein bloßer Text ohne Bezeichnung wird nicht entgegengenommen."
                                    },
                                    "emails": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Liste aus Paaren mit label und value."
                                    },
                                    "websites": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Liste aus Paaren mit label und value."
                                    },
                                    "extra": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Weitere Angaben, frei strukturiert. Der richtige Ort für eine eigene Referenz."
                                    },
                                    "form_data": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Antworten des Gesprächsformulars, abgelegt unter den Schlüsseln der Felder."
                                    },
                                    "project_id": {
                                        "type": "integer",
                                        "description": "Wird zurückgewiesen. Stattdessen project_uuid verwenden."
                                    },
                                    "team_id": {
                                        "type": "integer",
                                        "description": "Wird zurückgewiesen. Das Team folgt aus dem API-Schlüssel."
                                    }
                                },
                                "required": [
                                    "project_uuid"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}": {
            "get": {
                "operationId": "flowcall-leads-show",
                "summary": "Einen Lead abrufen",
                "description": "Ein Lead mit seinem aktuellen Gesprächsergebnis, der zuständigen Person und allem, was daran hängt. Die Teillisten sind begrenzt: bis zu 50 Anrufe, 50 Kommentare und 50 E-Mails sowie die Wiedervorlage. Wer den vollen Verlauf braucht, nimmt die eigenen Listen. Benötigt projekt_alle_leads oder projekt_telefonie.",
                "tags": [
                    "leads"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "project_uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                        "company": "Mustermann Bedachungen",
                                        "city": "Köln",
                                        "locked": false,
                                        "status": "Wiedervorlage",
                                        "assigned_user_uuid": "3f8b1c6e-2d44-4a9b-8e77-5c1a0b9d3e22",
                                        "calls": [
                                            {
                                                "uuid": "0c95e2a7-48b3-4d61-90fa-7e2c5b8d1436",
                                                "status": "Keinen erreicht",
                                                "agent_name": "Anna Berger",
                                                "created_at": "2026-09-18T09:15:00+02:00"
                                            }
                                        ],
                                        "comments": [
                                            {
                                                "uuid": "a1d7b309-64ce-4f28-8b05-9c3e7f0a2d54",
                                                "text": "Ruft nächste Woche zurück.",
                                                "system": false,
                                                "agent_name": "Anna Berger",
                                                "created_at": "2026-09-19T16:42:00+02:00"
                                            }
                                        ],
                                        "follow_ups": [
                                            {
                                                "uuid": "5e8c0b43-2fa7-4916-8d3c-1b6a9e4f7c20",
                                                "date": "2026-09-25",
                                                "time": "09:30",
                                                "agent_name": "Anna Berger"
                                            }
                                        ],
                                        "emails": []
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "flowcall-leads-update",
                "summary": "Einen Lead ändern",
                "description": "Ändert die Stammdaten eines Leads. Ein weggelassenes Feld bleibt unverändert. Die Änderung wird als Kommentar festgehalten, genau wie in der Oberfläche; solche Kommentare tragen in der Kommentarliste die Angabe system. Die Felder sind dieselben wie beim Anlegen. project_uuid, project_id und team_id werden zurückgewiesen. Benötigt projekt_bearbeiten oder projekt_telefonie.",
                "tags": [
                    "leads"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "project_uuid": "8f1c4a72-3d95-4e06-b1a8-5c7e2d0f9b41",
                                        "company": "Mustermann Bedachungen GmbH",
                                        "city": "Köln",
                                        "locked": false,
                                        "updated_at": "2026-09-20T10:11:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "company": {
                                        "type": "string",
                                        "description": "Firma, höchstens 255 Zeichen."
                                    },
                                    "contact_person": {
                                        "type": "string",
                                        "description": "Ansprechpartner, höchstens 255 Zeichen."
                                    },
                                    "first_name": {
                                        "type": "string",
                                        "description": "Vorname, höchstens 255 Zeichen."
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "description": "Nachname, höchstens 255 Zeichen."
                                    },
                                    "address": {
                                        "type": "string",
                                        "description": "Vollständige Anschrift als ein Feld, höchstens 1000 Zeichen."
                                    },
                                    "street": {
                                        "type": "string",
                                        "description": "Straße, höchstens 255 Zeichen."
                                    },
                                    "house_number": {
                                        "type": "string",
                                        "description": "Hausnummer, höchstens 50 Zeichen."
                                    },
                                    "postcode": {
                                        "type": "string",
                                        "description": "Postleitzahl, höchstens 20 Zeichen."
                                    },
                                    "city": {
                                        "type": "string",
                                        "description": "Stadt, höchstens 255 Zeichen."
                                    },
                                    "state": {
                                        "type": "string",
                                        "description": "Bundesland, höchstens 255 Zeichen."
                                    },
                                    "country": {
                                        "type": "string",
                                        "description": "Land, höchstens 255 Zeichen."
                                    },
                                    "phone_numbers": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Liste aus Paaren mit label und value."
                                    },
                                    "emails": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Liste aus Paaren mit label und value."
                                    },
                                    "websites": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Liste aus Paaren mit label und value."
                                    },
                                    "extra": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Weitere Angaben, frei strukturiert."
                                    },
                                    "form_data": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Antworten des Gesprächsformulars."
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "flowcall-leads-destroy",
                "summary": "Einen Lead löschen",
                "description": "Entfernt den Lead samt seinen Anrufen, Kommentaren, Wiedervorlagen und E-Mails. Benötigt projekte_verwalten.",
                "tags": [
                    "leads"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "message": "Lead gelöscht."
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}/status": {
            "put": {
                "operationId": "flowcall-leads-status",
                "summary": "Das Ergebnis eines Gesprächs festhalten",
                "description": "Schreibt das aktuelle Gesprächsergebnis des Leads und überschreibt dabei das bisherige. In einem Zug entstehen wahlweise ein Kommentar, ein Eintrag im Gesprächsverlauf und eine neue Wiedervorlage. Jedes festgehaltene Ergebnis schließt die offene Wiedervorlage, sofern nicht zugleich ein neues Datum mitgegeben wird. Benötigt projekt_telefonie.",
                "tags": [
                    "leads"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "status": "Wiedervorlage",
                                        "follow_up_date": "2026-09-25"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "description": "Das Gesprächsergebnis, höchstens 255 Zeichen. Üblich sind Offen, Übersprungen, Kein Interesse, Keinen erreicht, Falsche Rufnummer, AP nicht im hause, Wiedervorlage, E-Mail senden und Termin vereinbart; das Feld ist Freitext."
                                    },
                                    "comment": {
                                        "type": "string",
                                        "description": "Wird als Kommentar am Lead festgehalten, höchstens 60000 Zeichen."
                                    },
                                    "follow_up_date": {
                                        "type": "string",
                                        "description": "Neue Wiedervorlage im Format JJJJ-MM-TT. Ohne Angabe wird die offene Wiedervorlage geschlossen."
                                    },
                                    "follow_up_time": {
                                        "type": "string",
                                        "description": "Uhrzeit der Wiedervorlage im Format HH:MM, Standard 08:00."
                                    },
                                    "log_call": {
                                        "type": "boolean",
                                        "description": "Ob zusätzlich ein Eintrag im Gesprächsverlauf entsteht. Standard ist true; false passt zu einem übersprungenen Lead, der nie als Anruf gezählt hat."
                                    }
                                },
                                "required": [
                                    "status"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}/lock": {
            "post": {
                "operationId": "flowcall-leads-lock",
                "summary": "Einen Lead in Bearbeitung nehmen",
                "description": "Nimmt den Lead für die eigene Bearbeitung, damit zwei Personen ihn nicht gleichzeitig anrufen. Ein Lead, den bereits jemand bearbeitet, antwortet mit HTTP 409, statt stillschweigend übernommen zu werden. Benötigt projekt_telefonie.",
                "tags": [
                    "leads"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "locked": true,
                                        "locked_until": "2026-09-20T10:45:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "flowcall-leads-unlock",
                "summary": "Einen Lead wieder freigeben",
                "description": "Gibt den Lead zurück in die gemeinsame Liste. Benötigt projekt_telefonie.",
                "tags": [
                    "leads"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "message": "Sperre aufgehoben."
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}/comments": {
            "get": {
                "operationId": "flowcall-comments-index",
                "summary": "Kommentare eines Leads auflisten",
                "description": "Die Kommentare eines Leads, neueste zuerst. Benötigt projekt_telefonie.",
                "tags": [
                    "comments"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Einträge pro Seite, 1 bis 200, Standard 25.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seitenzahl, Standard 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "a1d7b309-64ce-4f28-8b05-9c3e7f0a2d54",
                                            "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                            "agent_uuid": "3f8b1c6e-2d44-4a9b-8e77-5c1a0b9d3e22",
                                            "agent_name": "Anna Berger",
                                            "text": "Ruft nächste Woche zurück.",
                                            "system": false,
                                            "created_at": "2026-09-19T16:42:00+02:00",
                                            "updated_at": "2026-09-19T16:42:00+02:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-comments-store",
                "summary": "Einen Kommentar schreiben",
                "description": "Hält eine Notiz am Lead fest und antwortet mit HTTP 201. Benötigt projekt_telefonie.",
                "tags": [
                    "comments"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "a1d7b309-64ce-4f28-8b05-9c3e7f0a2d54",
                                        "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "agent_name": "Anna Berger",
                                        "text": "Ruft nächste Woche zurück.",
                                        "system": false,
                                        "created_at": "2026-09-19T16:42:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "text": {
                                        "type": "string",
                                        "description": "Der Text, höchstens 60000 Zeichen."
                                    }
                                },
                                "required": [
                                    "text"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}/comments/{commentUuid}": {
            "put": {
                "operationId": "flowcall-comments-update",
                "summary": "Einen Kommentar ändern",
                "description": "Schreibt einen Kommentar um. Nur die Person, die ihn verfasst hat, darf das; jede andere erhält HTTP 403. Benötigt projekt_telefonie.",
                "tags": [
                    "comments"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "commentUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "a1d7b309-64ce-4f28-8b05-9c3e7f0a2d54",
                                        "text": "Ruft übernächste Woche zurück.",
                                        "system": false,
                                        "updated_at": "2026-09-20T09:00:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "text": {
                                        "type": "string",
                                        "description": "Der neue Text, höchstens 60000 Zeichen."
                                    }
                                },
                                "required": [
                                    "text"
                                ]
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "flowcall-comments-destroy",
                "summary": "Einen Kommentar löschen",
                "description": "Entfernt einen Kommentar. Nur die Person, die ihn verfasst hat, darf das; jede andere erhält HTTP 403. Benötigt projekt_telefonie.",
                "tags": [
                    "comments"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "commentUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "message": "Kommentar gelöscht."
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}/follow-ups": {
            "get": {
                "operationId": "flowcall-follow-ups-index",
                "summary": "Wiedervorlagen eines Leads auflisten",
                "description": "Die Wiedervorlage des Leads, nach Datum und Uhrzeit geordnet. Da ein Lead höchstens eine trägt, ist die Liste leer oder einelementig. Benötigt projekt_telefonie.",
                "tags": [
                    "follow-ups"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "5e8c0b43-2fa7-4916-8d3c-1b6a9e4f7c20",
                                            "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                            "agent_uuid": "3f8b1c6e-2d44-4a9b-8e77-5c1a0b9d3e22",
                                            "agent_name": "Anna Berger",
                                            "date": "2026-09-25",
                                            "time": "09:30",
                                            "created_at": "2026-09-19T16:42:00+02:00",
                                            "updated_at": "2026-09-19T16:42:00+02:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-follow-ups-store",
                "summary": "Eine Wiedervorlage setzen",
                "description": "Legt den Lead für einen Tag zurück auf die Liste und antwortet mit HTTP 201. Eine bestehende Wiedervorlage wird dabei ersetzt. Benötigt projekt_telefonie.",
                "tags": [
                    "follow-ups"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "5e8c0b43-2fa7-4916-8d3c-1b6a9e4f7c20",
                                        "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "agent_name": "Anna Berger",
                                        "date": "2026-09-25",
                                        "time": "09:30"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "date": {
                                        "type": "string",
                                        "description": "Datum im Format JJJJ-MM-TT."
                                    },
                                    "time": {
                                        "type": "string",
                                        "description": "Uhrzeit im Format HH:MM, Standard 08:00."
                                    }
                                },
                                "required": [
                                    "date"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}/follow-ups/{followUpUuid}": {
            "put": {
                "operationId": "flowcall-follow-ups-update",
                "summary": "Eine Wiedervorlage verschieben",
                "description": "Verschiebt eine bestehende Wiedervorlage. Datum und Uhrzeit lassen sich einzeln ändern. Benötigt projekt_telefonie.",
                "tags": [
                    "follow-ups"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "followUpUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "5e8c0b43-2fa7-4916-8d3c-1b6a9e4f7c20",
                                        "date": "2026-09-28",
                                        "time": "14:00",
                                        "updated_at": "2026-09-20T09:05:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "date": {
                                        "type": "string",
                                        "description": "Neues Datum im Format JJJJ-MM-TT."
                                    },
                                    "time": {
                                        "type": "string",
                                        "description": "Neue Uhrzeit im Format HH:MM."
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "flowcall-follow-ups-destroy",
                "summary": "Eine Wiedervorlage löschen",
                "description": "Entfernt die Wiedervorlage, ohne ein Gesprächsergebnis zu schreiben. Benötigt projekt_telefonie.",
                "tags": [
                    "follow-ups"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "followUpUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "message": "Wiedervorlage gelöscht."
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}/calls": {
            "get": {
                "operationId": "flowcall-calls-index",
                "summary": "Den Gesprächsverlauf eines Leads abrufen",
                "description": "Die Einträge des Gesprächsverlaufs, neueste zuerst. Benötigt projekt_telefonie.",
                "tags": [
                    "calls"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Einträge pro Seite, 1 bis 200, Standard 25.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seitenzahl, Standard 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "0c95e2a7-48b3-4d61-90fa-7e2c5b8d1436",
                                            "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                            "agent_uuid": "3f8b1c6e-2d44-4a9b-8e77-5c1a0b9d3e22",
                                            "agent_name": "Anna Berger",
                                            "status": "Keinen erreicht",
                                            "created_at": "2026-09-18T09:15:00+02:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-calls-store",
                "summary": "Einen Anruf nachtragen",
                "description": "Trägt einen Anruf nach, der anderswo stattgefunden hat, und antwortet mit HTTP 201. Geschrieben wird allein der Eintrag im Verlauf; das aktuelle Gesprächsergebnis des Leads bleibt, wo es ist. Benötigt projekt_telefonie.",
                "tags": [
                    "calls"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "0c95e2a7-48b3-4d61-90fa-7e2c5b8d1436",
                                        "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "agent_name": "Anna Berger",
                                        "status": "Keinen erreicht",
                                        "created_at": "2026-09-20T11:00:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "status": {
                                        "type": "string",
                                        "description": "Das Ergebnis dieses Anrufs, höchstens 255 Zeichen. Üblich sind dieselben neun Begriffe wie beim Gesprächsergebnis; das Feld ist Freitext."
                                    }
                                },
                                "required": [
                                    "status"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/leads/{uuid}/emails": {
            "get": {
                "operationId": "flowcall-emails-index",
                "summary": "E-Mails eines Leads auflisten",
                "description": "Die an den Lead geschriebenen E-Mails, neueste zuerst. Die Zeitstempel für Zustellung, Öffnung, Klick und Unzustellbarkeit füllt der Versanddienst später; bis dahin bleiben sie leer. Benötigt projekt_telefonie.",
                "tags": [
                    "emails"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Einträge pro Seite, 1 bis 200, Standard 25.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seitenzahl, Standard 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "7b1e0d46-93ac-4f27-8051-4d6a2c9f5e83",
                                            "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                            "status": "ausstehend",
                                            "address": "info@example.com",
                                            "subject": "Unser Gespräch",
                                            "body": "Guten Tag, wie besprochen ...",
                                            "attachment": null,
                                            "delivered_at": null,
                                            "opened_at": null,
                                            "clicked_at": null,
                                            "bounced_at": null,
                                            "created_at": "2026-09-19T16:45:00+02:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-emails-store",
                "summary": "Eine E-Mail an den Lead einreihen",
                "description": "Reiht eine E-Mail aus der Projektvorlage ein und antwortet mit HTTP 202. Wird ein Wiedervorlagedatum mitgegeben, kommt der Lead an diesem Tag zurück auf die Liste; ohne Datum wird die offene Wiedervorlage geschlossen. Benötigt projekt_telefonie.",
                "tags": [
                    "emails"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "7b1e0d46-93ac-4f27-8051-4d6a2c9f5e83",
                                        "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                        "status": "ausstehend",
                                        "address": "info@example.com",
                                        "subject": "Unser Gespräch",
                                        "delivered_at": null,
                                        "created_at": "2026-09-20T11:30:00+02:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "address": {
                                        "type": "string",
                                        "description": "Empfängeradresse, höchstens 255 Zeichen."
                                    },
                                    "subject": {
                                        "type": "string",
                                        "description": "Betreff, höchstens 255 Zeichen. Ohne Angabe gilt die Projektvorlage."
                                    },
                                    "body": {
                                        "type": "string",
                                        "description": "Text, höchstens 200000 Zeichen. Ohne Angabe gilt die Projektvorlage."
                                    },
                                    "skip_verification": {
                                        "type": "boolean",
                                        "description": "Markiert die Adresse ohne Prüfung als gültig, wie es das Kästchen in der Oberfläche tut. Der Vorgang wird am Lead als Kommentar festgehalten."
                                    },
                                    "follow_up_date": {
                                        "type": "string",
                                        "description": "Wiedervorlage im Format JJJJ-MM-TT."
                                    },
                                    "follow_up_time": {
                                        "type": "string",
                                        "description": "Uhrzeit der Wiedervorlage im Format HH:MM, Standard 08:00."
                                    }
                                },
                                "required": [
                                    "address"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/roles": {
            "get": {
                "operationId": "flowcall-roles-index",
                "summary": "Rollen auflisten",
                "description": "Alle FlowCall-Rollen des Teams mit ihren zehn Berechtigungen, alphabetisch. Benötigt team_rollen_verwalten.",
                "tags": [
                    "team"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "9c40b7e2-1a58-4d63-b07f-8e5c2a1d9f34",
                                            "name": "agent",
                                            "flags": {
                                                "team_verwalten": false,
                                                "team_rollen_verwalten": false,
                                                "callhistory_all": false,
                                                "projekte_verwalten": false,
                                                "projekt_bearbeiten": false,
                                                "projekt_alle_leads": false,
                                                "projekt_leads_export": false,
                                                "projekt_telefonie": true,
                                                "projekt_lead_hinzufuegen": true,
                                                "projekt_unstimmigkeiten": false
                                            },
                                            "created_at": "2026-08-12T10:00:00+02:00",
                                            "updated_at": "2026-08-12T10:00:00+02:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "flowcall-roles-store",
                "summary": "Eine Rolle anlegen",
                "description": "Legt eine Rolle an und antwortet mit HTTP 201. Der Name wird in Kleinbuchstaben gespeichert und muss im Team eindeutig sein; ein bereits vergebener Name antwortet mit HTTP 422 und dem Fehler already_exists. Nicht genannte Berechtigungen werden abgelehnt gesetzt. Benötigt team_rollen_verwalten.",
                "tags": [
                    "team"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "9c40b7e2-1a58-4d63-b07f-8e5c2a1d9f34",
                                        "name": "agent",
                                        "flags": {
                                            "team_verwalten": false,
                                            "team_rollen_verwalten": false,
                                            "callhistory_all": false,
                                            "projekte_verwalten": false,
                                            "projekt_bearbeiten": false,
                                            "projekt_alle_leads": false,
                                            "projekt_leads_export": false,
                                            "projekt_telefonie": true,
                                            "projekt_lead_hinzufuegen": true,
                                            "projekt_unstimmigkeiten": false
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Der Name der Rolle, höchstens 255 Zeichen. Er wird in Kleinbuchstaben gespeichert."
                                    },
                                    "flags": {
                                        "type": "object",
                                        "description": "Die Berechtigungen als Wahrheitswerte, benannt nach den zehn Namen aus dem Überblick. Ein unbekannter Name wird zurückgewiesen, statt stillschweigend übergangen zu werden."
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/roles/{uuid}": {
            "put": {
                "operationId": "flowcall-roles-update",
                "summary": "Eine Rolle ändern",
                "description": "Ändert Name und Berechtigungen. Eine nicht genannte Berechtigung bleibt unverändert. Ein Umbenennen trägt den neuen Namen im selben Schritt in die Zuweisungen und in die Projektberechtigungen nach. Ein bereits vergebener Name antwortet mit HTTP 422 und dem Fehler already_exists. Benötigt team_rollen_verwalten.",
                "tags": [
                    "team"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "9c40b7e2-1a58-4d63-b07f-8e5c2a1d9f34",
                                        "name": "agent senior",
                                        "flags": {
                                            "projekt_telefonie": true,
                                            "projekt_alle_leads": true,
                                            "projekt_leads_export": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "name": {
                                        "type": "string",
                                        "description": "Der neue Name, höchstens 255 Zeichen. Er wird in Kleinbuchstaben gespeichert."
                                    },
                                    "flags": {
                                        "type": "object",
                                        "description": "Die zu ändernden Berechtigungen als Wahrheitswerte. Nicht genannte bleiben, wie sie sind."
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "flowcall-roles-destroy",
                "summary": "Eine Rolle löschen",
                "description": "Löscht eine Rolle, die niemand mehr trägt. Trägt sie noch jemand, antwortet der Aufruf mit HTTP 409 und dem Fehler role_in_use. Benötigt team_rollen_verwalten.",
                "tags": [
                    "team"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "message": "Rolle gelöscht."
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/members": {
            "get": {
                "operationId": "flowcall-members-index",
                "summary": "Teammitglieder auflisten",
                "description": "Alle Mitglieder des FlowCall-Teams mit der Rolle, die sie tragen. Die UUID des Eintrags benennt die Mitgliedschaft, user_uuid die Person. Benötigt team_verwalten.",
                "tags": [
                    "team"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "c8f52e07-4b1a-4936-80d7-2e6c9a3f5b18",
                                            "user_uuid": "3f8b1c6e-2d44-4a9b-8e77-5c1a0b9d3e22",
                                            "name": "Anna Berger",
                                            "email": "anna@example.com",
                                            "role": "agent",
                                            "created_at": "2026-08-12T10:05:00+02:00"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/members/{userUuid}/role": {
            "put": {
                "operationId": "flowcall-members-role",
                "summary": "Einem Mitglied eine Rolle geben",
                "description": "Weist einem Mitglied des Teams eine FlowCall-Rolle zu. Die Rolle wird über ihre UUID benannt, damit ein Umbenennen nicht mit einer Neuzuweisung verwechselt wird. Die Zuweisung wirkt sofort in allen Projektberechtigungen dieser Person. Eine Person außerhalb des Teams antwortet mit HTTP 404. Benötigt team_verwalten.",
                "tags": [
                    "team"
                ],
                "parameters": [
                    {
                        "name": "userUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "c8f52e07-4b1a-4936-80d7-2e6c9a3f5b18",
                                        "user_uuid": "3f8b1c6e-2d44-4a9b-8e77-5c1a0b9d3e22",
                                        "name": "Anna Berger",
                                        "email": "anna@example.com",
                                        "role": "agent senior"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "role_uuid": {
                                        "type": "string",
                                        "description": "UUID der FlowCall-Rolle."
                                    }
                                },
                                "required": [
                                    "role_uuid"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/call-history": {
            "get": {
                "operationId": "flowcall-call-history",
                "summary": "Das Telefonprotokoll abrufen",
                "description": "Die Gespräche aus der angebundenen Telefonanlage, neueste zuerst. Mit callhistory_all umfasst die Liste das ganze Team, sonst nur die eigenen Gespräche. Ist eine Zeile einem Lead zugeordnet, trägt sie dessen UUID.",
                "tags": [
                    "call-history"
                ],
                "parameters": [
                    {
                        "name": "direction",
                        "in": "query",
                        "required": false,
                        "description": "Richtung des Gesprächs, wie die Telefonanlage sie meldet, etwa inbound oder outbound.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "since",
                        "in": "query",
                        "required": false,
                        "description": "Nur Gespräche ab diesem Zeitpunkt, als Datum oder Zeitstempel.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Einträge pro Seite, 1 bis 200, Standard 25.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seitenzahl, Standard 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "direction": "outbound",
                                            "status": "answered",
                                            "from_number": "+4922112345",
                                            "to_number": "+492211234567",
                                            "start_time": "2026-09-18 09:15:02",
                                            "answered_time": "2026-09-18 09:15:11",
                                            "end_time": "2026-09-18 09:18:40",
                                            "duration": 209,
                                            "comment": null,
                                            "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/reports/leads": {
            "get": {
                "operationId": "flowcall-reports-leads",
                "summary": "Leadbestand",
                "description": "Wie es um die Leads der erreichbaren Projekte steht: die Gesamtzahl, wie viele gerade in Bearbeitung sind, wie viele noch niemand angefasst hat und die Verteilung über die Gesprächsergebnisse.",
                "tags": [
                    "reports"
                ],
                "parameters": [
                    {
                        "name": "project_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Auf ein Telefonie-Projekt einschränken.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "total": 1240,
                                        "locked": 3,
                                        "untouched": 480,
                                        "by_status": {
                                            "Offen": 120,
                                            "Keinen erreicht": 310,
                                            "Kein Interesse": 190,
                                            "Wiedervorlage": 78,
                                            "Termin vereinbart": 62
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/reports/calls": {
            "get": {
                "operationId": "flowcall-reports-calls",
                "summary": "Anrufaufkommen",
                "description": "Wie viel telefoniert wurde, von wem und mit welchem Ergebnis. Das Fenster wird in Tagen zurückgerechnet und liegt bei höchstens einem Jahr, weil die Auswertung auf dem vollständigen Gesprächsverlauf arbeitet.",
                "tags": [
                    "reports"
                ],
                "parameters": [
                    {
                        "name": "project_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Auf ein Telefonie-Projekt einschränken.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "days",
                        "in": "query",
                        "required": false,
                        "description": "Zeitfenster in Tagen, 1 bis 365, Standard 14.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "window_days": 14,
                                        "total": 842,
                                        "mine": 214,
                                        "by_agent": [
                                            {
                                                "user_uuid": "3f8b1c6e-2d44-4a9b-8e77-5c1a0b9d3e22",
                                                "calls": 214
                                            }
                                        ],
                                        "by_status": {
                                            "Keinen erreicht": 401,
                                            "Kein Interesse": 233,
                                            "Termin vereinbart": 38
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcall/reports/follow-ups": {
            "get": {
                "operationId": "flowcall-reports-follow-ups",
                "summary": "Wiedervorlagen",
                "description": "Was überfällig ist, was heute ansteht und was als Nächstes kommt. Die Vorschau umfasst die zwanzig nächsten Wiedervorlagen.",
                "tags": [
                    "reports"
                ],
                "parameters": [
                    {
                        "name": "project_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Auf ein Telefonie-Projekt einschränken.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "overdue": 12,
                                        "today": 7,
                                        "mine": 5,
                                        "next": [
                                            {
                                                "uuid": "5e8c0b43-2fa7-4916-8d3c-1b6a9e4f7c20",
                                                "lead_uuid": "f37a2d08-5b14-4e9c-8207-6d0a1f8c3b52",
                                                "agent_uuid": "3f8b1c6e-2d44-4a9b-8e77-5c1a0b9d3e22",
                                                "agent_name": "Anna Berger",
                                                "date": "2026-09-25",
                                                "time": "09:30"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "API-Schlüssel (pk_… oder at_…) als Authorization: Bearer <Schlüssel>. Andere Übergabewege werden mit 401 abgelehnt."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean"
                    },
                    "error": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object"
                    }
                }
            }
        }
    }
}