Client Rescue AI

API Documentation & Integration Guide

Powered by GPT-4o for intelligent churn prediction and client rescue

🚀 Quick Start Guide

Get started with AI-powered client rescue in 3 simple steps:

1
Get Your API Key

Contact our team to receive your authentication token and start accessing our AI-powered endpoints

2
Make Your First Request

Use our core /api/v1/churn-risk endpoint to analyze client data

3
Integrate & Automate

Build client rescue automation into your workflow and start saving revenue

🔐 Authentication

All API requests require authentication using Bearer tokens. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY_HERE
⚠️ API Key Required: Contact our support team to obtain your API key for accessing protected endpoints. See pricing section for rate limits by tier.

🔑 API Key Request Process

1. Contact our team with your use case and expected volume

2. Receive your unique API key and usage guidelines

3. Start making authenticated requests to all endpoints

⭐ Core Churn Risk Analysis

Our primary endpoint combines GPT-4o intelligence with multi-factor analysis to predict client churn probability and recommend specific rescue actions.

POST /api/v1/churn-risk PRIMARY

Intelligent churn prediction with GPT-4o analysis. Processes client messages, payment history, and response patterns to generate comprehensive risk assessment.

🔒 Authentication required

📥 Request Body:

{
  "client_id": "12345",
  "messages": [
    "I am very frustrated with the recent changes to your service",
    "This is completely unacceptable and I am considering switching"
  ],
  "payments": [true, false, true],
  "response_times": [24, 48, 72]
}

📤 Response:

{
  "client_id": "12345",
  "churn_probability": 85,
  "risk_factors": {
    "emotion": "High frustration and dissatisfaction with service changes",
    "behavior": "Delayed response time indicates potential disengagement", 
    "payment": "Missed payment suggests financial instability or dissatisfaction"
  },
  "rescue_urgency": "High",
  "recommended_action": "Immediately reach out to the client with a personalized apology and offer a solution or incentive to address their concerns and retain their business.",
  "analysis_timestamp": "2025-06-29T22:23:30.209Z",
  "confidence_score": 0.9
}

🧠 GPT-4o Analysis

Advanced natural language understanding processes client communications for emotional patterns and churn indicators.

📊 Multi-Factor Scoring

Combines sentiment (40%), response times (30%), and payment history (30%) for accurate predictions.

🎯 Actionable Insights

Specific rescue actions tailored to risk level: Low/Medium/High/Critical urgency classification.

🔍 Confidence Metrics

AI-generated confidence scores (0-1) help you prioritize interventions and trust predictions.

🔗 All API Endpoints

GET /api/health

Check service health and availability. No authentication required.

Response:

{
  "status": "healthy",
  "timestamp": "2025-06-29T22:00:00.000Z",
  "uptime": 3600
}

GET /api/status

Get service status and configuration information. No authentication required.

Response:

{
  "api": "operational",
  "services": {
    "openai": "configured",
    "stripe": "configured"
  },
  "timestamp": "2025-06-29T22:00:00.000Z"
}

POST /api/analyze/sentiment

Analyze sentiment of client communications with GPT-4o confidence scoring.

🔒 Authentication required

Request Body:

{
  "content": "I am really happy with your service and would recommend it to others"
}

Response:

{
  "success": true,
  "analysis": {
    "sentiment": "positive",
    "score": 95,
    "confidence": 0.95,
    "keywords": ["happy", "recommend", "service"],
    "riskFactors": []
  },
  "timestamp": "2025-06-29T22:00:00.000Z"
}

POST /api/generate/response

Generate personalized responses for client rescue situations using GPT-4o.

🔒 Authentication required

Request Body:

{
  "clientName": "John Smith",
  "riskLevel": "high",
  "reasons": ["missed payments", "delayed responses"],
  "context": "Client has been unresponsive lately"
}

Response:

{
  "success": true,
  "response": {
    "subject": "Urgent: Let's Resolve Your Account Concerns Together",
    "content": "Dear John,\n\nI hope this message finds you well. I've noticed that we've missed connecting recently, and I wanted to reach out personally to address any concerns you might have...",
    "tone": "Empathetic and resolution-focused",
    "urgency": "high"
  },
  "timestamp": "2025-06-29T22:00:00.000Z"
}

GET /api/usage

Get API usage statistics and rate limiting information.

🔒 Authentication required

Response:

{
  "user": "api-user@clientrescue.ai",
  "tier": "starter",
  "requests_today": 142,
  "rate_limit": 5000,
  "remaining": 4858,
  "reset_time": "2025-06-30T22:00:00.000Z"
}

📦 Official Client Libraries

Use our official SDKs for faster integration and better developer experience:

🐍 Python SDK

pip install client-rescue-ai

Full type hints, dataclasses, and comprehensive error handling. Supports Python 3.7+.

GitHub: View Source

🟢 Node.js SDK

npm install client-rescue-ai

TypeScript definitions, Promise-based API, and ESM support. Supports Node.js 14+.

GitHub: View Source

Quick Example with SDKs

Python

from client_rescue_ai import ClientRescueAI

client = ClientRescueAI('your-api-key')
result = client.analyze_churn_risk(
    client_id='12345',
    messages=['I\'m frustrated with recent changes'],
    payments=[True, False, True],
    response_times=[24, 48, 72]
)

print(f"Churn Probability: {result.churn_probability}%")
print(f"Action: {result.recommended_action}")

Node.js

const { ClientRescueAI } = require('client-rescue-ai');

