| POST | /api/sessions | Escalate: create a session (queued for a human) |
| GET | /api/sessions | List sessions (operator queue) |
| GET | /api/sessions/history | Search past sessions with duration and invoice |
| GET | /api/sessions/{id} | Get a session with its full transcript |
| PATCH | /api/sessions/{id} | Change session status (connect = billing starts, close = invoice) |
| POST | /api/sessions/{id}/messages | Send a message into a session |
| GET | /api/sessions/{id}/events | Server-Sent Events stream for a session |
| GET | /api/operators | List human operators |
| PATCH | /api/operators/status | Set an operator online/offline |
| GET | /api/schedule | Bookings, operators and availability |
| POST | /api/schedule | Book a session with an operator in advance |
| GET | /api/keys | List the signed-in user's API keys (hash never returned) |
| POST | /api/keys | Create an API key (raw key returned once, prefix cwh_live_) |
| DELETE | /api/keys/{keyId} | Revoke an API key |
| GET | /api/billing/usage | Invoices plus all-time and 30-day totals |
| POST | /api/billing/meter | Record a billing event for a session |
| GET | /api/billing/invoices/{invoiceId} | Invoice with its billing events |
| POST | /api/billing/invoices/{invoiceId}/charge | Charge an invoice to the signed-in user's saved card (Stripe) |
| GET | /api/stripe/config | Whether payments are configured (publishable key, mode) |
| GET | /api/stripe/products | Active Stripe products with their default price |
| POST | /api/stripe/create-checkout-session | Create a Stripe Checkout session (single price or cart) |
| GET | /api/stripe/session/{sessionId} | Verify a Checkout session after redirect |
| POST | /api/stripe/webhook | Stripe webhook receiver (verifies stripe-signature) |
| GET | /api/auth/{path} | better-auth GET handler (e.g. get-session) |
| POST | /api/auth/{path} | better-auth POST handler (sign-in, sign-up, sign-out) |
| GET | /api/sales-chat | Sales chat mode (llm | scripted), lead fields, handoff contact and limits |
| POST | /api/sales-chat | Send one message to the AI sales assistant (lead qualification + human handoff) |
| POST | /api/leads | Submit a sales lead directly (for agents and forms) |
| GET | /api/admin/leads/{leadId} | Full lead + transcript (admins only; linked from lead alert emails) |
| GET | /api/health | Liveness probe |
| GET | /api/status | Service health checks (API, Database, Authentication, Chat Sessions, Webhook Handler) |