Customer Churn Prediction REST API

ML-powered Vorhersage von Kundenabwanderung mit Scoring (0-100) und gezielten Retention-Strategien.

📡 REST API ⚡ HTTP POST 🤖 Machine Learning 🔐 Bearer Auth

📡 Endpunkt

POST /api/business-intelligence/churn-prediction

🎯 Scoring

0-100 Punkte

⚡ Response

200-500ms

🔐 Auth

Bearer Token

REST API Übersicht

HTTP Endpunkt

POST https://api.cernion.de/api/business-intelligence/churn-prediction

Authentication

Authorization: Bearer YOUR_API_TOKEN

Request Body

Parameter Typ Required Beschreibung
customerSegment string ✅ Ja residential, prosumer, commercial, premium, all
region string ✅ Ja Region/PLZ (z.B. "Bayern", "80331")
riskThreshold string ❌ Nein high (80-100), medium (60-80), low (40-60)
limit number ❌ Nein Max. Ergebnisse (1-500, default: 100)
predictionWindowMonths number ❌ Nein Zeitfenster 1-12 Monate (default: 3)
includeRetentionStrategy boolean ❌ Nein Retention-Empfehlungen inkludieren (default: true)

Beispiel Request

{
  "customerSegment": "prosumer",
  "region": "Bayern",
  "riskThreshold": "high",
  "limit": 50,
  "predictionWindowMonths": 3,
  "includeRetentionStrategy": true,
  "includeValueSegmentation": true
}

Response Schema

{
  "success": true,
  "data": {
    "segment": "prosumer",
    "region": "Bayern",
    "predictionWindow": "3 months",
    "totalCustomers": 1250,
    "atRiskCustomers": 87,
    "churnRate": "6.96%",
    "customers": [
      {
        "customerId": "CUST_123456",
        "churnScore": 92,
        "riskLevel": "HIGH",
        "segment": "prosumer",
        "contractEndDate": "2026-05-15",
        "daysUntilEnd": 97,
        "arpu": 1450,
        "ltv": 10000,
        "churnReasons": [
          {
            "reason": "contract_ending",
            "weight": 30,
            "details": "Contract ends in 97 days (critical window)"
          },
          {
            "reason": "price_sensitivity",
            "weight": 25,
            "details": "12% above market, recent price increase"
          },
          {
            "reason": "service_quality",
            "weight": 20,
            "details": "6 support contacts, NPS Detractor (4/10)"
          }
        ],
        "retentionStrategy": {
          "priority": "URGENT",
          "budget": 2000,
          "actions": [
            {
              "type": "personal_call",
              "timing": "immediate",
              "message": "Personal retention call within 24h"
            },
            {
              "type": "price_guarantee",
              "timing": "immediate",
              "offer": "Lock current rate for 24 months"
            },
            {
              "type": "premium_upgrade",
              "timing": "follow_up",
              "offer": "Free smart meter + dynamic tariff"
            }
          ],
          "expectedSuccessRate": "60%",
          "roi": "19.3x (2000€ cost saves 29k€ LTV)"
        }
      }
    ],
    "statistics": {
      "highRisk": 87,
      "mediumRisk": 143,
      "lowRisk": 89,
      "avgChurnScore": 71.5,
      "totalAtRiskRevenue": "126,150€"
    }
  }
}

Code-Beispiele

cURL Beispiel

curl -X POST https://api.cernion.de/api/business-intelligence/churn-prediction \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "customerSegment": "prosumer",
    "region": "Bayern",
    "riskThreshold": "high",
    "limit": 50,
    "includeRetentionStrategy": true
  }'

JavaScript/Node.js Beispiel

const API_TOKEN = 'YOUR_API_TOKEN';