const client = new ClientRescueAI('your-api-key');
const result = await client.analyzeChurnRisk({
  clientId: '12345',
  messages: ['I\'m frustrated with recent changes'],
  payments: [true, false, true],
  responseTimes: [24, 48, 72]
});

console.log(`Churn Probability: ${result.churnProbability}%`);
console.log(`Action: ${result.recommendedAction}`);

💻 Raw API Examples

JavaScript/Node.js

// Core churn risk analysis
const response = await fetch('/api/v1/churn-risk', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    client_id: '12345',
    messages: [
      'I am frustrated with the recent changes',
      'Considering switching to a competitor'
    ],
    payments: [true, false, true],
    response_times: [24, 48, 72]
  })
});

const analysis = await response.json();
console.log(`Churn Probability: ${analysis.churn_probability}%`);
console.log(`Urgency: ${analysis.rescue_urgency}`);
console.log(`Action: ${analysis.recommended_action}`);
console.log(`Confidence: ${analysis.confidence_score}`);

Python

import requests

# Churn risk analysis with Python
response = requests.post('/api/v1/churn-risk', 
  headers={
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  json={
    'client_id': '12345',
    'messages': [
      'Very disappointed with recent service changes',
      'Looking at other options now'
    ],
    'payments': [True, False, True],
    'response_times': [24, 48, 72]
  }
)

analysis = response.json()
print(f"Churn Probability: {analysis['churn_probability']}%")
print(f"Urgency Level: {analysis['rescue_urgency']}")
print(f"Recommended Action: {analysis['recommended_action']}")

# Check confidence level
if analysis['confidence_score'] > 0.8:
    print("High confidence prediction - take immediate action!")
else:
    print("Medium confidence - monitor closely")

cURL

curl -X POST /api/v1/churn-risk \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "client_id": "12345",
    "messages": [
      "Very frustrated with the recent changes",
      "This is completely unacceptable"
    ],
    "payments": [true, false, true],
    "response_times": [24, 48, 72]
  }' | jq .

🔧 Integration Tips

  • Always include client_id for tracking and analytics
  • Provide recent messages (last 7-30 days) for accurate sentiment analysis
  • Include comprehensive payment history for better predictions
  • Monitor confidence_score - values above 0.8 indicate high reliability
  • Implement proper error handling for all API requests
  • Consider caching results for 1-2 hours to optimize API usage

💰 Pricing & Plans

Dev/Test

Free
  • ✓ 5 AI sentiment scans
  • ✓ Up to 5 clients
  • ✓ Basic churn scoring
  • ✓ Email support
Perfect for testing, trials, and MVP integration.
Most Popular

🔸 Starter

$149/month
  • ✓ 5,000 scans/month
  • ✓ Up to 100 clients
  • ✓ Full churn scoring engine
  • ✓ AI response generation
  • ✓ Sentiment & urgency mapping
  • ✓ Email support
For early-stage platforms who want client rescue without building their own AI stack.

🔶 Growth

$399/month
  • ✓ 25,000 scans/month
  • ✓ Unlimited clients
  • ✓ Revenue impact tracking
  • ✓ Advanced risk breakdowns
  • ✓ CRM-ready response formatting
  • ✓ Priority support
Best for scaling SaaS teams who need emotional intelligence in every retention decision.

🔷 Enterprise

$999+/month
  • ✓ Everything in Growth
  • ✓ Custom integrations
  • ✓ Dedicated onboarding
  • ✓ White-label option
  • ✓ SLA-backed support
For platforms that treat retention as infrastructure.

📋 Plan Comparison

Feature Dev/Test Starter Growth Enterprise
Monthly Scans 5 5,000 25,000 Unlimited
Client Limit 5 100 Unlimited Unlimited
API Response Time Standard Optimized Priority Dedicated
Support Level Email Email Priority SLA-backed

🛠️ Support & Resources

📞 Getting Help

  • API Key Requests: Contact our team for authentication credentials
  • Technical Support: Integration assistance available
  • Rate Limits: Dev/Test: 5 requests/day | Starter: 5,000/month | Growth: 25,000/month
  • Response Times: Typical API response: 1-3 seconds

⚡ Performance

  • GPT-4o Speed: Optimized prompts for fast responses
  • Reliability: 99.9% uptime SLA
  • Scalability: Auto-scaling infrastructure
  • Global CDN: Low-latency worldwide access

🔒 Security

  • Encryption: TLS 1.3 for all API communications
  • API Keys: Secure token-based authentication
  • Data Privacy: No client data stored permanently
  • Compliance: SOC 2 Type II certified

📊 Monitoring

  • Usage Tracking: Real-time request monitoring
  • Error Reporting: Detailed error messages
  • Health Checks: Service status monitoring
  • Analytics: Usage patterns and insights

HTTP Status Codes

  • 200 - Success (request processed successfully)
  • 400 - Bad Request (missing required fields like client_id)
  • 401 - Unauthorized (invalid or missing API key)
  • 404 - Endpoint not found (check URL spelling)
  • 429 - Rate limit exceeded (wait before retrying)
  • 500 - Internal server error (contact support)

🚀 Ready to Start?

Get started quickly with our official client libraries:

  • Python SDK: pip install client-rescue-ai
  • Node.js SDK: npm install client-rescue-ai
  • GitHub: Open Source Libraries

Contact our team to get your API key and start building intelligent client rescue automation. Our GPT-4o powered platform helps you identify at-risk clients before they churn and provides specific actions to retain them.

Average ROI: 300%+ through improved client retention