API Reference

Comprehensive documentation for the ChurnShield API endpoints.

Authentication

All API requests require authentication using an API key.

Getting your API Key

  1. Log in to your ChurnShield account
  2. Navigate to Settings → API Keys
  3. Click on "Generate New API Key"
  4. Copy your API key and store it securely

⚠️ Keep your API keys secure and never expose them in client-side code or public repositories.

Using your API Key

Include your API key in the Authorization header of all requests:

Authorization: Bearer YOUR_API_KEY

Customers

GET /api/customers

Returns a list of all customers.

Example Response:

{
  "customers": [
    {
      "id": "cust_123",
      "name": "Acme Inc",
      "email": "contact@acme.com",
      "status": "active",
      "health_score": 85,
      "created_at": "2023-01-15T00:00:00Z"
    },
    {
      "id": "cust_456",
      "name": "Example Corp",
      "email": "info@example.com",
      "status": "at_risk",
      "health_score": 65,
      "created_at": "2023-03-22T00:00:00Z"
    }
  ]
}

Health Scores

GET /api/customers/{id}/health

Returns the health score and related metrics for a specific customer.

Example Response:

{
  "customer_id": "cust_123",
  "health_score": 85,
  "indicators": {
    "engagement": 92,
    "support": 78,
    "billing": 90
  },
  "risk_factors": [],
  "updated_at": "2023-06-10T15:30:00Z"
}