import { DevPortalLayout, ApiEndpoint, CodeBlock, ParameterTable, InfoBox } from '@/components/DevPortalLayout' export default function EinwilligungenApiPage() { return (

Übersicht

Die Consent Management API ermöglicht die vollständige Verwaltung von Nutzereinwilligungen (Art. 6 Abs. 1a, Art. 7 DSGVO), rechtlichen Dokumenten (Art. 13/14 DSGVO) und Cookie-Banner-Konfigurationen (TTDSG § 25).

Alle Endpoints erfordern den Header X-Tenant-ID mit Ihrer Tenant-ID. Ohne diesen Header erhalten Sie einen 400-Fehler. {/* ===================================================================== */} {/* Consent Management */} {/* ===================================================================== */}

Consent Management

Verwalten Sie Einwilligungsnachweise granular nach Nutzer und Datenpunkt. Jede Einwilligung wird mit vollständiger Änderungshistorie protokolliert.

GET /einwilligungen/consents

Gibt eine paginierte Liste aller Einwilligungen zurück.

Query-Parameter

{`curl -X GET "https://api.breakpilot.io/sdk/v1/einwilligungen/consents?limit=50&offset=0" \\ -H "Authorization: Bearer YOUR_API_KEY" \\ -H "X-Tenant-ID: your-tenant-id"`} {`{ "total": 1234, "offset": 0, "limit": 50, "consents": [ { "id": "uuid", "tenant_id": "your-tenant-id", "user_id": "nutzer@beispiel.de", "data_point_id": "dp_analytics", "granted": true, "granted_at": "2024-01-15T10:30:00Z", "revoked_at": null, "consent_version": "v1.2", "source": "web_banner", "ip_address": "192.168.1.1", "user_agent": "Mozilla/5.0...", "created_at": "2024-01-15T10:30:00Z", "history": [ { "id": "uuid", "action": "granted", "consent_version": "v1.2", "ip_address": "192.168.1.1", "user_agent": "Mozilla/5.0...", "source": "web_banner", "created_at": "2024-01-15T10:30:00Z" } ] } ] }`}

POST /einwilligungen/consents

Erfasst eine neue Einwilligung. Erstellt automatisch einen History-Eintrag mit action="granted".

{`curl -X POST "https://api.breakpilot.io/sdk/v1/einwilligungen/consents" \\ -H "Authorization: Bearer YOUR_API_KEY" \\ -H "X-Tenant-ID: your-tenant-id" \\ -H "Content-Type: application/json" \\ -d '{ "user_id": "nutzer@beispiel.de", "data_point_id": "dp_analytics", "granted": true, "consent_version": "v1.2", "source": "web_banner", "ip_address": "192.168.1.1" }'`} {`{ "success": true, "id": "uuid", "user_id": "nutzer@beispiel.de", "data_point_id": "dp_analytics", "granted": true, "granted_at": "2024-01-15T10:30:00Z" }`}

PUT /einwilligungen/consents/{'{id}'}/revoke

Widerruft eine aktive Einwilligung. Setzt revoked_at auf den aktuellen Zeitstempel und erstellt einen History-Eintrag mit action="revoked".

Ein Widerruf kann nicht rückgängig gemacht werden. Für eine neue Einwilligung muss ein neuer POST-Request gesendet werden. {`curl -X PUT "https://api.breakpilot.io/sdk/v1/einwilligungen/consents/CONSENT_ID/revoke" \\ -H "Authorization: Bearer YOUR_API_KEY" \\ -H "X-Tenant-ID: your-tenant-id"`} {`{ "success": true, "id": "uuid", "revoked_at": "2024-02-01T14:00:00Z" }`}

GET /einwilligungen/consents/{'{id}'}/history

Gibt die vollständige Änderungshistorie einer Einwilligung zurück. Alle Aktionen (granted, revoked, version_update, renewed) werden chronologisch aufgelistet.

{`curl -X GET "https://api.breakpilot.io/sdk/v1/einwilligungen/consents/CONSENT_ID/history" \\ -H "Authorization: Bearer YOUR_API_KEY" \\ -H "X-Tenant-ID: your-tenant-id"`} {`[ { "id": "uuid", "consent_id": "uuid", "action": "granted", "consent_version": "v1.0", "ip_address": "192.168.1.1", "user_agent": "Mozilla/5.0...", "source": "web_banner", "created_at": "2024-01-15T10:30:00Z" }, { "id": "uuid", "consent_id": "uuid", "action": "revoked", "consent_version": "v1.0", "ip_address": null, "user_agent": null, "source": null, "created_at": "2024-02-01T14:00:00Z" } ]`}

GET /einwilligungen/consents/stats

Gibt Statistiken über alle Einwilligungen des Tenants zurück.

{`{ "total_consents": 1234, "active_consents": 1100, "revoked_consents": 134, "unique_users": 800, "conversion_rate": 89.2, "by_data_point": { "dp_analytics": { "total": 600, "active": 550, "revoked": 50 }, "dp_marketing": { "total": 634, "active": 550, "revoked": 84 } } }`} {/* ===================================================================== */} {/* Legal Documents */} {/* ===================================================================== */}

Legal Documents API

Verwalten Sie rechtliche Dokumente (Datenschutzerklärung, AGB, Cookie-Richtlinie, Impressum, AVV) mit vollständigem Versionierungs- und Freigabe-Workflow.

Frontend-Proxy: /api/admin/consent/*backend:8002/api/compliance/legal-documents/*

GET /legal-documents/documents

Gibt alle rechtlichen Dokumente des Tenants zurück.

{`curl -X GET "https://api.breakpilot.io/sdk/v1/legal-documents/documents" \\ -H "Authorization: Bearer YOUR_API_KEY" \\ -H "X-Tenant-ID: your-tenant-id"`}

POST /legal-documents/documents

Legt ein neues rechtliches Dokument an (initial als Entwurf).

GET /legal-documents/documents/{'{id}'}/versions

Gibt alle Versionen eines Dokuments zurück.

Dieser Endpoint gibt ein direktes JSON-Array zurück, nicht ein Objekt mit versions-Key. Frontend-Code muss Array.isArray(data) ? data : (data.versions || []) prüfen. {`[ { "id": "uuid", "document_id": "uuid", "version_number": 3, "title": "Datenschutzerklärung v3", "status": "published", "created_at": "2024-01-20T14:00:00Z", "published_at": "2024-01-21T09:00:00Z" } ]`}

POST /legal-documents/versions/{'{id}'}/publish

Veröffentlicht eine freigegebene Version. Status muss "approved" sein.

{/* ===================================================================== */} {/* Cookie Banner */} {/* ===================================================================== */}

Cookie Banner API

Konfigurieren Sie den Cookie-Banner für Ihre Anwendung. Die Konfiguration wird in der Datenbank persistiert und überlebt Container-Neustarts.

GET /einwilligungen/cookies

Lädt die Cookie-Banner-Konfiguration des Tenants.

{`curl -X GET "https://api.breakpilot.io/sdk/v1/einwilligungen/cookies" \\ -H "Authorization: Bearer YOUR_API_KEY" \\ -H "X-Tenant-ID: your-tenant-id"`} {`{ "tenant_id": "your-tenant-id", "categories": [ { "id": "necessary", "name": "Notwendig", "isRequired": true, "defaultEnabled": true }, { "id": "analytics", "name": "Analyse", "isRequired": false, "defaultEnabled": false } ], "config": { "position": "bottom", "style": "bar", "primaryColor": "#6366f1", "showDeclineAll": true, "showSettings": true, "banner_texts": { "title": "Wir verwenden Cookies", "description": "Wir nutzen Cookies, um unsere Website zu verbessern.", "privacyLink": "/datenschutz" } }, "updated_at": "2024-01-15T10:30:00Z" }`}

PUT /einwilligungen/cookies

Speichert die Cookie-Banner-Konfiguration (Upsert). Alle Felder werden vollständig überschrieben.

{`curl -X PUT "https://api.breakpilot.io/sdk/v1/einwilligungen/cookies" \\ -H "Authorization: Bearer YOUR_API_KEY" \\ -H "X-Tenant-ID: your-tenant-id" \\ -H "Content-Type: application/json" \\ -d '{ "categories": [ { "id": "necessary", "name": "Notwendig", "isRequired": true, "defaultEnabled": true } ], "config": { "position": "bottom", "style": "bar", "primaryColor": "#6366f1", "banner_texts": { "title": "Wir verwenden Cookies", "description": "...", "privacyLink": "/datenschutz" } } }'`}
) }