async function predictChurn() {
  const response = await fetch(
    'https://api.cernion.de/api/business-intelligence/churn-prediction',
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${API_TOKEN}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        customerSegment: 'prosumer',
        region: 'Bayern',
        riskThreshold: 'high',
        limit: 50,
        includeRetentionStrategy: true
      })
    }
  );
  
  const data = await response.json();
  
  console.log(`At-Risk Customers: ${data.data.atRiskCustomers}`);
  console.log(`Total Revenue at Risk: ${data.data.statistics.totalAtRiskRevenue}`);
  
  // High-Priority Customers
  const urgentCases = data.data.customers.filter(
    c => c.retentionStrategy.priority === 'URGENT'
  );
  
  console.log(`\\nUrgent Cases: ${urgentCases.length}`);
  urgentCases.forEach(customer => {
    console.log(`- ${customer.customerId}: Score ${customer.churnScore}, LTV ${customer.ltv}€`);
    console.log(`  Actions: ${customer.retentionStrategy.actions.map(a => a.type).join(', ')}`);
  });
  
  return data;
}

predictChurn();

Python Beispiel

import requests
import pandas as pd

API_TOKEN = 'YOUR_API_TOKEN'

def predict_churn(segment='prosumer', region='Bayern'):
    """Churn prediction with retention planning"""
    response = requests.post(
        'https://api.cernion.de/api/business-intelligence/churn-prediction',
        headers={
            'Authorization': f'Bearer {API_TOKEN}',
            'Content-Type': 'application/json'
        },
        json={
            'customerSegment': segment,
            'region': region,
            'riskThreshold': 'high',
            'limit': 100,
            'includeRetentionStrategy': True,
            'includeValueSegmentation': True
        }
    )
    
    data = response.json()['data']
    
    # Convert to DataFrame for analysis
    customers_df = pd.DataFrame(data['customers'])
    
    print(f'\\nChurn Prediction Results:')
    print(f'Total Customers: {data["totalCustomers"]}')
    print(f'At Risk: {data["atRiskCustomers"]} ({data["churnRate"]})')
    print(f'Revenue at Risk: {data["statistics"]["totalAtRiskRevenue"]}\\n')
    
    # High-Priority Actions
    urgent = customers_df[
        customers_df['retentionStrategy'].apply(lambda x: x['priority'] == 'URGENT')
    ]
    
    print(f'Urgent Actions Required: {len(urgent)} customers')
    print(f'Average Churn Score: {urgent["churnScore"].mean():.1f}')
    print(f'Total LTV at Risk: {urgent["ltv"].sum():,}€\\n')
    
    # Retention Budget
    total_budget = sum(c['retentionStrategy']['budget'] for c in data['customers'])
    total_ltv = sum(c['ltv'] for c in data['customers'])
    roi = total_ltv / total_budget if total_budget > 0 else 0
    
    print(f'Retention Investment:')
    print(f'Budget Required: {total_budget:,}€')
    print(f'LTV Protected: {total_ltv:,}€')
    print(f'ROI: {roi:.1f}x')
    
    return data

if __name__ == '__main__':
    result = predict_churn(segment='prosumer', region='Bayern')

Anwendungsfälle

🎯 Proactive Retention

3-6 Monate vor Vertragsende High-Risk Kunden identifizieren und gezielt ansprechen (60% Erfolgsquote)

💰 Budget-Optimierung

Retention-Budget nach Segment priorisieren: Prosumer (2k€), Commercial (unbegrenzt), Residential (200€)

📊 LTV Protection

Prosumer-Segment schützen (LTV 10k€, ARPU 1.450€) durch personalisierte Retention-Kampagnen

🤖 Automated Campaigns

Automatisierte E-Mail-Kampagnen für Medium-Risk (60-80) mit Incentives bis 100€

ML-Scoring System & Best Practices

Scoring-Komponenten (0-100 Punkte)

Faktor Gewicht Beschreibung
Contract Status 30 Punkte <3 Monate bis Vertragsende = CRITICAL (30 Punkte)
Price Sensitivity 25 Punkte Preisbeschwerden, >10% über Markt, Konkurrenz-Vergleich
Service Quality 20 Punkte >5 Support-Kontakte, NPS Detractor (<6), negative Feedbacks
Payment Behavior 15 Punkte >2 verspätete Zahlungen, Zahlungsmethode gewechselt
Usage Pattern 10 Punkte Verbrauch >20% gesunken, keine App-Nutzung (3+ Monate)

