Skip to main content

API Overview

The Windback API lets you manage churn events, generate recovery emails, track customer behavior, and access analytics programmatically.

Base URL

https://api.windbackai.com/api/v1
All endpoints are served over HTTPS. HTTP requests are rejected.

Authentication

Windback supports two authentication methods:

JWT Bearer Token

Used by the dashboard and web app. Obtained via login or OAuth.
Authorization: Bearer eyJhbGciOi...

API Key

Used for server-side SDK calls and API access. Pass via header.
X-API-Key: sk_live_abc123...
Never expose your secret key (sk_) in client-side code. Use the public key (pub_) for widgets and webhooks.

Endpoints

Authentication

MethodEndpointDescription
POST/auth/registerRegister a new account
POST/auth/loginLogin and receive JWT
POST/auth/googleOAuth login with Google
GET/auth/meGet current user
POST/auth/forgot-passwordRequest password reset
POST/auth/reset-passwordReset password with token

Projects

MethodEndpointDescription
POST/projectsCreate a new project
GET/projectsList all projects
GET/projects/:slugGet project by slug
PATCH/projects/:slugUpdate project settings
POST/projects/:slug/rotate-keysRotate API keys

Churn Events

MethodEndpointDescription
POST/projects/:slug/churn-eventsCreate a churn event
GET/projects/:slug/churn-eventsList churn events (paginated)
GET/projects/:slug/churn-events/:idGet a single churn event
POST/projects/:slug/churn-events/:id/recoveredMark event as recovered
PATCH/projects/:slug/churn-events/:id/cancel-reasonUpdate cancel reason

Recovery & Email Variants

MethodEndpointDescription
POST/projects/:slug/churn-events/:id/generateGenerate 9 AI recovery variants
POST/projects/:slug/churn-events/:id/variants/:vid/sendSend a variant email
PATCH/projects/:slug/churn-events/:id/variants/:vidUpdate a variant before sending
GET/projects/:slug/churn-events/:id/variantsList all variants for an event

Stats & Analytics

MethodEndpointDescription
GET/projects/:slug/statsGet project churn statistics
GET/projects/:slug/cohortsGet cohort analysis data
GET/projects/:slug/forecastingGet revenue forecasting data

Event Tracking

MethodEndpointDescription
POST/trackTrack customer behavior events

Cancel Flow

MethodEndpointDescription
POST/cancel-flow/reasonsSubmit cancel reason from widget
GET/cancel-flow/config/:publicKeyGet cancel flow configuration

Webhooks

MethodEndpointDescription
POST/webhooks/stripe/:publicKeyReceive Stripe webhook events
POST/webhooks/razorpay/:publicKeyReceive Razorpay webhook events
POST/webhooks/custom/:publicKeyReceive custom webhook events

Team & Invitations

MethodEndpointDescription
POST/projects/:slug/invitationsInvite a team member
GET/projects/:slug/membersList project members
DELETE/projects/:slug/members/:idRemove a team member
POST/invitations/:token/acceptAccept an invitation

Response Format

All API responses follow a consistent JSON format:

Success Response

{
  "data": { ... },
  "meta": {
    "page": 1,
    "per_page": 20,
    "total": 42
  }
}

Error Response

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "customer_email is required",
    "details": [
      {
        "field": "customer_email",
        "message": "This field is required"
      }
    ]
  }
}

Pagination

List endpoints support cursor-based pagination:
ParameterTypeDefaultDescription
pageinteger1Page number
per_pageinteger20Items per page (max 100)
sortstringcreated_atSort field
orderstringdescSort order: asc or desc
curl "https://api.windbackai.com/api/v1/projects/my-project/churn-events?page=2&per_page=50" \
  -H "X-API-Key: sk_live_abc123..."

Error Handling

HTTP StatusError CodeDescription
400VALIDATION_ERRORInvalid request body or parameters
401UNAUTHORIZEDMissing or invalid authentication
403FORBIDDENInsufficient permissions
404NOT_FOUNDResource not found
409CONFLICTDuplicate resource
429RATE_LIMITEDToo many requests
500INTERNAL_ERRORServer error

Rate Limits

Endpoint GroupLimit
Auth (login, register)5 req/s, burst 10
Cancel flow10 req/15s per key
Event trackingPlan-based per key
General API10 req/s, burst 30
Rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset) are included in all responses.