{
    "openapi": "3.1.0",
    "info": {
        "title": "FlowAccounting API",
        "version": "v1",
        "description": "Rechnungs-API für Rechnungen, Angebote, Rechnungskorrekturen, Positionen, Transaktionen, Produkte, Steuersätze und wiederkehrende Abrechnung sowie für Ausgaben und Belege. Mit PDF-, ZUGFeRD- und XRechnung-Export sowie Stripe-Zahlungsabgleich."
    },
    "servers": [
        {
            "url": "https://api.flowsuite.one",
            "description": "FlowSuite API"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "invoices",
            "description": "Rechnungen"
        },
        {
            "name": "items",
            "description": "Rechnungspositionen"
        },
        {
            "name": "transactions",
            "description": "Transaktionen"
        },
        {
            "name": "products",
            "description": "Produkte"
        },
        {
            "name": "tax-rates",
            "description": "Steuersätze"
        },
        {
            "name": "recurring",
            "description": "Wiederkehrende Rechnungen"
        },
        {
            "name": "installment-plans",
            "description": "Ratenzahlungen"
        },
        {
            "name": "billable-items",
            "description": "Abrechenbare Positionen"
        },
        {
            "name": "quotes",
            "description": "Angebote"
        },
        {
            "name": "quote-items",
            "description": "Angebotspositionen"
        },
        {
            "name": "credit-notes",
            "description": "Rechnungskorrekturen"
        },
        {
            "name": "expenses",
            "description": "Ausgaben"
        },
        {
            "name": "suppliers",
            "description": "Lieferanten"
        },
        {
            "name": "expense-categories",
            "description": "Ausgabenkategorien"
        },
        {
            "name": "income-categories",
            "description": "Einnahmenkategorien"
        },
        {
            "name": "reports",
            "description": "Berichte und Kontext"
        },
        {
            "name": "tax-profile",
            "description": "Steuerprofil und Funktionen"
        }
    ],
    "paths": {
        "/flowaccounting/invoices": {
            "get": {
                "operationId": "invoices-list",
                "summary": "Rechnungen auflisten",
                "description": "Ruft eine paginierte Liste aller Rechnungen des Teams ab (sortiert nach Rechnungsdatum, absteigend).",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "include",
                        "in": "query",
                        "required": false,
                        "description": "Mit items werden die Rechnungspositionen einschließlich name und description eingebettet",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Filter: draft, sent, partially_paid, paid, overdue, past_due, cancelled",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Kunden-UUID (cmm_clients). Breaking Change: die früheren Filter client_id und contact_id werden mit 422 abgelehnt, statt stillschweigend ignoriert zu werden",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Suchbegriff (Rechnungsnummer, Empfängername, Firma)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Rechnungsdatum ab (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Rechnungsdatum bis (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 15)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                            "invoice_number": "RE-2026-0042",
                                            "status": "sent",
                                            "recipient_name": "Mustermann GmbH",
                                            "total": 1190,
                                            "allowed_transitions": [
                                                "paid",
                                                "cancelled"
                                            ]
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 15,
                                        "total": 42
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "invoices-create",
                "summary": "Rechnung erstellen",
                "description": "Erstellt eine neue Rechnung. Die Rechnungsnummer wird automatisch aus dem Nummernkreis des Teams vergeben, und zwar erst beim Ausstellen (Statuswechsel nach sent, Versand per E-Mail oder send beim Anlegen): Ein Entwurf hat invoice_number: null, und ein gelöschter Entwurf verbraucht keine Nummer. Wer die Nummer braucht, liest sie nach dem Ausstellen aus der Antwort oder per GET. Für den Import von Altrechnungen kann sie über invoice_number vorgegeben werden. Eine Rechnung mit vorgegebener Nummer erhält ohne payment_method die Zahlungsart bank_transfer; die Standard-Zahlungsart des Kunden wird dann nicht übernommen. Die vollständige Reihenfolge einer Übernahme steht im Abschnitt „Belege aus einem Fremdsystem übernehmen“. Kollidiert der Nummernkreis beim Ausstellen mit vorhandenen Belegen, antwortet der ausstellende Endpunkt mit 409 und error_code: document_number_conflict. Positionen können entweder direkt beim Erstellen über items mitgegeben oder nachträglich über den Positionen-Endpoint hinzugefügt werden, beide Wege sind gültig. Ohne send entsteht die Rechnung im Status draft. Mit send wird sie unmittelbar nach dem Anlegen per E-Mail versendet und wechselt dabei in den Status sent. Die Antwort führt in diesem Fall zusätzlich das Feld sent, bei einem gescheiterten Versand ergänzt um send_error_code und send_message. Die Rechnung bleibt auch dann mit 201 angelegt. Wird billing_operation_key mitgegeben und existiert die Rechnung dazu bereits, liefert die API den vorhandenen Stand zurück und wendet weder items noch send ein zweites Mal an, so dass ein wiederholter Aufruf keinen Doppelversand auslöst. Breaking Change: Die früheren numerischen Felder client_id, contact_id und items.*.product_id werden nicht mehr akzeptiert (Validierungsfehler); Kunde, Kontakt und Produkt werden ausschließlich über client_uuid, contact_uuid und items.*.product_uuid angegeben. § 19-Hinweis: Ist das Team laut bestätigtem Steuerprofil Kleinunternehmer in Deutschland und würde der noch offene Betrag der Rechnung, sobald bezahlt, die Umsatzgrenze des laufenden Jahres überschreiten (oder ist sie schon überschritten), enthält die Antwort zusätzlich das Feld notices: eine Liste mit code small_business_limit, level would_exceed oder already_exceeded, context invoice, year, den Beträgen in Euro (limit_eur, known_turnover_eur, amount_eur, turnover_after_eur), complete (false, wenn Zahlungen ungeklärt sind), blocking (immer false) und message. Der Hinweis blockiert nie und ändert das Steuerprofil nicht; ohne Hinweis fehlt das Feld.",
                "tags": [
                    "invoices"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "invoice_number": null,
                                        "status": "draft"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient_name": {
                                        "type": "string",
                                        "description": "Name des Rechnungsempfängers"
                                    },
                                    "invoice_date": {
                                        "type": "string",
                                        "description": "Rechnungsdatum (YYYY-MM-DD)"
                                    },
                                    "due_date": {
                                        "type": "string",
                                        "description": "Fälligkeitsdatum (>= invoice_date). Wenn leer: invoice_date + Zahlungsziel des Teams (Standard 14 Tage)"
                                    },
                                    "currency_code": {
                                        "type": "string",
                                        "description": "ISO 4217 Währungscode (3 Zeichen, z.B. EUR)"
                                    },
                                    "client_uuid": {
                                        "type": "string",
                                        "description": "Optional: Kunden-UUID (cmm_clients, teamgebunden)"
                                    },
                                    "contact_uuid": {
                                        "type": "string",
                                        "description": "Optional: Kontakt-UUID (teamgebunden)"
                                    },
                                    "invoice_number": {
                                        "type": "string",
                                        "description": "Optional: eigene Rechnungsnummer, nur für den Import von Altrechnungen gedacht. Im Normalfall weglassen, dann vergibt der Nummernkreis die Nummer. KI-Assistenten und Agenten setzen das Feld nur, wenn der Nutzer ausdrücklich auf einer eigenen Nummer besteht. Höchstens 40 Zeichen aus den Buchstaben A bis Z, Ziffern, Leerzeichen, Punkt, Unterstrich und Bindestrich, am Anfang und Ende ein Buchstabe oder eine Ziffer. Muss im Team eindeutig sein, auch gegenüber gelöschten Entwürfen und stornierten Rechnungen. Liegt die Nummer im laufenden Nummernkreis, muss sie unter dem nächsten Zählerstand liegen; dafür vorher in den FlowAccounting-Einstellungen die nächste Rechnungsnummer über die höchste Importnummer setzen. Der Zähler bleibt unverändert. Nach dem Anlegen lässt sich die Nummer nicht mehr ändern"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Sichtbare Notiz auf der Rechnung"
                                    },
                                    "payment_method": {
                                        "type": "string",
                                        "description": "Zahlungsart: bank_transfer | sepa | stripe | paypal | cash | other. Ohne Angabe gilt die Standard-Zahlungsart des Kunden aus FlowCRM (nicht gesetzt = Banküberweisung); Kreditkarte oder SEPA werden also nur übernommen, wenn sie dort als Standard hinterlegt oder hier explizit angegeben sind. Ausnahme: Mit vorgegebener invoice_number gilt ohne Angabe immer bank_transfer, damit eine übernommene Altrechnung nicht auf ein hinterlegtes Zahlungsmittel des Kunden läuft; eine ausdrücklich angegebene Zahlungsart gilt auch dann. stripe, sepa und paypal setzen eine gespeicherte Stripe-Zahlungsmethode des Kunden vom passenden Typ voraus (sonst 422)."
                                    },
                                    "stripe_pm_id": {
                                        "type": "string",
                                        "description": "Optional: konkrete Stripe-Zahlungsmethode (pm_...) des Kunden. Ohne Angabe wird sie bei stripe, sepa und paypal aus der Standard-Zahlungsmethode des Kunden ergänzt."
                                    },
                                    "tax_treatment": {
                                        "type": "string",
                                        "description": "Steuerbehandlung dieser Rechnung: standard | reverse_charge | reverse_charge_domestic | intra_community_supply | export | non_taxable_abroad | tax_exempt. Ohne Angabe gilt bei manuellen Rechnungen die Steuerbehandlung des Kunden aus FlowCRM. Bei jedem Wert außer standard weist die Rechnung keine Umsatzsteuer aus und trägt den passenden Pflichthinweis: Positionen mit tax_rate über 0 oder mit unit_price_gross werden mit 422 abgelehnt. Nur für source manual. reverse_charge_domestic und tax_exempt gibt es nur nach deutschem Recht: Ein Team, für das laut Steuerprofil kein deutsches Recht gilt, kann sie nicht neu setzen (422), ein schon gespeicherter Wert bleibt erlaubt."
                                    },
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung bei tax_exempt, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen). Steht im Hinweis „Steuerfrei nach … UStG“; ohne Angabe ein allgemeiner Hinweis auf § 4 UStG. Bei anderen Steuerbehandlungen ignoriert"
                                    },
                                    "property_retention_notice": {
                                        "type": "boolean",
                                        "description": "Leistung im Zusammenhang mit einem Grundstück an eine Privatperson: druckt den Hinweis auf die zweijährige Aufbewahrungspflicht (§ 14b Abs. 1 Satz 5 UStG)"
                                    },
                                    "document_language": {
                                        "type": "string",
                                        "description": "Belegsprache der Rechnung: de | en | pt. Ohne Angabe gilt bei manuellen Rechnungen die Rechnungssprache des Kunden aus FlowCRM, sonst de"
                                    },
                                    "send": {
                                        "type": "boolean",
                                        "description": "Rechnung sofort nach dem Anlegen per E-Mail versenden. Ohne dieses Flag bleibt es beim Entwurf"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Rechnungspositionen direkt mitgeben, 1 bis 200 Stück. Je Position sind <code>quantity</code> und <code>unit_price</code> verpflichtend, optional sind <code>name</code>, <code>description</code>, <code>tax_rate</code>, <code>unit</code>, <code>position</code>, <code>product_uuid</code>, <code>discount_percent</code> und <code>type</code>. Ohne <code>position</code> werden die Positionen fortlaufend nummeriert"
                                    }
                                },
                                "required": [
                                    "recipient_name",
                                    "invoice_date",
                                    "currency_code"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}": {
            "get": {
                "operationId": "invoices-show",
                "summary": "Rechnungs-Details abrufen",
                "description": "Rechnungs-Details abrufen, inklusive Positionen, Transaktionen sowie total_paid, remaining_amount und allowed_transitions. sent_date nennt den Tag des Versands und ist im Entwurf null. kind ist invoice oder cancellation (Stornorechnung). Eine Stornorechnung ist ein eigener Beleg mit eigener Nummer aus dem Rechnungskreis und negativen Beträgen; cancels_invoice nennt die stornierte Rechnung (uuid, invoice_number, invoice_date). Eine stornierte Rechnung behält Nummer und Inhalt, cancelled_by_invoice verweist auf ihre Stornorechnung und cancelled_at nennt den Zeitpunkt. original_invoice_number ist nur bei Stornos aus der Zeit vor den Stornorechnungen gesetzt: Damals bekam die stornierte Rechnung selbst eine neue Nummer, das Feld nennt die Nummer, unter der sie ausgestellt war. Unter credit_notes stehen die Rechnungskorrekturen, die zu dieser Rechnung angelegt wurden, aufsteigend nach Datum der Rechnungskorrektur und jeweils mit uuid, credit_note_number, status, credit_note_date, total und currency_code; die vollständige Rechnungskorrektur liefert der Rechnungskorrekturen-Endpoint. credit_notes gibt es nur in dieser Detailantwort, nicht in der Liste.",
                "tags": [
                    "invoices"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "invoice_number": "RE-2026-0042",
                                        "original_invoice_number": null,
                                        "kind": "invoice",
                                        "cancels_invoice": null,
                                        "cancelled_by_invoice": null,
                                        "cancelled_at": null,
                                        "status": "paid",
                                        "invoice_date": "2026-01-10T00:00:00+01:00",
                                        "due_date": "2026-01-24T00:00:00+01:00",
                                        "sent_date": "2026-01-10",
                                        "paid_date": "2026-01-20",
                                        "total": 1190,
                                        "currency_code": "EUR",
                                        "payment_method": "bank_transfer",
                                        "total_paid": 1190,
                                        "remaining_amount": 0,
                                        "allowed_transitions": [
                                            "cancelled"
                                        ],
                                        "items": [
                                            {
                                                "uuid": "3f2b1c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                                                "name": "Beratung",
                                                "quantity": 10,
                                                "unit_price": 100,
                                                "tax_rate": 19,
                                                "total": 1190
                                            }
                                        ],
                                        "transactions": [
                                            {
                                                "uuid": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
                                                "type": "payment",
                                                "amount": 952,
                                                "currency_code": "EUR",
                                                "transaction_date": "2026-01-16T00:00:00+01:00"
                                            },
                                            {
                                                "uuid": "1d4e5f6a-7b8c-4d9e-a0b1-c2d3e4f5a6b7",
                                                "type": "credit",
                                                "amount": 238,
                                                "currency_code": "EUR",
                                                "transaction_date": "2026-01-20T00:00:00+01:00"
                                            }
                                        ],
                                        "credit_notes": [
                                            {
                                                "uuid": "9b2e4f6a-1c3d-4e5f-8a7b-6c5d4e3f2a1b",
                                                "credit_note_number": "GS-2026-0003",
                                                "status": "settled",
                                                "credit_note_date": "2026-01-20",
                                                "total": 238,
                                                "currency_code": "EUR"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "invoices-update",
                "summary": "Rechnung aktualisieren",
                "description": "Rechnung aktualisieren. Nur möglich bei Status draft oder sent und Quelle manual (sonst 422). Ein Entwurf akzeptiert dieselben Kopffelder wie beim Erstellen. Eine ausgestellte Rechnung ist inhaltlich festgeschrieben (GoBD): änderbar sind nur noch internal_notes, payment_method und stripe_pm_id, wie in der Weboberfläche. Enthält die Anfrage ein anderes Feld (z. B. client_uuid, recipient_*, invoice_date, due_date, service_date_*, currency_code, document_language, notes, greeting_text, closing_text, payment_reference), antwortet der Endpoint mit 422 und error_code invoice_locked, nennt die Felder in locked_fields, die erlaubten in allowed_fields und die Korrekturwege in correction und schreibt nichts, auch die erlaubten Felder derselben Anfrage nicht. Das gilt auch für einen Entwurf, solange eine Zahlung läuft oder ein Zahlungslink offen ist. Inhaltliche Korrekturen laufen über POST /invoices/{uuid}/correct (Rechnung berichtigen), eine Rechnungskorrektur (POST /credit-notes) oder ein Storno. Breaking Change: client_id und contact_id werden nicht mehr akzeptiert; ausschließlich client_uuid und contact_uuid.",
                "tags": [
                    "invoices"
                ],
                "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": false,
                                    "error_code": "invoice_locked",
                                    "message": "Die Rechnung ist ausgestellt und inhaltlich festgeschrieben. …",
                                    "locked_fields": [
                                        "recipient_name"
                                    ],
                                    "allowed_fields": [
                                        "internal_notes",
                                        "payment_method",
                                        "stripe_pm_id"
                                    ],
                                    "correction": [
                                        {
                                            "action": "correct",
                                            "method": "POST",
                                            "path": "/api/flowaccounting/invoices/{uuid}/correct"
                                        },
                                        {
                                            "action": "credit_note",
                                            "method": "POST",
                                            "path": "/api/flowaccounting/credit-notes",
                                            "body": {
                                                "invoice_uuid": "{uuid}"
                                            }
                                        },
                                        {
                                            "action": "cancel",
                                            "method": "POST",
                                            "path": "/api/flowaccounting/invoices/{uuid}/status",
                                            "body": {
                                                "status": "cancelled"
                                            }
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient_name": {
                                        "type": "string",
                                        "description": "Name des Rechnungsempfängers. Nur im Entwurf änderbar"
                                    },
                                    "due_date": {
                                        "type": "string",
                                        "description": "Fälligkeitsdatum. Nur im Entwurf änderbar"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Sichtbare Notiz auf der Rechnung. Nur im Entwurf änderbar"
                                    },
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung bei tax_exempt, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen). Nur im Entwurf änderbar"
                                    },
                                    "property_retention_notice": {
                                        "type": "boolean",
                                        "description": "Hinweis auf die Aufbewahrungspflicht bei Grundstücksleistungen an Privatpersonen (§ 14b Abs. 1 Satz 5 UStG). Nur im Entwurf änderbar"
                                    },
                                    "document_language": {
                                        "type": "string",
                                        "description": "Belegsprache der Rechnung: de | en | pt. Nur im Entwurf änderbar"
                                    },
                                    "internal_notes": {
                                        "type": "string",
                                        "description": "Interne Notiz, erscheint nicht auf der Rechnung. Auch nach dem Ausstellen änderbar"
                                    },
                                    "payment_method": {
                                        "type": "string",
                                        "description": "Zahlart (bank_transfer | stripe | sepa | paypal | cash | other). Auch nach dem Ausstellen änderbar"
                                    },
                                    "stripe_pm_id": {
                                        "type": "string",
                                        "description": "Gespeicherte Stripe-Zahlungsmethode des Kunden (pm_…), passend zur Zahlart. Auch nach dem Ausstellen änderbar"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "invoices-delete",
                "summary": "Rechnung löschen",
                "description": "Rechnung löschen. Nur möglich im Status draft (sonst 422). Ein Entwurf ohne Nummer wird gelöscht und verbraucht keine Nummer. Trägt der Entwurf schon eine Nummer (vor dem 2026-11-22 gespeichert, mit vorgegebener invoice_number übernommen oder ein Korrekturentwurf), wird er verworfen: Die Nummer bleibt belegt und wird nicht erneut vergeben, die Antwort nennt sie in retained_invoice_number.",
                "tags": [
                    "invoices"
                ],
                "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": "Entwurf verworfen. Die Rechnungsnummer RE-2026-0041 bleibt belegt und wird nicht erneut vergeben.",
                                    "retained_invoice_number": "RE-2026-0041"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/status": {
            "post": {
                "operationId": "invoices-status",
                "summary": "Rechnungsstatus setzen",
                "description": "Direkter Statuswechsel. Über diesen Endpoint sind nur die Übergänge nach sent (versenden) und cancelled (stornieren) möglich. Bei unzulässigem Übergang: 422 mit Feld allowed_transitions. Beim Wechsel nach sent erhält eine Rechnung ohne Nummer ihre Rechnungsnummer aus dem Nummernkreis, und der heutige Tag gilt als Versanddatum; eine E-Mail wird dabei nicht verschickt. Beim Wechsel einer ausgestellten Rechnung nach cancelled entsteht eine eigene Stornorechnung (kind cancellation) mit neuer Nummer und negativen Positionen; die Rechnung selbst behält Nummer und Inhalt und verweist über cancelled_by_invoice darauf. Ein Entwurf wird ohne Stornorechnung storniert. Eine Stornorechnung selbst lässt sich nicht stornieren, korrigieren oder duplizieren. Für Altrechnungen aus einem Fremdsystem kann das tatsächliche Versanddatum über sent_date mitgegeben werden. Eine Rechnung mit einem Versanddatum vor dem Tag ihrer Erfassung gilt als übernommener Altbeleg: Sie wird nicht automatisch gemahnt und nicht automatisch abgebucht. Von Hand geht beides weiter. § 19-Hinweis: Ist das Team laut bestätigtem Steuerprofil Kleinunternehmer in Deutschland und würde der noch offene Betrag der Rechnung, sobald bezahlt, die Umsatzgrenze des laufenden Jahres überschreiten (oder ist sie schon überschritten), enthält die Antwort zusätzlich das Feld notices: eine Liste mit code small_business_limit, level would_exceed oder already_exceeded, context invoice, year, den Beträgen in Euro (limit_eur, known_turnover_eur, amount_eur, turnover_after_eur), complete (false, wenn Zahlungen ungeklärt sind), blocking (immer false) und message. Der Hinweis blockiert nie und ändert das Steuerprofil nicht; ohne Hinweis fehlt das Feld.",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Zielstatus: sent oder cancelled"
                                    },
                                    "sent_date": {
                                        "type": "string",
                                        "description": "Optional: tatsächliches Versanddatum (YYYY-MM-DD), nur für die Übernahme von Altrechnungen aus einem Fremdsystem gedacht. Im Normalfall weglassen, dann gilt der heutige Tag. Nur zusammen mit status sent, nur beim Wechsel aus dem Entwurf und nur für manuelle Rechnungen (source manual), sonst 422. Frühestens das Rechnungsdatum, spätestens heute. Liegt das Datum vor dem Tag, an dem die Rechnung hier erfasst wurde, gilt sie als übernommener Altbeleg und wird nicht automatisch gemahnt oder abgebucht"
                                    }
                                },
                                "required": [
                                    "status"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/send": {
            "post": {
                "operationId": "invoices-send",
                "summary": "Rechnung per E-Mail versenden",
                "description": "Versendet die Rechnung per E-Mail an den hinterlegten Empfänger. Eine stornierte Rechnung wird nicht erneut versendet (422, error_code: not_sendable); ihre Stornorechnung (kind cancellation, UUID aus cancelled_by_invoice) lässt sich über diesen Endpoint versenden und bleibt dabei im Status cancelled. Beim Erstversand wechselt eine Rechnung im Status draft automatisch nach sent und erhält dabei ihre Rechnungsnummer; kollidiert der Nummernkreis, antwortet der Endpoint mit 409 und error_code: document_number_conflict, und die Rechnung bleibt ein Entwurf ohne Nummer. Eine bereits versendete Rechnung kann erneut verschickt werden, der Status bleibt dabei unverändert. Der Endpoint ist auf 10 Anfragen pro Minute je API-Key begrenzt, darüber hinausgehende Anfragen werden mit 429 beantwortet. Nicht versandfähig sind stornierte Rechnungen, Rechnungen ohne hinterlegte Empfänger-E-Mail sowie E-Rechnungsformate mit offenen Validierungsfehlern. Versendbar sind außerdem nur Rechnungen aus den Quellen manual, hosting_checkout und hosting_renewal, weil automatisch abgerechnete Quellen ihre Rechnungsmail bereits selbst verschicken. In all diesen Fällen antwortet die API mit 422 und dem Feld error_code, das die Werte not_sendable, no_recipient_email oder einvoice_invalid annehmen kann. Eine unbekannte UUID ergibt 404. § 19-Hinweis: Ist das Team laut bestätigtem Steuerprofil Kleinunternehmer in Deutschland und würde der noch offene Betrag der Rechnung, sobald bezahlt, die Umsatzgrenze des laufenden Jahres überschreiten (oder ist sie schon überschritten), enthält die Antwort zusätzlich das Feld notices: eine Liste mit code small_business_limit, level would_exceed oder already_exceeded, context invoice, year, den Beträgen in Euro (limit_eur, known_turnover_eur, amount_eur, turnover_after_eur), complete (false, wenn Zahlungen ungeklärt sind), blocking (immer false) und message. Der Hinweis blockiert nie und ändert das Steuerprofil nicht; ohne Hinweis fehlt das Feld.",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/pdf": {
            "get": {
                "operationId": "invoices-pdf",
                "summary": "Rechnung als PDF herunterladen",
                "description": "Lädt die Rechnung als Standard-PDF herunter (Team-Einstellung einvoice_format=pdf). Antwort ist ein Datei-Download, kein JSON. Ausgestellte Rechnungen liefern die beim Ausstellen gespeicherte Datei Byte für Byte (Header X-FlowAccounting-Document-Source: frozen und X-FlowAccounting-Document-SHA256); Entwürfe und Rechnungen, die vor dem Einfrieren ausgestellt wurden, werden mit den aktuellen Daten erzeugt (regenerated).",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/duplicate": {
            "post": {
                "operationId": "invoices-duplicate",
                "summary": "Rechnung duplizieren",
                "description": "Dupliziert die Rechnung inklusive Positionen als neuen draft ohne Rechnungsnummer; die Nummer wird beim Ausstellen vergeben. Antwort: 201 mit der neuen Rechnung.",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/correct": {
            "post": {
                "operationId": "invoices-correct",
                "summary": "Rechnung berichtigen",
                "description": "Storniert die versendete Rechnung mit einer eigenen Stornorechnung und erstellt eine inhaltsgleiche berichtigte Rechnung als Entwurf. Die Korrektur trägt die Nummer des Originals mit angehängter Korrekturziffer, das Original behält seine Nummer, wird auf cancelled gesetzt und auf Stornorechnung und Korrektur verwiesen. Möglich bei sent, overdue, past_due und partially_paid und ausschließlich bei manuell geführten Rechnungen; sonst 422. Antwort: 201 mit der berichtigten Rechnung.",
                "tags": [
                    "invoices"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "invoice_number": "RE-2026-0042-1",
                                        "status": "draft"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/dunning": {
            "post": {
                "operationId": "invoices-dunning",
                "summary": "Mahnung versenden",
                "description": "Beauftragt eine Zahlungserinnerung oder Mahnung. level muss genau die nächste fällige Stufe sein: eine übersprungene oder wiederholte Stufe wird mit 422 und dunning_level_not_due abgelehnt. Welche Stufe fällig ist, richtet sich nach den Mahnfristen der Teameinstellungen und den bereits versendeten Stufen, also nach denselben Regeln wie der automatische Mahnlauf. Ohne recipient_emails gelten die Empfänger des Kunden.",
                "tags": [
                    "invoices"
                ],
                "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,
                                    "level": "reminder",
                                    "data": {
                                        "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "overdue"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "level": {
                                        "type": "string",
                                        "description": "Mahnstufe: reminder, dunning_1, dunning_2 oder dunning_3"
                                    },
                                    "recipient_emails": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Abweichende Empfängeradressen, höchstens 50"
                                    }
                                },
                                "required": [
                                    "level"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/mark-paid": {
            "post": {
                "operationId": "invoices-mark-paid",
                "summary": "Rechnung als bezahlt markieren",
                "description": "Markiert die Rechnung über eine Stripe-PaymentIntent-ID als vollständig bezahlt. Idempotent: Eine erneute Anfrage mit derselben PaymentIntent-ID gibt den aktuellen Stand zurück (200). Zulässige Ausgangsstatus: sent, requires_action, past_due.",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "stripe_payment_intent_id": {
                                        "type": "string",
                                        "description": "Stripe-PaymentIntent-ID (pi_3Q...)"
                                    },
                                    "date_paid": {
                                        "type": "string",
                                        "description": "Zahlungsdatum (YYYY-MM-DD), spätestens heute (Kalendertag in Deutschland)"
                                    }
                                },
                                "required": [
                                    "stripe_payment_intent_id"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/record-payment-intent": {
            "post": {
                "operationId": "invoices-record-payment-intent",
                "summary": "PaymentIntent speichern",
                "description": "Speichert eine Stripe-PaymentIntent-ID an der Rechnung, ohne den Zahlstatus auf paid zu setzen. Für 3DS-ausstehende oder überfällige Zahlungen.",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "stripe_payment_intent_id": {
                                        "type": "string",
                                        "description": "Stripe-PaymentIntent-ID"
                                    },
                                    "status": {
                                        "type": "string",
                                        "description": "Optional: past_due | requires_action"
                                    }
                                },
                                "required": [
                                    "stripe_payment_intent_id"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/charge": {
            "post": {
                "operationId": "invoices-charge",
                "summary": "Rechnung per Stripe abbuchen",
                "description": "Löst die Abbuchung der Rechnung über die hinterlegte Stripe-Zahlungsart aus (Karte oder SEPA-Lastschrift). Voraussetzung: Die Rechnung hat einen Kunden und eine Stripe-gestützte Zahlungsart, sonst antwortet der Endpoint mit 422 und einem error_code (no_client, wrong_payment_method). Ein Entwurf wird vor der Abbuchung ausgestellt (Rechnungsnummer, Status sent, ohne E-Mail), denn eine Zahlung läuft nie gegen eine Rechnung ohne Nummer; kollidiert dabei der Nummernkreis, antwortet der Endpoint mit 409 und error_code: document_number_conflict, und der Entwurf bleibt unverändert. Eine abgelehnte Zahlung ist kein Anfragefehler: Die Antwort ist 200 mit charged: false. Ein wiederholter Aufruf bucht nicht doppelt ab. Ist Stripe vorübergehend nicht erreichbar, antwortet der Endpoint mit 503. Der Aufruf ist pro API-Key begrenzt.",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/payment-status": {
            "get": {
                "operationId": "invoices-payment-status",
                "summary": "Zahlstatus abfragen",
                "description": "Schlanke Statusabfrage für das Polling nach einer Abbuchung, ohne Positionen und Transaktionen. Liefert uuid, status, payment_intent_status, last_charge_error und stripe_charge_id. SEPA-Lastschriften werden erst nach Tagen endgültig bestätigt, der Status ändert sich dann ohne weiteren Aufruf.",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/issue-check": {
            "get": {
                "operationId": "invoices-issue-check",
                "summary": "Prüfliste vor dem Ausstellen",
                "description": "Prüft eine Rechnung vor dem Ausstellen auf Pflichtangaben nach § 14 und § 14a UStG (Anschrift von Aussteller und Kunde, Steuernummer oder USt-IdNr., Positionen, Leistungsdatum, Reverse Charge, § 19 UStG, Fristen) und liefert die Befunde. Nur lesend. findings ist eine Liste mit code (z. B. seller.address, buyer.vat_id, tax.small_business_limit), severity (error, warning oder info), message in der Sprache des Key-Inhabers, legal_basis und target (wo der Befund behoben wird: invoice, recipient, company, tax_profile). blocks_manual_issue sagt, ob die Weboberfläche das Ausstellen wegen Fehlern verweigert, requires_confirmation, ob dort Hinweise zu bestätigen sind. Das Ausstellen über die API (POST /invoices/{uuid}/status, POST /invoices/{uuid}/send) wird nie blockiert (blocks_api_issue ist immer false); die Befunde werden beim Ausstellen mit der Rechnung gespeichert und stehen danach in issued_snapshot. Ohne bestätigtes Steuerprofil sind die Befunde, die vom Umsatzsteuerstatus abhängen (z. B. Steuernummer, Leistungsdatum, Reverse Charge, Fristen), nur info. Die Pflichtangaben jeder Rechnung bleiben auch dann Fehler und sperren das Ausstellen in der Weboberfläche: Anschrift des Ausstellers, Name und Anschrift des Kunden, Rechnungsdatum und Positionen mit Menge; ebenso die Prüfung der E-Rechnung. Die § 19-Warnung (tax.small_business_limit) bleibt eine Warnung; tax_profile nennt den verwendeten Stand (confirmed, vat_regime, governs). Teams, die laut Steuerprofil in Deutschland nicht umsatzsteuerlich registriert sind, erhalten keine deutschen USt-Befunde. Eine unbekannte UUID ergibt 404.",
                "tags": [
                    "invoices"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "draft",
                                        "is_draft": true,
                                        "blocks_api_issue": false,
                                        "checked_at": "2026-11-23T10:00:00+01:00",
                                        "blocks_manual_issue": true,
                                        "requires_confirmation": true,
                                        "summary": {
                                            "errors": 1,
                                            "warnings": 1,
                                            "infos": 0
                                        },
                                        "tax_profile": {
                                            "version_uuid": "0f6d…",
                                            "confirmed": true,
                                            "vat_regime": "standard",
                                            "governs": true
                                        },
                                        "findings": [
                                            {
                                                "code": "seller.tax_id",
                                                "severity": "error",
                                                "message": "Deine Steuernummer oder USt-IdNr. fehlt. Eine davon muss auf jeder Rechnung stehen.",
                                                "legal_basis": "§ 14 Abs. 4 Nr. 2 UStG",
                                                "target": "company"
                                            },
                                            {
                                                "code": "service_date.missing",
                                                "severity": "warning",
                                                "message": "Es ist kein Leistungsdatum angegeben. Trage den Leistungszeitraum ein, oder bestätige, dass die Leistung am Rechnungsdatum erbracht wurde.",
                                                "legal_basis": "§ 14 Abs. 4 Nr. 6 UStG",
                                                "target": "invoice"
                                            }
                                        ],
                                        "issued_snapshot": null
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/einvoice": {
            "get": {
                "operationId": "invoices-einvoice",
                "summary": "Archivierte E-Rechnung herunterladen",
                "description": "Liefert die beim Ausstellen archivierte E-Rechnung der Rechnung Byte für Byte: bei XRechnung die XML-Datei (application/xml), bei ZUGFeRD das PDF/A-3 mit eingebetteter XML (application/pdf). Antwort ist ein Datei-Download, kein JSON; es wird nie neu erzeugt. Header: X-FlowAccounting-Einvoice-SHA256 (SHA-256 der gelieferten Datei), X-FlowAccounting-Einvoice-XML-SHA256 (SHA-256 der Rechnungs-XML, bei ZUGFeRD der eingebetteten), X-FlowAccounting-Einvoice-Uuid (Archiveintrag). Ohne archivierte E-Rechnung (Entwurf, klassisches PDF, vor der Archivierung ausgestellt) antwortet der Endpoint mit 404 und error: einvoice_not_archived; besteht die Datei die Hash-Prüfung nicht, mit 409 und error: einvoice_integrity_failed. Eine unbekannte UUID oder eine Rechnung eines anderen Teams ergibt 404.",
                "tags": [
                    "invoices"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "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"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/einvoice/validation": {
            "get": {
                "operationId": "invoices-einvoice-validation",
                "summary": "Prüfbericht der archivierten E-Rechnung",
                "description": "Liefert den letzten Prüfbericht der archivierten E-Rechnung der Rechnung. Nur lesend. Die Prüfung lief beim Archivieren auf genau den ausgestellten Bytes (Wohlgeformtheit, XSD, Geschäftsregeln nach EN 16931 und XRechnung, Pflichtangaben nach § 14 Abs. 4 UStG). validation_status ist valid, valid_with_warnings, business_rule_errors, mandatory_field_errors oder format_error. report.messages ist eine Liste mit code (z. B. BR-DE-2, FAC-PFLICHT-6), severity (error oder warning), category (format, business_rule, mandatory_vat) und message. Ohne archivierte E-Rechnung 404 mit error: einvoice_not_archived; eine unbekannte UUID oder eine Rechnung eines anderen Teams ergibt 404.",
                "tags": [
                    "invoices"
                ],
                "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": "8d1f2c4e-6a0b-4c1d-9e2f-3a4b5c6d7e8f",
                                        "document_uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "format": "xrechnung",
                                        "profile": "xrechnung_3",
                                        "specification_id": "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0",
                                        "type_code": "380",
                                        "invoice_number": "RE-00042",
                                        "xml_sha256": "3f5a…",
                                        "file_sha256": "3f5a…",
                                        "archived_at": "2026-11-24T10:00:00+01:00",
                                        "validation_status": "valid_with_warnings",
                                        "report": {
                                            "uuid": "0c9e…",
                                            "engine": "internal",
                                            "engine_version": "internal-1.0",
                                            "status": "valid_with_warnings",
                                            "errors_count": 0,
                                            "warnings_count": 1,
                                            "messages": [
                                                {
                                                    "code": "FAC-FX-2",
                                                    "severity": "warning",
                                                    "category": "mandatory_vat",
                                                    "message": "Die Umsatzsteuer in Euro (BT-111) beruht auf einem vorläufigen Kurs, der BMF-Monatskurs ist noch nicht veröffentlicht."
                                                }
                                            ],
                                            "created_at": "2026-11-24T10:00:00+01:00"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/items": {
            "get": {
                "operationId": "items-list",
                "summary": "Positionen auflisten",
                "description": "Alle Positionen einer Rechnung auflisten.",
                "tags": [
                    "items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "items-create",
                "summary": "Position hinzufügen",
                "description": "Fügt der Rechnung eine Position hinzu. Breaking Change: Das frühere numerische Feld product_id wird nicht mehr akzeptiert; das Produkt wird ausschließlich über product_uuid angegeben.",
                "tags": [
                    "items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "quantity": {
                                        "type": "number",
                                        "description": "Menge (min 0.01)"
                                    },
                                    "unit_price": {
                                        "type": "number",
                                        "description": "Einzelpreis (negativ erlaubt für Rechnungskorrekturen)"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Positionsbezeichnung (max 255)"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Beschreibung (max 1000)"
                                    },
                                    "tax_rate": {
                                        "type": "number",
                                        "description": "Steuersatz in Prozent (0-100). Ohne Angabe 0 %"
                                    },
                                    "unit": {
                                        "type": "string",
                                        "description": "Einheit (z.B. Std.)"
                                    },
                                    "product_uuid": {
                                        "type": "string",
                                        "description": "Produkt-UUID (fac_products, teamgebunden)"
                                    }
                                },
                                "required": [
                                    "quantity",
                                    "unit_price"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/items/{itemUuid}": {
            "put": {
                "operationId": "items-update",
                "summary": "Position bearbeiten",
                "description": "Position bearbeiten. Die Position wird über ihre UUID adressiert; numerische IDs werden nicht mehr akzeptiert (HTTP 404). Nur bei draft.",
                "tags": [
                    "items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "itemUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "quantity": {
                                        "type": "number",
                                        "description": "Menge"
                                    },
                                    "unit_price": {
                                        "type": "number",
                                        "description": "Einzelpreis"
                                    },
                                    "name": {
                                        "type": "string",
                                        "description": "Positionsbezeichnung"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "items-delete",
                "summary": "Position löschen",
                "description": "Position löschen. Die Position wird über ihre UUID adressiert. Nur bei draft.",
                "tags": [
                    "items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "itemUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/transactions": {
            "get": {
                "operationId": "transactions-list",
                "summary": "Transaktionen einer Rechnung auflisten",
                "description": "Alle Transaktionen einer Rechnung auflisten (sortiert nach Datum, absteigend).",
                "tags": [
                    "transactions"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "transactions-create",
                "summary": "Transaktion erfassen",
                "description": "Erfasst eine Transaktion. Nur zulässig, wenn die Rechnung im Status sent, partially_paid oder overdue ist. Die Transaktion wird in der Währung der Rechnung gebucht. Gleicht sie die Rechnung aus, übernimmt die Rechnung das transaction_date dieser Zahlung als paid_date, auch bei nachträglich erfassten Zahlungen. § 19-Hinweis: Nur Zahlungen vom Typ payment lösen ihn aus. Ist das Team laut bestätigtem Steuerprofil Kleinunternehmer in Deutschland und würde diese Zahlung die Umsatzgrenze ihres Kalenderjahres überschreiten (oder ist sie schon überschritten), enthält die Antwort zusätzlich das Feld notices: eine Liste mit code small_business_limit, level would_exceed oder already_exceeded, context payment, year, den Beträgen in Euro (limit_eur, known_turnover_eur, amount_eur, turnover_after_eur), complete (false, wenn Zahlungen ungeklärt sind), blocking (immer false) und message. Der Hinweis blockiert nie und ändert das Steuerprofil nicht; ohne Hinweis fehlt das Feld.",
                "tags": [
                    "transactions"
                ],
                "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": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
                                        "amount": 1190,
                                        "currency_code": "EUR",
                                        "type": "payment",
                                        "transaction_date": "2026-01-16T00:00:00+00:00"
                                    },
                                    "invoice": {
                                        "uuid": "550e8400-...",
                                        "status": "paid",
                                        "paid_date": "2026-01-16",
                                        "total_paid": 1190,
                                        "remaining_amount": 0
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "type": {
                                        "type": "string",
                                        "description": "Transaktionstyp: payment | refund | credit"
                                    },
                                    "amount": {
                                        "type": "number",
                                        "description": "Betrag (min 0.01)"
                                    },
                                    "transaction_date": {
                                        "type": "string",
                                        "description": "Transaktionsdatum (YYYY-MM-DD), spätestens heute (Kalendertag in Deutschland)"
                                    },
                                    "payment_method": {
                                        "type": "string",
                                        "description": "Zahlungsmethode: bank_transfer | sepa | stripe | paypal | cash | other"
                                    },
                                    "reference": {
                                        "type": "string",
                                        "description": "Referenz (max 255)"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Notiz (max 1000)"
                                    }
                                },
                                "required": [
                                    "type",
                                    "amount",
                                    "transaction_date",
                                    "payment_method"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/invoices/{uuid}/transactions/{transactionUuid}": {
            "delete": {
                "operationId": "transactions-delete",
                "summary": "Transaktion löschen",
                "description": "Transaktion löschen. Die Transaktion wird über ihre UUID adressiert; numerische IDs werden nicht mehr akzeptiert (HTTP 404). Nicht möglich bei Rechnungen im Status draft oder cancelled.",
                "tags": [
                    "transactions"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "transactionUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/transactions": {
            "get": {
                "operationId": "transactions-all",
                "summary": "Team-weite Transaktionsübersicht",
                "description": "Team-weite Transaktions-Übersicht über alle Rechnungen (paginiert, 25 pro Seite).",
                "tags": [
                    "transactions"
                ],
                "parameters": [
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Transaktionsdatum ab (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Transaktionsdatum bis (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Suchbegriff (Notiz, Referenz, Rechnungsnummer)",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/products": {
            "get": {
                "operationId": "products-list",
                "summary": "Produkte auflisten",
                "description": "Produkte auflisten (paginiert, sortiert nach Nutzungshäufigkeit).",
                "tags": [
                    "products"
                ],
                "parameters": [
                    {
                        "name": "type",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Quelle (z.B. manual)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Suchbegriff (Titel/Beschreibung)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 50)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "products-create",
                "summary": "Produkt anlegen",
                "description": "Neues Produkt anlegen.",
                "tags": [
                    "products"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "Produktname (max 255)"
                                    },
                                    "unit_price": {
                                        "type": "number",
                                        "description": "Netto-Einzelpreis (min 0). Pflicht, wenn <code>unit_price_gross</code> fehlt; nicht zusammen mit <code>unit_price_gross</code>"
                                    },
                                    "unit_price_gross": {
                                        "type": "number",
                                        "description": "Brutto-Einzelpreis inkl. MwSt. (min 0), alternativ zu <code>unit_price</code>. Wird exakt gespeichert, der Nettopreis wird daraus abgeleitet"
                                    },
                                    "tax_rate": {
                                        "type": "number",
                                        "description": "Steuersatz (0-100)"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Beschreibung"
                                    },
                                    "unit": {
                                        "type": "string",
                                        "description": "Einheit (max 50)"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv (Standard: true)"
                                    }
                                },
                                "required": [
                                    "title",
                                    "unit_price",
                                    "tax_rate"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/products/{uuid}": {
            "get": {
                "operationId": "products-show",
                "summary": "Produkt abrufen",
                "description": "Ruft ein einzelnes Produkt Ihres Teams über die uuid ab. Unbekannte oder teamfremde Einträge führen zu 404.",
                "tags": [
                    "products"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "products-update",
                "summary": "Produkt aktualisieren",
                "description": "Produkt aktualisieren.",
                "tags": [
                    "products"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "title": {
                                        "type": "string",
                                        "description": "Produktname"
                                    },
                                    "unit_price": {
                                        "type": "number",
                                        "description": "Netto-Einzelpreis, macht das Produkt zu einem Netto-Produkt"
                                    },
                                    "unit_price_gross": {
                                        "type": "number",
                                        "description": "Brutto-Einzelpreis inkl. MwSt., wird exakt gespeichert; nicht zusammen mit <code>unit_price</code>"
                                    },
                                    "tax_rate": {
                                        "type": "number",
                                        "description": "Steuersatz"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "products-delete",
                "summary": "Produkt löschen",
                "description": "Produkt löschen.",
                "tags": [
                    "products"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/tax-rates": {
            "get": {
                "operationId": "tax-rates-list",
                "summary": "Steuersätze auflisten",
                "description": "Alle Steuersätze des Teams abrufen (unpaginiert, sortiert nach sort_order).",
                "tags": [
                    "tax-rates"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "tax-rates-create",
                "summary": "Steuersatz anlegen",
                "description": "Neuen Steuersatz anlegen.",
                "tags": [
                    "tax-rates"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Bezeichnung (max 255)"
                                    },
                                    "rate": {
                                        "type": "number",
                                        "description": "Steuersatz in Prozent (0-100)"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Beschreibung"
                                    },
                                    "is_default": {
                                        "type": "boolean",
                                        "description": "Als Standard setzen"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv"
                                    },
                                    "sort_order": {
                                        "type": "integer",
                                        "description": "Sortierreihenfolge (>= 0)"
                                    }
                                },
                                "required": [
                                    "name",
                                    "rate"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/tax-rates/{uuid}": {
            "get": {
                "operationId": "tax-rates-show",
                "summary": "Steuersatz abrufen",
                "description": "Ruft einen einzelnen Steuersatz Ihres Teams über die uuid ab. Unbekannte oder teamfremde Einträge führen zu 404.",
                "tags": [
                    "tax-rates"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "tax-rates-update",
                "summary": "Steuersatz aktualisieren",
                "description": "Steuersatz aktualisieren.",
                "tags": [
                    "tax-rates"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Bezeichnung"
                                    },
                                    "rate": {
                                        "type": "number",
                                        "description": "Steuersatz"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "tax-rates-delete",
                "summary": "Steuersatz löschen",
                "description": "Steuersatz löschen. Nicht möglich, wenn er in Rechnungspositionen verwendet wird (422).",
                "tags": [
                    "tax-rates"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/tax-rates/{uuid}/default": {
            "post": {
                "operationId": "tax-rates-default",
                "summary": "Als Standard setzen",
                "description": "Setzt diesen Steuersatz als Team-Standard (alle anderen verlieren das Standard-Flag).",
                "tags": [
                    "tax-rates"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/recurring-invoices": {
            "get": {
                "operationId": "recurring-list",
                "summary": "Auflisten",
                "description": "Auflisten (paginiert, 25 pro Seite).",
                "tags": [
                    "recurring"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Filter: active, paused",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Kunden-UUID. Breaking Change: der frühere Filter client_id wird mit 422 abgelehnt, statt stillschweigend ignoriert zu werden",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "recurring-create",
                "summary": "Neue wiederkehrende Rechnung anlegen",
                "description": "Neue wiederkehrende Rechnung anlegen. Breaking Change: Das frühere numerische Feld client_id wird nicht mehr akzeptiert; der Kunde wird ausschließlich über client_uuid angegeben.",
                "tags": [
                    "recurring"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung, wenn der Kunde die Steuerbehandlung tax_exempt hat, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen). Wird in die erzeugten Rechnungen übernommen und im Hinweis gedruckt"
                                    },
                                    "client_uuid": {
                                        "type": "string",
                                        "description": "Kunden-UUID (cmm_clients, teamgebunden)"
                                    },
                                    "interval_value": {
                                        "type": "integer",
                                        "description": "Intervallwert (>= 1)"
                                    },
                                    "interval_unit": {
                                        "type": "string",
                                        "description": "Intervalleinheit: day | week | month | year"
                                    },
                                    "start_date": {
                                        "type": "string",
                                        "description": "Startdatum (YYYY-MM-DD)"
                                    },
                                    "template_items": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Positionen der Vorlage (min 1)"
                                    },
                                    "auto_send": {
                                        "type": "boolean",
                                        "description": "Automatisch versenden"
                                    },
                                    "end_date": {
                                        "type": "string",
                                        "description": "Enddatum (>= start_date)"
                                    },
                                    "status": {
                                        "type": "string",
                                        "description": "Status: active | paused"
                                    }
                                },
                                "required": [
                                    "client_uuid",
                                    "interval_value",
                                    "interval_unit",
                                    "start_date",
                                    "template_items"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/recurring-invoices/{uuid}": {
            "get": {
                "operationId": "recurring-show",
                "summary": "Wiederkehrende Rechnung abrufen",
                "description": "Ruft eine einzelne wiederkehrende Rechnung Ihres Teams über die uuid ab. Unbekannte oder teamfremde Einträge führen zu 404.",
                "tags": [
                    "recurring"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "recurring-update",
                "summary": "Aktualisieren",
                "description": "Wiederkehrende Rechnung aktualisieren.",
                "tags": [
                    "recurring"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung, wenn der Kunde die Steuerbehandlung tax_exempt hat, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen). Wird in die erzeugten Rechnungen übernommen und im Hinweis gedruckt"
                                    },
                                    "interval_value": {
                                        "type": "integer",
                                        "description": "Intervallwert"
                                    },
                                    "interval_unit": {
                                        "type": "string",
                                        "description": "Intervalleinheit"
                                    },
                                    "auto_send": {
                                        "type": "boolean",
                                        "description": "Automatisch versenden"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "recurring-delete",
                "summary": "Löschen",
                "description": "Wiederkehrende Rechnung löschen.",
                "tags": [
                    "recurring"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/recurring-invoices/{uuid}/pause": {
            "post": {
                "operationId": "recurring-pause",
                "summary": "Pausieren",
                "description": "Pausiert die Vorlage (Status paused) - es werden keine neuen Rechnungen erzeugt.",
                "tags": [
                    "recurring"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/recurring-invoices/{uuid}/activate": {
            "post": {
                "operationId": "recurring-activate",
                "summary": "Aktivieren",
                "description": "Aktiviert die Vorlage wieder (Status active) und legt dabei fest, was der automatische Lauf tun darf. auto_send, auto_charge und recipient_emails sind die eigentliche Freigabe: ohne sie entstehen nur Entwürfe. auto_send ist standardmäßig aktiv, auto_charge standardmäßig aus und setzt eine Stripe- oder SEPA-Zahlungsart auf der Serie voraus (sonst 422). Ohne recipient_emails gelten die Empfänger des Kunden; ist dort keine Adresse hinterlegt und soll versendet werden, antwortet die API mit 422.",
                "tags": [
                    "recurring"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "auto_send": {
                                        "type": "boolean",
                                        "description": "Erzeugte Rechnungen automatisch versenden (Standard: true)"
                                    },
                                    "auto_charge": {
                                        "type": "boolean",
                                        "description": "Erzeugte Rechnungen automatisch einziehen (Standard: false, benötigt Zahlungsart stripe oder sepa)"
                                    },
                                    "recipient_emails": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Empfängeradressen des automatischen Versands, höchstens 50"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/recurring-invoices/{uuid}/generate": {
            "post": {
                "operationId": "recurring-generate",
                "summary": "Nächste Rechnung erzeugen",
                "description": "Erzeugt die fällige Rechnung der Serie sofort, ohne auf den nächtlichen Lauf zu warten. Ist derzeit keine Rechnung fällig oder die Freigabe der Serie nicht mehr gültig, antwortet die API mit 422 und nothing_to_generate.",
                "tags": [
                    "recurring"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "invoice_number": "RE-2026-0042",
                                        "status": "sent"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/installment-plans": {
            "get": {
                "operationId": "installment-plans-list",
                "summary": "Auflisten",
                "description": "Ratenzahlungen des Teams (paginiert, 25 pro Seite) mit Beträgen, umgewandelten Rechnungen und Ratenplan.",
                "tags": [
                    "installment-plans"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Filter: active, paused, completed, cancelled",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Kunden-UUID",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "installment-plans-create",
                "summary": "Rechnungen in Ratenzahlung umwandeln",
                "description": "Wandelt offene, versendete Rechnungen (Quelle manual oder quote_accepted) eines Kunden in eine Ratenzahlung um. Unbezahlte Rechnungen werden storniert, teilweise bezahlte per Rechnungskorrektur über den offenen Rest ausgeglichen. Der offene Betrag wird anschließend zu jedem Termin als nummerierte Teilrechnung gestellt. Abgelehnte Umwandlungen antworten mit 422 und error=installment_plan_refused.",
                "tags": [
                    "installment-plans"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "invoice_uuids": {
                                        "type": "array",
                                        "items": [],
                                        "description": "UUIDs der Rechnungen (teamgebunden, gleicher Kunde und gleiche Währung)"
                                    },
                                    "start_date": {
                                        "type": "string",
                                        "description": "Erste Rate am (YYYY-MM-DD)"
                                    },
                                    "schedule_mode": {
                                        "type": "string",
                                        "description": "Aufteilung: amount (fester Ratenbetrag, kleinere Schlussrate) | count (Anzahl gleicher Raten) | end_date (bis Enddatum)"
                                    },
                                    "installment_amount": {
                                        "type": "number",
                                        "description": "Betrag je Rate, Pflicht bei schedule_mode=amount"
                                    },
                                    "installment_count": {
                                        "type": "integer",
                                        "description": "Anzahl Raten (1 bis 240), Pflicht bei schedule_mode=count"
                                    },
                                    "end_date": {
                                        "type": "string",
                                        "description": "Letzte Rate spätestens am (YYYY-MM-DD), Pflicht bei schedule_mode=end_date"
                                    },
                                    "interval_unit": {
                                        "type": "string",
                                        "description": "month (Standard) | week"
                                    },
                                    "interval_value": {
                                        "type": "integer",
                                        "description": "Intervall (1 bis 12), z. B. 3 mit month = quartalsweise"
                                    },
                                    "payment_method": {
                                        "type": "string",
                                        "description": "bank_transfer | stripe | sepa | paypal | cash | other (Standard: Zahlungsart der Rechnung)"
                                    },
                                    "auto_charge": {
                                        "type": "boolean",
                                        "description": "Teilrechnungen am Erstellungstag automatisch einziehen (nur stripe/sepa)"
                                    },
                                    "auto_send": {
                                        "type": "boolean",
                                        "description": "Teilrechnungen nummerieren und automatisch versenden (Standard true; false = Entwurf)"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Hinweis auf jeder Teilrechnung und der Ratenvereinbarung"
                                    }
                                },
                                "required": [
                                    "invoice_uuids",
                                    "start_date",
                                    "schedule_mode"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/installment-plans/{uuid}": {
            "get": {
                "operationId": "installment-plans-show",
                "summary": "Ratenzahlung abrufen",
                "description": "Eine Ratenzahlung mit allen Raten und Teilrechnungen. public_url ist der Link zur öffentlichen Kundenseite (null, solange kein Link erzeugt wurde oder er gesperrt ist). Raten mit kind=extra sind Sonderzahlungen, die der Kunde dort geleistet hat. Unbekannte oder teamfremde Einträge führen zu 404.",
                "tags": [
                    "installment-plans"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/installment-plans/{uuid}/invoices": {
            "post": {
                "operationId": "installment-plans-add-invoice",
                "summary": "Rechnung hinzufügen",
                "description": "Fügt eine weitere offene Rechnung desselben Kunden hinzu. keep_rate verlängert den Plan bei gleicher Rate, new_rate verteilt den gesamten Rest mit den übergebenen Planwerten neu, separate legt eine zweite Ratenzahlung an und gibt diese zurück.",
                "tags": [
                    "installment-plans"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "invoice_uuid": {
                                        "type": "string",
                                        "description": "UUID der Rechnung (teamgebunden)"
                                    },
                                    "add_mode": {
                                        "type": "string",
                                        "description": "keep_rate | new_rate | separate"
                                    },
                                    "start_date": {
                                        "type": "string",
                                        "description": "Erste Rate, Pflicht bei add_mode=separate"
                                    },
                                    "schedule_mode": {
                                        "type": "string",
                                        "description": "Aufteilung: amount (fester Ratenbetrag, kleinere Schlussrate) | count (Anzahl gleicher Raten) | end_date (bis Enddatum)"
                                    },
                                    "installment_amount": {
                                        "type": "number",
                                        "description": "Betrag je Rate, Pflicht bei schedule_mode=amount"
                                    },
                                    "installment_count": {
                                        "type": "integer",
                                        "description": "Anzahl Raten (1 bis 240), Pflicht bei schedule_mode=count"
                                    },
                                    "end_date": {
                                        "type": "string",
                                        "description": "Letzte Rate spätestens am (YYYY-MM-DD), Pflicht bei schedule_mode=end_date"
                                    },
                                    "interval_unit": {
                                        "type": "string",
                                        "description": "month (Standard) | week"
                                    },
                                    "interval_value": {
                                        "type": "integer",
                                        "description": "Intervall (1 bis 12), z. B. 3 mit month = quartalsweise"
                                    },
                                    "payment_method": {
                                        "type": "string",
                                        "description": "bank_transfer | stripe | sepa | paypal | cash | other (Standard: Zahlungsart der Rechnung)"
                                    },
                                    "auto_charge": {
                                        "type": "boolean",
                                        "description": "Teilrechnungen am Erstellungstag automatisch einziehen (nur stripe/sepa)"
                                    },
                                    "auto_send": {
                                        "type": "boolean",
                                        "description": "Teilrechnungen nummerieren und automatisch versenden (Standard true; false = Entwurf)"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Hinweis auf jeder Teilrechnung und der Ratenvereinbarung"
                                    }
                                },
                                "required": [
                                    "invoice_uuid",
                                    "add_mode"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/installment-plans/{uuid}/reschedule": {
            "post": {
                "operationId": "installment-plans-reschedule",
                "summary": "Raten neu berechnen",
                "description": "Verteilt den noch nicht berechneten Rest neu. Bereits gestellte Teilrechnungen bleiben unverändert.",
                "tags": [
                    "installment-plans"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "schedule_mode": {
                                        "type": "string",
                                        "description": "Aufteilung: amount (fester Ratenbetrag, kleinere Schlussrate) | count (Anzahl gleicher Raten) | end_date (bis Enddatum)"
                                    },
                                    "installment_amount": {
                                        "type": "number",
                                        "description": "Betrag je Rate, Pflicht bei schedule_mode=amount"
                                    },
                                    "installment_count": {
                                        "type": "integer",
                                        "description": "Anzahl Raten (1 bis 240), Pflicht bei schedule_mode=count"
                                    },
                                    "end_date": {
                                        "type": "string",
                                        "description": "Letzte Rate spätestens am (YYYY-MM-DD), Pflicht bei schedule_mode=end_date"
                                    },
                                    "interval_unit": {
                                        "type": "string",
                                        "description": "month (Standard) | week"
                                    },
                                    "interval_value": {
                                        "type": "integer",
                                        "description": "Intervall (1 bis 12), z. B. 3 mit month = quartalsweise"
                                    },
                                    "start_date": {
                                        "type": "string",
                                        "description": "Nächste Rate am (Standard: nächster offener Termin)"
                                    }
                                },
                                "required": [
                                    "schedule_mode"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/installment-plans/{uuid}/installments": {
            "put": {
                "operationId": "installment-plans-installments",
                "summary": "Raten einzeln setzen",
                "description": "Ersetzt alle noch offenen Raten. Die Summe muss genau dem noch nicht berechneten Rest entsprechen, sonst 422.",
                "tags": [
                    "installment-plans"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "installments": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Liste aus Objekten mit date (YYYY-MM-DD, ab heute) und amount (ab 0,01)"
                                    }
                                },
                                "required": [
                                    "installments"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/installment-plans/{uuid}/pause": {
            "post": {
                "operationId": "installment-plans-pause",
                "summary": "Pausieren",
                "description": "Pausiert eine aktive Ratenzahlung. Es entstehen keine Teilrechnungen, bis sie fortgesetzt wird.",
                "tags": [
                    "installment-plans"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/installment-plans/{uuid}/resume": {
            "post": {
                "operationId": "installment-plans-resume",
                "summary": "Fortsetzen",
                "description": "Setzt eine pausierte Ratenzahlung fort. Die offenen Raten behalten ihre Beträge und beginnen am neuen Datum.",
                "tags": [
                    "installment-plans"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "next_date": {
                                        "type": "string",
                                        "description": "Nächste Rate am (YYYY-MM-DD, ab heute)"
                                    }
                                },
                                "required": [
                                    "next_date"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/installment-plans/{uuid}/cancel": {
            "post": {
                "operationId": "installment-plans-cancel",
                "summary": "Beenden",
                "description": "Beendet die Ratenzahlung vorzeitig. bill_rest stellt den Rest sofort als letzte Teilrechnung, waive erlässt ihn ohne weitere Rechnung.",
                "tags": [
                    "installment-plans"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "mode": {
                                        "type": "string",
                                        "description": "bill_rest | waive"
                                    }
                                },
                                "required": [
                                    "mode"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/billable-items": {
            "get": {
                "operationId": "billable-items-list",
                "summary": "Auflisten",
                "description": "Auflisten (paginiert, 25 pro Seite).",
                "tags": [
                    "billable-items"
                ],
                "parameters": [
                    {
                        "name": "open",
                        "in": "query",
                        "required": false,
                        "description": "true = nur offene, false = nur abgerechnete",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "client_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Kunden-UUID. Breaking Change: der frühere Filter client_id wird mit 422 abgelehnt, statt stillschweigend ignoriert zu werden",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "billable-items-create",
                "summary": "Neue Position anlegen",
                "description": "Neue abrechenbare Position anlegen. Breaking Change: Das frühere numerische Feld client_id wird nicht mehr akzeptiert; der Kunde wird ausschließlich über client_uuid angegeben.",
                "tags": [
                    "billable-items"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung, wenn der Kunde die Steuerbehandlung tax_exempt hat, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen). Wird in die erzeugten Rechnungen übernommen und im Hinweis gedruckt"
                                    },
                                    "client_uuid": {
                                        "type": "string",
                                        "description": "Kunden-UUID (cmm_clients, teamgebunden)"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Beschreibung (max 255)"
                                    },
                                    "unit_price": {
                                        "type": "number",
                                        "description": "Einzelpreis"
                                    },
                                    "quantity": {
                                        "type": "number",
                                        "description": "Menge (min 0.01)"
                                    },
                                    "unit": {
                                        "type": "string",
                                        "description": "Einheit (max 50)"
                                    },
                                    "tax_rate": {
                                        "type": "number",
                                        "description": "Steuersatz"
                                    },
                                    "due_date": {
                                        "type": "string",
                                        "description": "Fälligkeitsdatum"
                                    },
                                    "auto_bill": {
                                        "type": "boolean",
                                        "description": "Automatisch abrechnen"
                                    }
                                },
                                "required": [
                                    "client_uuid",
                                    "description",
                                    "unit_price"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/billable-items/{uuid}": {
            "get": {
                "operationId": "billable-items-show",
                "summary": "Abrechenbare Position abrufen",
                "description": "Ruft eine einzelne abrechenbare Position Ihres Teams über die uuid ab. Unbekannte oder teamfremde Einträge führen zu 404.",
                "tags": [
                    "billable-items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "billable-items-update",
                "summary": "Position bearbeiten",
                "description": "Bearbeiten. Nur möglich, solange die Position nicht abgerechnet ist (422).",
                "tags": [
                    "billable-items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung, wenn der Kunde die Steuerbehandlung tax_exempt hat, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen). Wird in die erzeugten Rechnungen übernommen und im Hinweis gedruckt"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Beschreibung"
                                    },
                                    "unit_price": {
                                        "type": "number",
                                        "description": "Einzelpreis"
                                    },
                                    "quantity": {
                                        "type": "number",
                                        "description": "Menge"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "billable-items-delete",
                "summary": "Position löschen",
                "description": "Löschen. Nur möglich, solange nicht abgerechnet (422).",
                "tags": [
                    "billable-items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/billable-items/consolidate": {
            "post": {
                "operationId": "billable-items-consolidate",
                "summary": "Positionen konsolidieren",
                "description": "Fasst mehrere offene Positionen zu Rechnungen zusammen - pro Kunde wird eine Entwurfs-Rechnung erzeugt. Antwort: 201 mit den erstellten Rechnungen.",
                "tags": [
                    "billable-items"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "uuids": {
                                        "type": "array",
                                        "items": [],
                                        "description": "UUIDs der zu konsolidierenden Positionen (min 1, eindeutig)"
                                    }
                                },
                                "required": [
                                    "uuids"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/billable-items/{uuid}/generate": {
            "post": {
                "operationId": "billable-items-generate",
                "summary": "Position einzeln abrechnen",
                "description": "Rechnet genau diese Position sofort ab und liefert den Rechnungsentwurf. Das Fälligkeitsdatum wird dabei bewusst übergangen, es wird nichts versendet. Eine bereits abgerechnete Position liefert mit 200 ihre vorhandene Rechnung statt einer zweiten.",
                "tags": [
                    "billable-items"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "draft"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes": {
            "get": {
                "operationId": "quotes-list",
                "summary": "Angebote auflisten",
                "description": "Ruft eine paginierte Liste aller Angebote des Teams ab, sortiert nach Angebotsdatum, absteigend.",
                "tags": [
                    "quotes"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Filter: draft, sent, accepted, declined, expired, withdrawn",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Kunden-UUID",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Suchbegriff (Angebotsnummer, Empfängername, Firma)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Angebotsdatum ab (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Angebotsdatum bis (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 25)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                            "quote_number": "AN-2026-0007",
                                            "status": "sent",
                                            "total": 1190,
                                            "available_actions": [
                                                "send",
                                                "withdraw"
                                            ]
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 25,
                                        "total": 7
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "quotes-create",
                "summary": "Angebot erstellen",
                "description": "Erstellt ein Angebot im Status draft. Die Angebotsnummer wird automatisch aus dem Nummernkreis des Teams vergeben; für die Übernahme bestehender Angebote aus einem Fremdsystem kann sie über quote_number vorgegeben werden. Nicht angegebene Felder werden aus den Teameinstellungen und den Kundendaten ergänzt, etwa Währung, Sprache, Gültigkeitsdauer sowie Anschreiben- und Schlusstext. Die vollständige Liste der schreibbaren Felder liefert GET /flowaccounting/context. Die Steuerbehandlung übernimmt das Angebot vom Kunden aus FlowCRM und gibt sie als tax_treatment zurück (standard, reverse_charge, reverse_charge_domestic, intra_community_supply, export, non_taxable_abroad oder tax_exempt). Bei jedem Wert außer standard weist das Angebot keine Umsatzsteuer aus: Ein übergebener tax_rate wird auf 0 gesetzt. Die Rechnung aus einem angenommenen Angebot übernimmt dessen Steuerbehandlung.",
                "tags": [
                    "quotes"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "quote_number": "AN-2026-0007",
                                        "status": "draft"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "client_uuid": {
                                        "type": "string",
                                        "description": "Kunden-UUID (teamgebunden)"
                                    },
                                    "contact_uuid": {
                                        "type": "string",
                                        "description": "Kontakt-UUID des Kunden"
                                    },
                                    "quote_number": {
                                        "type": "string",
                                        "description": "Optional: eigene Angebotsnummer, nur für die Übernahme bestehender Angebote aus einem Fremdsystem gedacht. Im Normalfall weglassen, dann vergibt der Nummernkreis die Nummer beim Anlegen. KI-Assistenten und Agenten setzen das Feld nur, wenn der Nutzer ausdrücklich auf einer eigenen Nummer besteht. Höchstens 40 Zeichen aus den Buchstaben A bis Z, Ziffern, Leerzeichen, Punkt, Unterstrich und Bindestrich, am Anfang und Ende ein Buchstabe oder eine Ziffer. Muss im Team eindeutig sein, auch gegenüber gelöschten Entwürfen und zurückgezogenen Angeboten. Liegt die Nummer im laufenden Nummernkreis, muss sie unter dem nächsten Zählerstand liegen; dafür vorher in den FlowAccounting-Einstellungen die nächste Angebotsnummer über die höchste Importnummer setzen. Der Zähler bleibt unverändert. Nach dem Anlegen lässt sich die Nummer nicht mehr ändern"
                                    },
                                    "quote_date": {
                                        "type": "string",
                                        "description": "Angebotsdatum (YYYY-MM-DD, Standard: heute)"
                                    },
                                    "valid_until": {
                                        "type": "string",
                                        "description": "Gültig bis (YYYY-MM-DD, Standard: Gültigkeitsdauer des Teams)"
                                    },
                                    "signature_type": {
                                        "type": "string",
                                        "description": "Annahmeart: button oder canvas"
                                    },
                                    "currency_code": {
                                        "type": "string",
                                        "description": "EUR, USD, CHF oder GBP"
                                    },
                                    "document_language": {
                                        "type": "string",
                                        "description": "de, en oder pt"
                                    },
                                    "discount_percent": {
                                        "type": "number",
                                        "description": "Gesamtrabatt in Prozent"
                                    },
                                    "greeting_text": {
                                        "type": "string",
                                        "description": "Anschreiben über den Positionen"
                                    },
                                    "closing_text": {
                                        "type": "string",
                                        "description": "Schlusstext unter den Positionen"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Sichtbare Notiz auf dem Angebot"
                                    },
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung bei der Steuerbehandlung tax_exempt, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen), gedruckt im Hinweis auf dem Beleg"
                                    },
                                    "internal_notes": {
                                        "type": "string",
                                        "description": "Interne Notiz, nicht auf dem Dokument"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Positionen, 1 bis 200 Stück. Je Position <code>name</code>, <code>quantity</code>, <code>unit_price</code> und <code>tax_rate</code>; optional <code>description</code>, <code>unit</code>, <code>discount_percent</code>, <code>type</code>, <code>unit_code</code>, <code>product_uuid</code> und <code>project_uuid</code>"
                                    },
                                    "recipient_name": {
                                        "type": "string",
                                        "description": "Abweichender Empfängername"
                                    },
                                    "recipient_company": {
                                        "type": "string",
                                        "description": "Abweichende Empfängerfirma"
                                    },
                                    "recipient_email": {
                                        "type": "string",
                                        "description": "Abweichende Empfängeradresse"
                                    }
                                },
                                "required": [
                                    "client_uuid",
                                    "items"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes/{uuid}": {
            "get": {
                "operationId": "quotes-show",
                "summary": "Angebots-Details abrufen",
                "description": "Angebots-Details einschließlich Positionen, Summen, available_actions und allowed_transitions.",
                "tags": [
                    "quotes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "quotes-update",
                "summary": "Angebot aktualisieren",
                "description": "Ändert ein Angebot im Status draft; sonst 422. Es werden nur die gesendeten Felder geändert, alle übrigen bleiben stehen. Wird items mitgegeben, ersetzt die Liste sämtliche Positionen. Die Angebotsnummer lässt sich nicht ändern: quote_number wird hier mit 422 abgelehnt.",
                "tags": [
                    "quotes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "valid_until": {
                                        "type": "string",
                                        "description": "Gültig bis (YYYY-MM-DD)"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Sichtbare Notiz auf dem Angebot"
                                    },
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung bei der Steuerbehandlung tax_exempt, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen), gedruckt im Hinweis auf dem Beleg"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Ersetzt alle Positionen"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "quotes-delete",
                "summary": "Angebot löschen",
                "description": "Löscht ein Angebot im Status draft; sonst 422.",
                "tags": [
                    "quotes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes/{uuid}/send": {
            "post": {
                "operationId": "quotes-send",
                "summary": "Angebot per E-Mail versenden",
                "description": "Versendet das Angebot und setzt es dabei auf sent. Erfordert einen Header Idempotency-Key im UUID-Format; derselbe Schlüssel versendet nicht zweimal. Ohne recipient_emails gelten die Empfänger des Kunden. Ist die Absenderdomain nicht verifiziert, antwortet die API mit 409 und sender_domain_not_verified.",
                "tags": [
                    "quotes"
                ],
                "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,
                                    "sent": true,
                                    "data": {
                                        "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "sent"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient_emails": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Abweichende Empfängeradressen, höchstens 50"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes/{uuid}/withdraw": {
            "post": {
                "operationId": "quotes-withdraw",
                "summary": "Angebot zurückziehen",
                "description": "Zieht ein versendetes Angebot zurück. Nur aus dem Status sent möglich; sonst 422.",
                "tags": [
                    "quotes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes/{uuid}/accept": {
            "post": {
                "operationId": "quotes-accept",
                "summary": "Annahme erfassen",
                "description": "Hält fest, dass der Kunde das Angebot angenommen hat, etwa telefonisch oder per E-Mail. Nur aus dem Status sent möglich und nur einmal; sonst 422. Für die Annahme über den Angebotslink des Kunden ist dieser Endpoint nicht gedacht, dort wird zusätzlich die Unterschrift erfasst.",
                "tags": [
                    "quotes"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "accepted"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes/{uuid}/convert": {
            "post": {
                "operationId": "quotes-convert",
                "summary": "In Rechnung umwandeln",
                "description": "Erzeugt aus einem angenommenen Angebot einen Rechnungsentwurf. Nur im Status accepted möglich; sonst 422 mit quote_not_accepted. Ein zweiter Aufruf liefert mit 200 die bereits erzeugte Rechnung statt einer weiteren.",
                "tags": [
                    "quotes"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "draft"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes/{uuid}/pdf": {
            "get": {
                "operationId": "quotes-pdf",
                "summary": "Angebots-PDF herunterladen",
                "description": "Liefert das Angebot als PDF-Datei (application/pdf), im Dokumentlayout des Teams und in der auf dem Dokument festgehaltenen Sprache.",
                "tags": [
                    "quotes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "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"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes/{uuid}/items": {
            "get": {
                "operationId": "quote-items-list",
                "summary": "Positionen auflisten",
                "description": "Listet die Positionen eines Angebots, sortiert nach ihrer Reihenfolge.",
                "tags": [
                    "quote-items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 50)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "quote-items-create",
                "summary": "Position hinzufügen",
                "description": "Fügt dem Angebot eine Position hinzu. Ohne position wird sie hinten angefügt. Ein project_uuid muss zu einem Projekt des Angebotskunden gehören; sonst 422.",
                "tags": [
                    "quote-items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Bezeichnung der Position"
                                    },
                                    "quantity": {
                                        "type": "number",
                                        "description": "Menge"
                                    },
                                    "unit_price": {
                                        "type": "number",
                                        "description": "Einzelpreis netto"
                                    },
                                    "tax_rate": {
                                        "type": "number",
                                        "description": "Steuersatz in Prozent"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Beschreibungstext"
                                    },
                                    "unit": {
                                        "type": "string",
                                        "description": "Einheit, etwa Stunde oder Stück"
                                    },
                                    "discount_percent": {
                                        "type": "number",
                                        "description": "Positionsrabatt in Prozent"
                                    },
                                    "type": {
                                        "type": "string",
                                        "description": "service, product oder hours"
                                    },
                                    "position": {
                                        "type": "integer",
                                        "description": "Reihenfolge"
                                    },
                                    "product_uuid": {
                                        "type": "string",
                                        "description": "Produkt-UUID aus dem Produktkatalog"
                                    },
                                    "project_uuid": {
                                        "type": "string",
                                        "description": "Projekt-UUID des Angebotskunden"
                                    }
                                },
                                "required": [
                                    "name",
                                    "quantity",
                                    "unit_price",
                                    "tax_rate"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/quotes/{uuid}/items/{itemUuid}": {
            "put": {
                "operationId": "quote-items-update",
                "summary": "Position aktualisieren",
                "description": "Ändert eine einzelne Position. Es werden nur die gesendeten Felder geändert.",
                "tags": [
                    "quote-items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "itemUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "quantity": {
                                        "type": "number",
                                        "description": "Menge"
                                    },
                                    "unit_price": {
                                        "type": "number",
                                        "description": "Einzelpreis netto"
                                    },
                                    "tax_rate": {
                                        "type": "number",
                                        "description": "Steuersatz in Prozent"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "quote-items-delete",
                "summary": "Position löschen",
                "description": "Entfernt eine Position aus dem Angebot und berechnet die Summen neu.",
                "tags": [
                    "quote-items"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "itemUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes": {
            "get": {
                "operationId": "credit-notes-list",
                "summary": "Rechnungskorrekturen auflisten",
                "description": "Ruft eine paginierte Liste aller Rechnungskorrekturen des Teams ab, sortiert nach Datum der Rechnungskorrektur, absteigend.",
                "tags": [
                    "credit-notes"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Filter: draft, issued, settled, cancelled",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Kunden-UUID",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Datum der Rechnungskorrektur ab (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Datum der Rechnungskorrektur bis (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 25)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "credit-notes-create",
                "summary": "Rechnungskorrektur erstellen",
                "description": "Erstellt eine Rechnungskorrektur im Status draft. Mit invoice_uuid wird sie der gutzuschreibenden Rechnung zugeordnet; diese muss demselben Kunden gehören und dieselbe Währung führen. Rechnungskorrekturpositionen sind freie Zeilen ohne Produkt- oder Projektverknüpfung. Eine Rechnungskorrektur zu einer Rechnung übernimmt deren Steuerbehandlung, eine freie Rechnungskorrektur die des Kunden; die Antwort nennt sie als tax_treatment. Bei jedem Wert außer standard (z. B. reverse_charge, tax_exempt) weist die Rechnungskorrektur keine Umsatzsteuer aus: Ein übergebener tax_rate wird auf 0 gesetzt. Ihre Nummer erhält die Rechnungskorrektur erst beim Ausstellen aus dem Nummernkreis des Teams; für die Übernahme bestehender Rechnungskorrekturen aus einem Fremdsystem kann sie über credit_note_number vorgegeben werden.",
                "tags": [
                    "credit-notes"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "draft"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "client_uuid": {
                                        "type": "string",
                                        "description": "Kunden-UUID (teamgebunden)"
                                    },
                                    "invoice_uuid": {
                                        "type": "string",
                                        "description": "UUID der gutzuschreibenden Rechnung"
                                    },
                                    "contact_uuid": {
                                        "type": "string",
                                        "description": "Kontakt-UUID des Kunden"
                                    },
                                    "credit_note_number": {
                                        "type": "string",
                                        "description": "Optional: eigene Nummer der Rechnungskorrektur, nur für die Übernahme bestehender Rechnungskorrekturen aus einem Fremdsystem gedacht. Im Normalfall weglassen, dann vergibt der Nummernkreis die Nummer beim Ausstellen. KI-Assistenten und Agenten setzen das Feld nur, wenn der Nutzer ausdrücklich auf einer eigenen Nummer besteht. Höchstens 40 Zeichen aus den Buchstaben A bis Z, Ziffern, Leerzeichen, Punkt, Unterstrich und Bindestrich, am Anfang und Ende ein Buchstabe oder eine Ziffer. Muss im Team eindeutig sein, auch gegenüber gelöschten Entwürfen und stornierten Rechnungskorrekturen. Liegt die Nummer im laufenden Nummernkreis, muss sie unter dem nächsten Zählerstand liegen; dafür vorher in den FlowAccounting-Einstellungen die nächste Nummer der Rechnungskorrektur über die höchste Importnummer setzen. Der Zähler bleibt unverändert, auch beim Ausstellen. Nach dem Anlegen lässt sich die Nummer nicht mehr ändern"
                                    },
                                    "credit_note_date": {
                                        "type": "string",
                                        "description": "Datum der Rechnungskorrektur (YYYY-MM-DD, Standard: heute)"
                                    },
                                    "currency_code": {
                                        "type": "string",
                                        "description": "EUR, USD, CHF oder GBP"
                                    },
                                    "document_language": {
                                        "type": "string",
                                        "description": "de, en oder pt"
                                    },
                                    "einvoice_format": {
                                        "type": "string",
                                        "description": "pdf, zugferd oder xrechnung"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Sichtbare Notiz auf der Rechnungskorrektur"
                                    },
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung bei der Steuerbehandlung tax_exempt, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen), gedruckt im Hinweis auf dem Beleg. Eine Rechnungskorrektur zu einer Rechnung übernimmt die Vorschrift der Rechnung"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Positionen, 1 bis 200 Stück, mit <code>name</code>, <code>quantity</code>, <code>unit_price</code> und <code>tax_rate</code>"
                                    }
                                },
                                "required": [
                                    "client_uuid",
                                    "items"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes/{uuid}": {
            "get": {
                "operationId": "credit-notes-show",
                "summary": "Details der Rechnungskorrektur abrufen",
                "description": "Details der Rechnungskorrektur einschließlich Positionen, Summen und available_actions.",
                "tags": [
                    "credit-notes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "credit-notes-update",
                "summary": "Rechnungskorrektur aktualisieren",
                "description": "Ändert eine Rechnungskorrektur im Status draft; sonst 422. Wird items mitgegeben, ersetzt die Liste sämtliche Positionen. Die Nummer der Rechnungskorrektur lässt sich nicht ändern: credit_note_number wird hier mit 422 abgelehnt.",
                "tags": [
                    "credit-notes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "notes": {
                                        "type": "string",
                                        "description": "Sichtbare Notiz auf der Rechnungskorrektur"
                                    },
                                    "tax_exemption_basis": {
                                        "type": "string",
                                        "description": "Vorschrift der Steuerbefreiung bei der Steuerbehandlung tax_exempt, z. B. „§ 4 Nr. 14“ (max. 40 Zeichen), gedruckt im Hinweis auf dem Beleg. Eine Rechnungskorrektur zu einer Rechnung übernimmt die Vorschrift der Rechnung"
                                    },
                                    "items": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Ersetzt alle Positionen"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "credit-notes-delete",
                "summary": "Rechnungskorrektur löschen",
                "description": "Löscht eine Rechnungskorrektur im Status draft; sonst 422.",
                "tags": [
                    "credit-notes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes/{uuid}/issue": {
            "post": {
                "operationId": "credit-notes-issue",
                "summary": "Rechnungskorrektur ausstellen",
                "description": "Stellt die Rechnungskorrektur aus und vergibt ihre Nummer, sofern beim Anlegen keine vorgegeben wurde. Ist die zugrunde liegende Rechnung über Stripe bezahlt, wird die Erstattung angestoßen. Das Feld refund_status meldet started, not_required oder review_required. Nur im Status draft möglich; sonst 422. Ebenfalls 422, wenn die verknüpfte Rechnung noch ein Entwurf ist (zuerst die Rechnung ausstellen), wenn sie storniert wurde oder wenn sie ihre Steuerbehandlung geändert hat, seit die Rechnungskorrektur gespeichert wurde: Dann die Rechnungskorrektur zuerst per PUT mit ihren Positionen neu speichern.",
                "tags": [
                    "credit-notes"
                ],
                "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,
                                    "refund_status": "not_required",
                                    "data": {
                                        "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "issued"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes/{uuid}/settle": {
            "post": {
                "operationId": "credit-notes-settle",
                "summary": "Rechnungskorrektur verrechnen",
                "description": "Verrechnet eine ausgestellte Rechnungskorrektur und bucht dafür genau eine Transaktion vom Typ credit. Mit mode offset wird der Betrag auf die verknüpfte Rechnung gebucht: Er darf weder die Summe der Rechnungskorrektur noch den offenen Betrag der Rechnung übersteigen, und Rechnung und Rechnungskorrektur müssen dieselbe Währung führen. Deckt die Buchung den offenen Betrag, gilt die Rechnung als bezahlt (paid), sonst als teilweise bezahlt (partially_paid); eine Rechnung im Entwurf oder eine stornierte Rechnung wird abgelehnt. Mit pool wandert der Betrag ohne Rechnungsbezug ins Guthaben des Kunden und steht dort für spätere Rechnungen zur Verfügung. In beiden Fällen ist die Rechnungskorrektur danach vollständig verrechnet (settled), auch bei einem Teilbetrag: Der Rest wandert nicht ins Guthaben und lässt sich nicht nachträglich verrechnen. Ohne amount wird der höchste zulässige Betrag gebucht. transaction_date ist für die Übernahme historischer Belege gedacht und legt das Buchungsdatum der Transaktion fest. Die Antwort enthält die Rechnungskorrektur in data, die gebuchte Transaktion in transaction und bei offset den Stand der Rechnung in invoice (uuid, invoice_number, status, paid_date, remaining_amount); bei pool ist invoice null. Der Aufruf ist über den Status abgesichert: Eine Wiederholung bucht nichts und liefert 422 mit credit_note_already_settled, ein Entwurf oder eine stornierte Rechnungskorrektur 422 mit credit_note_not_issued. Weitere Ablehnungen mit 422: credit_note_without_invoice, invoice_not_settleable, currency_mismatch, amount_exceeds_limit und transaction_date_out_of_range.",
                "tags": [
                    "credit-notes"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "settled"
                                    },
                                    "transaction": {
                                        "uuid": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
                                        "type": "credit",
                                        "amount": 238,
                                        "credit_note_uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "invoice_uuid": "9b2e4f6a-1c3d-4e5f-8a7b-6c5d4e3f2a1b"
                                    },
                                    "invoice": {
                                        "uuid": "9b2e4f6a-1c3d-4e5f-8a7b-6c5d4e3f2a1b",
                                        "invoice_number": "RE-2026-0042",
                                        "status": "partially_paid",
                                        "paid_date": null,
                                        "remaining_amount": 952
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "mode": {
                                        "type": "string",
                                        "description": "<code>offset</code> (mit der verknüpften Rechnung verrechnen) oder <code>pool</code> (dem Guthaben des Kunden gutschreiben)"
                                    },
                                    "amount": {
                                        "type": "number",
                                        "description": "Zu buchender Betrag, mindestens 0,01. Standard: die Summe der Rechnungskorrektur, bei <code>offset</code> höchstens der offene Betrag der Rechnung"
                                    },
                                    "transaction_date": {
                                        "type": "string",
                                        "description": "Buchungsdatum (YYYY-MM-DD, Standard: heute). Frühestens das Datum der Rechnungskorrektur, spätestens heute"
                                    }
                                },
                                "required": [
                                    "mode"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes/{uuid}/cancel": {
            "post": {
                "operationId": "credit-notes-cancel",
                "summary": "Rechnungskorrektur stornieren",
                "description": "Storniert eine Rechnungskorrektur im Status draft oder issued; der Aufruf hat keinen Body. Die Stornierung ist endgültig. Beleg und Nummer bleiben erhalten: Die Rechnungskorrektur lässt sich weiter abrufen, und ihre Nummer wird nicht wieder frei. Das gilt auch für einen Entwurf, der mit vorgegebener credit_note_number angelegt wurde; er belegt diese Nummer weiter. Eine verrechnete oder bereits stornierte Rechnungskorrektur liefert 422 mit action_not_available. Ebenfalls 422, mit credit_note_refund_started, wenn für die verknüpfte Rechnung eine Stripe-Erstattung angestoßen wurde, die nicht fehlgeschlagen ist: Das Geld ist dann an den Kunden zurückgeflossen, und der Beleg dazu muss bestehen bleiben.",
                "tags": [
                    "credit-notes"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "cancelled"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes/{uuid}/send": {
            "post": {
                "operationId": "credit-notes-send",
                "summary": "Rechnungskorrektur per E-Mail versenden",
                "description": "Versendet die ausgestellte Rechnungskorrektur an genau eine Adresse; mehrere Empfänger werden mit 422 abgelehnt. Erfordert einen Header Idempotency-Key im UUID-Format. Ohne recipient_emails gilt die hinterlegte Adresse des Kunden.",
                "tags": [
                    "credit-notes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "recipient_emails": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Genau eine abweichende Empfängeradresse"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes/{uuid}/pdf": {
            "get": {
                "operationId": "credit-notes-pdf",
                "summary": "PDF der Rechnungskorrektur herunterladen",
                "description": "Liefert die Rechnungskorrektur als PDF-Datei (application/pdf) im Dokumentlayout des Teams. Ausgestellte Rechnungskorrekturen liefern die beim Ausstellen gespeicherte Datei (Header X-FlowAccounting-Document-Source: frozen), sonst regenerated.",
                "tags": [
                    "credit-notes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "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"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes/{uuid}/einvoice": {
            "get": {
                "operationId": "credit-notes-einvoice",
                "summary": "Archivierte E-Rechnung herunterladen",
                "description": "Liefert die beim Ausstellen archivierte E-Rechnung der Rechnungskorrektur Byte für Byte: bei XRechnung die XML-Datei (application/xml), bei ZUGFeRD das PDF/A-3 mit eingebetteter XML (application/pdf). Antwort ist ein Datei-Download, kein JSON; es wird nie neu erzeugt. Header: X-FlowAccounting-Einvoice-SHA256 (SHA-256 der gelieferten Datei), X-FlowAccounting-Einvoice-XML-SHA256 (SHA-256 der Rechnungs-XML, bei ZUGFeRD der eingebetteten), X-FlowAccounting-Einvoice-Uuid (Archiveintrag). Ohne archivierte E-Rechnung (Entwurf, klassisches PDF, vor der Archivierung ausgestellt) antwortet der Endpoint mit 404 und error: einvoice_not_archived; besteht die Datei die Hash-Prüfung nicht, mit 409 und error: einvoice_integrity_failed. Eine unbekannte UUID oder eine Rechnungskorrektur eines anderen Teams ergibt 404.",
                "tags": [
                    "credit-notes"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "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"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/credit-notes/{uuid}/einvoice/validation": {
            "get": {
                "operationId": "credit-notes-einvoice-validation",
                "summary": "Prüfbericht der archivierten E-Rechnung",
                "description": "Liefert den letzten Prüfbericht der archivierten E-Rechnung der Rechnungskorrektur. Nur lesend. Die Prüfung lief beim Archivieren auf genau den ausgestellten Bytes (Wohlgeformtheit, XSD, Geschäftsregeln nach EN 16931 und XRechnung, Pflichtangaben nach § 14 Abs. 4 UStG). validation_status ist valid, valid_with_warnings, business_rule_errors, mandatory_field_errors oder format_error. report.messages ist eine Liste mit code (z. B. BR-DE-2, FAC-PFLICHT-6), severity (error oder warning), category (format, business_rule, mandatory_vat) und message. Ohne archivierte E-Rechnung 404 mit error: einvoice_not_archived; eine unbekannte UUID oder eine Rechnungskorrektur eines anderen Teams ergibt 404.",
                "tags": [
                    "credit-notes"
                ],
                "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": "8d1f2c4e-6a0b-4c1d-9e2f-3a4b5c6d7e8f",
                                        "document_uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "format": "xrechnung",
                                        "profile": "xrechnung_3",
                                        "specification_id": "urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0",
                                        "type_code": "380",
                                        "invoice_number": "RE-00042",
                                        "xml_sha256": "3f5a…",
                                        "file_sha256": "3f5a…",
                                        "archived_at": "2026-11-24T10:00:00+01:00",
                                        "validation_status": "valid_with_warnings",
                                        "report": {
                                            "uuid": "0c9e…",
                                            "engine": "internal",
                                            "engine_version": "internal-1.0",
                                            "status": "valid_with_warnings",
                                            "errors_count": 0,
                                            "warnings_count": 1,
                                            "messages": [
                                                {
                                                    "code": "FAC-FX-2",
                                                    "severity": "warning",
                                                    "category": "mandatory_vat",
                                                    "message": "Die Umsatzsteuer in Euro (BT-111) beruht auf einem vorläufigen Kurs, der BMF-Monatskurs ist noch nicht veröffentlicht."
                                                }
                                            ],
                                            "created_at": "2026-11-24T10:00:00+01:00"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/expenses": {
            "get": {
                "operationId": "expenses-list",
                "summary": "Ausgaben auflisten",
                "description": "Ruft eine paginierte Liste aller Ausgaben des Teams ab, sortiert nach Buchungsdatum, absteigend.",
                "tags": [
                    "expenses"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Filter: pending oder booked",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "supplier_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Lieferanten-UUID",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "expense_category_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Kategorie-UUID",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Suchbegriff (Beschreibung, Lieferanten-Rechnungsnummer)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "intake_status",
                        "in": "query",
                        "required": false,
                        "description": "Filter nach Eingangsstatus: needs_review liefert die Prüf-Queue (alle offenen Belege vor der Prüfung), außerdem received, processing, failed oder reviewed",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "missing_receipt",
                        "in": "query",
                        "required": false,
                        "description": "Nur Belege mit Vorsteuer, aber ohne Rechnungsdatei (Aufgabe „Beleg fehlt“)",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": false,
                        "description": "Buchungsdatum ab (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": false,
                        "description": "Buchungsdatum bis (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 25)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "expenses-create",
                "summary": "Ausgabe erfassen",
                "description": "Erfasst eine Ausgabe im Status pending; gebucht wird sie in einem eigenen Schritt über POST /flowaccounting/expenses/{uuid}/book. Netto-, Steuer- und Bruttobetrag werden aus gross_amount, tax_rate und vat_mode berechnet. Eine zweite Ausgabe mit derselben Lieferanten-Rechnungsnummer desselben Lieferanten (oder derselben Nummer und derselben USt-IdNr. auf dem Beleg) wird mit 422 abgelehnt, außer der Aufruf bestätigt mit confirm_not_duplicate und einer Begründung in duplicate_reason (mindestens 10 Zeichen), dass es keine Dublette ist. Die Entscheidung wird mit Begründung, Zeitpunkt und Bearbeiter an der Ausgabe gespeichert. Eine Rechnungskorrektur mit umgekehrtem Vorzeichen gilt nicht als Dublette.",
                "tags": [
                    "expenses"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "pending",
                                        "has_receipt": false
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "booking_date": {
                                        "type": "string",
                                        "description": "Buchungsdatum (YYYY-MM-DD)"
                                    },
                                    "gross_amount": {
                                        "type": "number",
                                        "description": "Bruttobetrag"
                                    },
                                    "tax_rate": {
                                        "type": "number",
                                        "description": "Steuersatz in Prozent (Standard: Steuersatz des Teams)"
                                    },
                                    "vat_mode": {
                                        "type": "string",
                                        "description": "full, none oder reverse_charge (Standard: full)"
                                    },
                                    "currency_code": {
                                        "type": "string",
                                        "description": "EUR, USD, CHF oder GBP"
                                    },
                                    "supplier_uuid": {
                                        "type": "string",
                                        "description": "Lieferanten-UUID"
                                    },
                                    "expense_category_uuid": {
                                        "type": "string",
                                        "description": "Kategorie-UUID"
                                    },
                                    "supplier_invoice_number": {
                                        "type": "string",
                                        "description": "Rechnungsnummer des Lieferanten"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Kurze Beschreibung"
                                    },
                                    "notes": {
                                        "type": "string",
                                        "description": "Interne Notiz"
                                    },
                                    "confirm_not_duplicate": {
                                        "type": "boolean",
                                        "description": "Bestätigt, dass ein Beleg mit derselben Rechnungsnummer keine Dublette ist (nur mit duplicate_reason)"
                                    },
                                    "duplicate_reason": {
                                        "type": "string",
                                        "description": "Begründung zu confirm_not_duplicate, 10 bis 500 Zeichen"
                                    }
                                },
                                "required": [
                                    "booking_date",
                                    "gross_amount"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/expenses/{uuid}": {
            "get": {
                "operationId": "expenses-show",
                "summary": "Ausgaben-Details abrufen",
                "description": "Ausgaben-Details einschließlich der berechneten Beträge sowie has_receipt und receipt_name. intake_status zeigt den Weg durch die Prüf-Queue (needs_review, failed, reviewed …), reviewed_at den Zeitpunkt der Prüfung, duplicate_decision eine Dublettenentscheidung (not_duplicate) und missing_receipt, ob Vorsteuer angesetzt ist, aber die Rechnungsdatei fehlt.",
                "tags": [
                    "expenses"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "expenses-update",
                "summary": "Ausgabe aktualisieren",
                "description": "Ändert eine Ausgabe im Status pending. Bereits gebuchte Ausgaben bleiben unverändert und werden mit 422 abgelehnt. Eine geänderte Lieferanten-Rechnungsnummer wird wie beim Erfassen auf Dubletten geprüft (confirm_not_duplicate, duplicate_reason).",
                "tags": [
                    "expenses"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "gross_amount": {
                                        "type": "number",
                                        "description": "Bruttobetrag"
                                    },
                                    "expense_category_uuid": {
                                        "type": "string",
                                        "description": "Kategorie-UUID"
                                    },
                                    "description": {
                                        "type": "string",
                                        "description": "Kurze Beschreibung"
                                    },
                                    "confirm_not_duplicate": {
                                        "type": "boolean",
                                        "description": "Bestätigt, dass ein Beleg mit derselben Rechnungsnummer keine Dublette ist (nur mit duplicate_reason)"
                                    },
                                    "duplicate_reason": {
                                        "type": "string",
                                        "description": "Begründung zu confirm_not_duplicate, 10 bis 500 Zeichen"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "expenses-delete",
                "summary": "Ausgabe löschen",
                "description": "Löscht eine Ausgabe im Status pending; sonst 422.",
                "tags": [
                    "expenses"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/expenses/{uuid}/receipt": {
            "post": {
                "operationId": "expenses-receipt-upload",
                "summary": "Beleg hochladen",
                "description": "Hängt den Beleg als multipart/form-data an die Ausgabe. Erlaubt sind PDF, JPEG und PNG bis 10 MB; der Typ wird aus dem Dateiinhalt bestimmt. Ein vorhandener Beleg wird ersetzt, sobald der neue gespeichert ist, und bleibt als frühere Fassung erhalten. Eine gebuchte Ausgabe ohne Belegdatei nimmt die fehlende Rechnung einmal auf (Aufgabe „Beleg fehlt“); hat sie schon einen Beleg, antwortet die API mit 422 expense_booked, ist dieselbe Datei schon Beleg einer anderen Ausgabe des Teams mit 422 receipt_duplicate, bei einer Datei, die kein Beleg ist, mit 422 invalid_receipt.",
                "tags": [
                    "expenses"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "has_receipt": true,
                                        "receipt_name": "beleg.pdf"
                                    }
                                }
                            }
                        }
                    },
                    "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": "Belegdatei (PDF, JPEG oder PNG, höchstens 10 MB)"
                                    }
                                },
                                "required": [
                                    "file"
                                ]
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "expenses-receipt-download",
                "summary": "Beleg herunterladen",
                "description": "Liefert die hinterlegte Belegdatei. Ohne Beleg antwortet die API mit 404. Die Datei wird vor der Auslieferung gegen ihren SHA-256 geprüft; fehlt sie oder stimmt sie nicht mehr, antwortet die API mit 409 receipt_integrity_failed. Hat die Sicherheitsprüfung beim Eingang etwas gefunden (Skript, Startaktion, Schadcode), antwortet die API mit 409 receipt_flagged und den Befunden in security_flags, bis der Aufruf acknowledge_security_findings=1 mitgibt.",
                "tags": [
                    "expenses"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    },
                    {
                        "name": "acknowledge_security_findings",
                        "in": "query",
                        "required": false,
                        "description": "Bestätigt, dass eine Datei mit Sicherheitsbefund trotzdem geliefert werden soll",
                        "schema": {
                            "type": "boolean"
                        }
                    }
                ],
                "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"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/expenses/{uuid}/book": {
            "post": {
                "operationId": "expenses-book",
                "summary": "Ausgabe buchen",
                "description": "Bucht eine Ausgabe im Status pending: Sie wechselt in den Status booked und erhält das Zahlungsdatum paid_date. Erst eine gebuchte Ausgabe zählt in den Berichten, und zwar im Zeitraum ihres Zahlungsdatums. Die Reihenfolge ist: Ausgabe anlegen, Beleg hochladen, buchen. Nach dem Buchen sind Ändern, Löschen und der Austausch des Belegs über die API gesperrt (422). Das Buchen lässt sich über die API nicht rückgängig machen; eine gebuchte Ausgabe wird in der Weboberfläche korrigiert. Der Aufruf ist über den Status abgesichert: Eine Wiederholung bucht nichts und liefert 422 mit expense_booked.",
                "tags": [
                    "expenses"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "booked",
                                        "paid_date": "2026-03-14",
                                        "available_actions": []
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "paid_date": {
                                        "type": "string",
                                        "description": "Zahlungsdatum (YYYY-MM-DD), höchstens heute"
                                    }
                                },
                                "required": [
                                    "paid_date"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/expenses/{uuid}/review": {
            "post": {
                "operationId": "expenses-review",
                "summary": "Beleg als geprüft markieren",
                "description": "Markiert eine offene Ausgabe aus der Prüf-Queue als geprüft (intake_status wird reviewed, reviewed_at und der Bearbeiter werden gespeichert). Gebucht wird weiter nur über POST /flowaccounting/expenses/{uuid}/book. Voraussetzung sind ein Bruttobetrag und ein Belegdatum, sonst 422 review_incomplete. Hat ein früherer Beleg denselben Lieferanten und dieselbe Rechnungsnummer (oder dieselbe Nummer und USt-IdNr.), antwortet die API mit 422 duplicate_undecided, bis der Aufruf confirm_not_duplicate mit duplicate_reason mitgibt; ohne Bestätigung bucht auch /book eine solche Ausgabe nicht (422 duplicate_undecided). Bereits gebuchte Ausgaben: 422 expense_booked.",
                "tags": [
                    "expenses"
                ],
                "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": "550e8400-e29b-41d4-a716-446655440000",
                                        "status": "pending",
                                        "intake_status": "reviewed",
                                        "reviewed_at": "2026-11-26T10:00:00+01:00",
                                        "duplicate_decision": null
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "confirm_not_duplicate": {
                                        "type": "boolean",
                                        "description": "Bestätigt, dass ein Beleg mit derselben Rechnungsnummer keine Dublette ist"
                                    },
                                    "duplicate_reason": {
                                        "type": "string",
                                        "description": "Begründung zu confirm_not_duplicate, 10 bis 500 Zeichen"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/suppliers": {
            "get": {
                "operationId": "suppliers-list",
                "summary": "Lieferanten auflisten",
                "description": "Ruft eine paginierte Liste aller Lieferanten des Teams ab, alphabetisch sortiert.",
                "tags": [
                    "suppliers"
                ],
                "parameters": [
                    {
                        "name": "is_active",
                        "in": "query",
                        "required": false,
                        "description": "Filter: nur aktive oder nur inaktive Lieferanten",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Suchbegriff im Namen",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 25)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "suppliers-create",
                "summary": "Lieferant anlegen",
                "description": "Legt einen Lieferanten an.",
                "tags": [
                    "suppliers"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Name des Lieferanten"
                                    },
                                    "address": {
                                        "type": "string",
                                        "description": "Anschrift"
                                    },
                                    "vat_id": {
                                        "type": "string",
                                        "description": "Umsatzsteuer-Identifikationsnummer"
                                    },
                                    "tax_id": {
                                        "type": "string",
                                        "description": "Steuernummer"
                                    },
                                    "email": {
                                        "type": "string",
                                        "description": "E-Mail-Adresse"
                                    },
                                    "phone": {
                                        "type": "string",
                                        "description": "Telefonnummer"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv (Standard: true)"
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/suppliers/{uuid}": {
            "get": {
                "operationId": "suppliers-show",
                "summary": "Lieferanten-Details abrufen",
                "description": "Lieferanten-Details abrufen.",
                "tags": [
                    "suppliers"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "suppliers-update",
                "summary": "Lieferant aktualisieren",
                "description": "Ändert einen Lieferanten. Es werden nur die gesendeten Felder geändert.",
                "tags": [
                    "suppliers"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Name des Lieferanten"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "suppliers-delete",
                "summary": "Lieferant löschen",
                "description": "Löscht einen Lieferanten, auf den noch keine Ausgabe gebucht ist. Andernfalls antwortet die API mit 422 und dem Hinweis, den Lieferanten zu deaktivieren.",
                "tags": [
                    "suppliers"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/expense-categories": {
            "get": {
                "operationId": "expense-categories-list",
                "summary": "Ausgabenkategorien auflisten",
                "description": "Ruft eine paginierte Liste aller Ausgabenkategorien des Teams ab, alphabetisch sortiert.",
                "tags": [
                    "expense-categories"
                ],
                "parameters": [
                    {
                        "name": "is_active",
                        "in": "query",
                        "required": false,
                        "description": "Filter: nur aktive oder nur inaktive Kategorien",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Suchbegriff im Namen",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 25)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "expense-categories-create",
                "summary": "Ausgabenkategorie anlegen",
                "description": "Legt eine Ausgabenkategorie an. Mit parent_uuid wird sie einer übergeordneten Kategorie untergeordnet; eine Verkettung im Kreis wird mit 422 abgelehnt.",
                "tags": [
                    "expense-categories"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Name der Kategorie"
                                    },
                                    "number": {
                                        "type": "string",
                                        "description": "Kontonummer"
                                    },
                                    "parent_uuid": {
                                        "type": "string",
                                        "description": "UUID der übergeordneten Kategorie"
                                    },
                                    "euer_group": {
                                        "type": "string",
                                        "description": "Zuordnung in der Einnahmenüberschussrechnung"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv (Standard: true)"
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/expense-categories/{uuid}": {
            "get": {
                "operationId": "expense-categories-show",
                "summary": "Ausgabenkategorie abrufen",
                "description": "Details einer Ausgabenkategorie einschließlich parent_uuid.",
                "tags": [
                    "expense-categories"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "expense-categories-update",
                "summary": "Ausgabenkategorie aktualisieren",
                "description": "Ändert eine Ausgabenkategorie. Es werden nur die gesendeten Felder geändert.",
                "tags": [
                    "expense-categories"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Name der Kategorie"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "expense-categories-delete",
                "summary": "Ausgabenkategorie löschen",
                "description": "Antwortet mit 422: Kategorien werden deaktiviert und nicht gelöscht. Der Endpoint besteht, damit der Grund benannt wird statt stillschweigend zu wirken.",
                "tags": [
                    "expense-categories"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/income-categories": {
            "get": {
                "operationId": "income-categories-list",
                "summary": "Einnahmenkategorien auflisten",
                "description": "Ruft eine paginierte Liste aller Einnahmenkategorien des Teams ab, alphabetisch sortiert.",
                "tags": [
                    "income-categories"
                ],
                "parameters": [
                    {
                        "name": "is_active",
                        "in": "query",
                        "required": false,
                        "description": "Filter: nur aktive oder nur inaktive Kategorien",
                        "schema": {
                            "type": "boolean"
                        }
                    },
                    {
                        "name": "income_group",
                        "in": "query",
                        "required": false,
                        "description": "Filter: umsatz, kapital, privat oder sonstige",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Suchbegriff im Namen",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Anzahl pro Seite (1-200, Standard: 25)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "income-categories-create",
                "summary": "Einnahmenkategorie anlegen",
                "description": "Legt eine Einnahmenkategorie an.",
                "tags": [
                    "income-categories"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Name der Kategorie"
                                    },
                                    "number": {
                                        "type": "string",
                                        "description": "Kontonummer"
                                    },
                                    "income_group": {
                                        "type": "string",
                                        "description": "umsatz, kapital, privat oder sonstige"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv (Standard: true)"
                                    }
                                },
                                "required": [
                                    "name"
                                ]
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/income-categories/{uuid}": {
            "get": {
                "operationId": "income-categories-show",
                "summary": "Einnahmenkategorie abrufen",
                "description": "Details einer Einnahmenkategorie.",
                "tags": [
                    "income-categories"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "income-categories-update",
                "summary": "Einnahmenkategorie aktualisieren",
                "description": "Ändert eine Einnahmenkategorie. Es werden nur die gesendeten Felder geändert.",
                "tags": [
                    "income-categories"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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": "Name der Kategorie"
                                    },
                                    "is_active": {
                                        "type": "boolean",
                                        "description": "Aktiv"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "income-categories-delete",
                "summary": "Einnahmenkategorie löschen",
                "description": "Antwortet mit 422: Kategorien werden deaktiviert und nicht gelöscht.",
                "tags": [
                    "income-categories"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/reports/{kind}": {
            "get": {
                "operationId": "reports-show",
                "summary": "Bericht abrufen",
                "description": "Liefert einen Bericht für den angegebenen Zeitraum. Mögliche Werte für kind: open_items (offene Posten), revenue (Rechnungsumsatz), revenue_per_client (Umsatz je Kunde), cash_flow (Einnahmen und Ausgaben nach Zahlungseingang), euer (Einnahmenüberschussrechnung) und profit_loss (Gewinn und Verlust). client_uuid ist nur bei open_items, revenue und revenue_per_client zulässig, sonst 422. Entwürfe und stornierte Rechnungen bleiben in jedem Bericht außen vor.",
                "tags": [
                    "reports"
                ],
                "parameters": [
                    {
                        "name": "kind",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "from",
                        "in": "query",
                        "required": true,
                        "description": "Beginn des Zeitraums (YYYY-MM-DD)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "to",
                        "in": "query",
                        "required": true,
                        "description": "Ende des Zeitraums (YYYY-MM-DD, nicht vor from)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "client_uuid",
                        "in": "query",
                        "required": false,
                        "description": "Auf einen Kunden einschränken",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Seite der Ergebnisliste, 50 Zeilen je Seite",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "report": "revenue",
                                        "from": "2026-01-01",
                                        "to": "2026-12-31",
                                        "basis": "invoice_date_excluding_drafts_and_cancellations",
                                        "totals": [
                                            {
                                                "currency_code": "EUR",
                                                "net_amount": 48250,
                                                "gross_amount": 57417.5,
                                                "invoice_count": 37
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/context": {
            "get": {
                "operationId": "context-show",
                "summary": "Schreibkontext abrufen",
                "description": "Liefert die Dokumentvorgaben des Teams, die Steuersätze, die Kurzform des heute geltenden Steuerprofils (tax_profile), die Funktionen mit allowed und reason (features) und je Datensatzart die vollständige Liste der schreibbaren Felder. Damit lässt sich ein gültiger Rumpf für Angebote, Rechnungen, Rechnungskorrekturen, Ausgaben, Lieferanten und Kategorien aufbauen, ohne die Feldnamen zu erraten. Verknüpfungen erscheinen unter ihren öffentlichen Namen, etwa client_uuid statt einer internen Nummer. In tax_profile stehen vat_regime und tax_residence_country nur bei bestätigtem Profil, sonst null; default_tax_rate ist der Standardsatz neuer Positionen.",
                "tags": [
                    "reports"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "defaults": {
                                            "default_currency": "EUR",
                                            "default_payment_days": 14
                                        },
                                        "tax_rates": [
                                            {
                                                "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                                "name": "Regelsatz",
                                                "rate": 19
                                            }
                                        ],
                                        "tax_profile": {
                                            "exists": true,
                                            "confirmed": true,
                                            "valid_from": "0001-01-01",
                                            "tax_residence_country": "DE",
                                            "vat_regime": "standard",
                                            "charges_german_vat": true,
                                            "is_small_business": false,
                                            "vat_return_required": true,
                                            "default_tax_rate": 19,
                                            "functional_currency": "EUR",
                                            "open_questions": []
                                        },
                                        "features": [
                                            {
                                                "key": "ai_receipt_extraction",
                                                "allowed": false,
                                                "reason": "disabled"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/tax-profile": {
            "get": {
                "operationId": "tax-profile-show",
                "summary": "Steuerprofil abrufen",
                "description": "Liefert die Version des Steuerprofils, die heute oder am Tag aus date gilt, mit ihren Ableitungen: charges_german_vat (Belege dürfen deutsche Umsatzsteuer ausweisen), is_small_business (bestätigter Kleinunternehmer nach § 19 UStG), is_registered_in_germany, allows_reverse_charge_output, input_vat_deductible, vat_return_required (Umsatzsteuer-Voranmeldung für den Zeitraum ab dem Tag), default_tax_rate (Standardsatz neuer Positionen in Prozent) und functional_currency (Buchhaltungswährung). Hat das Team noch keine Version, ist exists false und alle Ableitungen beschreiben das heutige Verhalten. Mögliche Werte: vat_regime standard, small_business oder not_registered_de; vat_basis accrual (Soll) oder cash (Ist); vat_filing_frequency monthly, quarterly oder exempt.",
                "tags": [
                    "tax-profile"
                ],
                "parameters": [
                    {
                        "name": "date",
                        "in": "query",
                        "required": false,
                        "description": "Stichtag (YYYY-MM-DD), Standard: heute",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                        "exists": true,
                                        "date": "2026-11-22",
                                        "valid_from": "0001-01-01",
                                        "valid_until": null,
                                        "confirmed": true,
                                        "source": "wizard",
                                        "tax_residence_country": "DE",
                                        "vat_regime": "small_business",
                                        "vat_basis": null,
                                        "vat_filing_frequency": null,
                                        "legal_form": "freelancer",
                                        "fiscal_year_start_month": 1,
                                        "open_questions": [],
                                        "charges_german_vat": false,
                                        "is_small_business": true,
                                        "is_registered_in_germany": true,
                                        "allows_reverse_charge_output": false,
                                        "input_vat_deductible": false,
                                        "vat_return_required": false,
                                        "default_tax_rate": 0,
                                        "functional_currency": "EUR",
                                        "revision": 3,
                                        "labels": {
                                            "vat_regime": "Kleinunternehmer (§ 19 UStG)"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/tax-profile/history": {
            "get": {
                "operationId": "tax-profile-history",
                "summary": "Verlauf des Steuerprofils",
                "description": "Liefert alle Versionen des Steuerprofils, die älteste zuerst, in derselben Form wie GET /flowaccounting/tax-profile. valid_until ist der letzte Tag einer Version, bei der jüngsten null. Zeitraumbezogene Ableitungen gelten jeweils für den ersten Tag der Version.",
                "tags": [
                    "tax-profile"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "550e8400-e29b-41d4-a716-446655440000",
                                            "valid_from": "0001-01-01",
                                            "valid_until": "2026-12-31",
                                            "vat_regime": "small_business"
                                        },
                                        {
                                            "uuid": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
                                            "valid_from": "2027-01-01",
                                            "valid_until": null,
                                            "vat_regime": "standard"
                                        }
                                    ],
                                    "meta": {
                                        "total": 2
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Fehlerantwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowaccounting/features": {
            "get": {
                "operationId": "features-index",
                "summary": "Funktionen abrufen",
                "description": "Liefert je FlowAccounting-Funktion, ob sie wirksam ist (allowed), und die einzelnen Ebenen: module_active (FlowAccounting aktiv), applicable (passt zum Steuerprofil), entitled (im Paket enthalten) und enabled (vom Team eingeschaltet). reason nennt die erste Ebene, die nicht erfüllt ist: module_inactive, not_applicable, not_entitled, disabled, sonst allowed.",
                "tags": [
                    "tax-profile"
                ],
                "responses": {
                    "200": {
                        "description": "Erfolgreiche Antwort",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "key": "ai_receipt_extraction",
                                            "label": "KI-Belegauslesung",
                                            "module_active": true,
                                            "entitled": true,
                                            "applicable": true,
                                            "enabled": false,
                                            "allowed": false,
                                            "reason": "disabled"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "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"
                    }
                }
            }
        }
    }
}