API Reference

Integrate churn prediction into your app

Authentication

All API requests require a Bearer token. Get your API key from Settings → API Keys.

Authorization: Bearer cg_live_your_api_key_here

POST /api/v1/predict

Get a churn prediction for a customer.

Request Body

{
  "customer_id": "cust_123",
  "signals": {
    "days_since_login": 14,
    "login_count_last_30": 3,
    "login_count_prev_30": 15,
    "payment_failed": false,
    "plan_downgraded": false,
    "support_tickets_open": 2,
    "nps_score": 6,
    "feature_count_used": 3,
    "mrr": 99,
    "account_age_days": 180
  }
}

Response

{
  "customer_id": "cust_123",
  "score": 72,
  "risk_level": "high",
  "top_reasons": [
    "Login frequency dropped >50%",
    "2 unresolved support tickets"
  ],
  "recommended_action": "Schedule a call",
  "confidence": 80,
  "scored_at": "2024-04-13T10:30:00Z"
}

Code Examples

curl

curl -X POST https://exeechain.com/api/v1/predict \
  -H "Authorization: Bearer cg_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{"customer_id":"cust_123","signals":{"days_since_login":14}}'

JavaScript

const res = await fetch('/api/v1/predict', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer cg_live_xxx',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    customer_id: 'cust_123',
    signals: { days_since_login: 14 }
  })
});
const prediction = await res.json();

Python

import requests

res = requests.post(
    'https://exeechain.com/api/v1/predict',
    headers={'Authorization': 'Bearer cg_live_xxx'},
    json={
        'customer_id': 'cust_123',
        'signals': {'days_since_login': 14}
    }
)
prediction = res.json()

POST /api/v1/track

Track customer events (logins, feature usage, page views).

curl -X POST https://exeechain.com/api/v1/track \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "cg_live_xxx",
    "customer_id": "cust_123",
    "event": "login",
    "properties": { "source": "web" },
    "timestamp": "2026-04-28T10:30:00Z"
  }'

POST /api/v1/goal-progress

Report progress toward a customer's success goal. Exeechain recalculates progress, value gap, and goal status.

curl -X POST https://exeechain.com/api/v1/goal-progress \
  -H "Authorization: Bearer cg_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "customer_id": "cust_123",
    "metric_value": 8.2,
    "note": "Monthly churn rate for March"
  }'

Response includes progress_percent, value_gap, status, trajectory, and days_to_goal.

Rate Limits

EndpointLimit
/api/v1/track1,000 req/min per API key
/api/v1/predict100 req/min per API key
All other endpoints100 req/min per user

Error Codes

CodeMeaning
400Bad request — missing or invalid parameters
401Unauthorized — invalid API key
402Payment required — plan limit exceeded
429Too many requests — rate limit exceeded
500Internal server error