🎯 Risk-Level Thresholds

  • HIGH (80-100): Sofortiger persönlicher Anruf + Retention-Offer (max 200€ residential, 2k€ prosumer)
  • MEDIUM (60-80): Automatisierte E-Mail-Kampagne + Incentive (max 100€)
  • LOW (40-60): Proaktives Engagement (Loyalty-Programm, App-Aktivierung)

💼 Segment-spezifische Strategien

  • Prosumer: ARPU 1.450€, LTV 10k€ → Budget 2k€, High-Touch
  • Commercial: ARPU 10k€, LTV 50k€ → Budget unbegrenzt, Strategic Account Management
  • Residential: ARPU 600€, LTV 3k€ → Budget 200€, Automatisiert
  • Premium: ARPU >5k€, LTV >25k€ → VIP-Treatment

📈 ROI Metriken

  • Typische Retention-Kosten: 150-2.000€ je nach Segment
  • Erfolgsquote mit proaktiver Intervention: 40-60%
  • Prosumer ROI: 19.3x (1.500€ spart 29k€ LTV)
  • Commercial ROI: 33x+ (unbegrenzter ROI für strategische Accounts)

⏰ Timing-Empfehlungen

  • 3-6 Monate vor Ende: Ideales Interventionsfenster
  • 1 Monat vor Ende: Zu spät! Kunde bereits entschieden
  • Tägliche Updates: Für High-Risk Commercial Accounts
  • Wöchentliche Updates: Für Prosumer & Residential

ROI durch Churn Prevention

Segment Churn-Rate ohne API Churn-Rate mit API Kunden gerettet/Jahr LTV-Schutz/Jahr
Residential (10.000 Kunden) 12% 7% 500 Kunden 1,5 Mio. € (500 × 3k€)
Prosumer (1.500 Kunden) 8% 4% 60 Kunden 600.000€ (60 × 10k€)
Commercial (200 Kunden) 5% 2% 6 Kunden 300.000€ (6 × 50k€)
Gesamt — 2,4 Mio. € LTV geschützt

💡 Retention-Investment: 250k€/Jahr (500 Kunden × 500€ Durchschnitt) = ROI 9.6x

Häufig gestellte Fragen (FAQ)

Wie wird der Churn Score berechnet?

ML-Modell mit 5 Faktoren: Contract Status (30 Punkte), Price Sensitivity (25), Service Quality (20), Payment Behavior (15), Usage Pattern (10). Training auf 50.000+ echten Churn-Cases deutscher Stadtwerke.

Wie aktuell sind die Predictions?

Echtzeit-Scoring basierend auf aktuellen Kundendaten. Empfehlung: Wöchentliche Updates für High-Risk Segments, monatlich für Residential.

Welche Daten benötige ich für optimale Predictions?

Mindestens: Contract End Date, ARPU, Support Contacts. Optional: NPS Score, Payment History, App Usage, Price Complaints → Je mehr Daten, desto präziser das Scoring.

Kann ich eigene Retention-Strategien definieren?

Ja, im Business Tier. Konfigurieren Sie Budgets, Actions und Timing pro Segment. API gibt dann angepasste Empfehlungen basierend auf Ihren Richtlinien.

Wie unterscheiden sich die Segmente?

Residential: ARPU 600€, Budget 200€, automatisiert. Prosumer: ARPU 1.450€, Budget 2k€, High-Touch. Commercial: ARPU 10k€, unbegrenzt, Strategic Account Management.

Was ist die typische Erfolgsquote?

Mit 3-6 Monaten Lead Time: 40-60% Retention-Erfolg. Prosumer-Segment erreicht 60%, Residential 40-45%. Mit 1 Monat Lead Time nur 15-20% (zu spät!).

LTV schützen mit ML-powered Churn Prevention

Prosumer-Segment allein rechtfertigt API-Investment: 60 gerettete Kunden = 600k€ LTV geschützt

Durchschnittliche Setup-Zeit: 5 Minuten. Erste Vorhersagen nach wenigen Minuten.