API
The API surface covers health checks, auth, analytics, contact, billing, webhooks, waitlist, scheduler, cron, and admin billing tasks.
| Category | Method | Path | Authentication | Purpose | Important behavior |
|---|---|---|---|---|---|
| Health | GET | /api/health/ready | Public | Database readiness probe. | Checks the server database dependency and fails when it is unavailable. |
| Auth | GET | /api/auth/me | Supabase session | Return the current authenticated profile. | No-store identity read; fail closed when no active profile exists. |
| Analytics | GET | /api/analytics/platform/range | Session + insights access | Load platform metrics for a bounded range. | Validates date range, masks sensitive values by permission, and returns no-store data. |
| Analytics | GET | /api/analytics/revenue/range | Session + insights access | Load revenue metrics for a bounded range. | Validates date range, masks sensitive values by permission, and returns no-store data. |
| Billing | POST | /api/billing/checkout | Supabase session | Create a provider checkout session. | Validates catalog-owned selection and rate-limits provider session creation. |
| Billing | POST | /api/billing/portal | Supabase session | Create a customer portal session. | Resolves the signed-in billing customer and rate-limits provider calls. |
| Billing | GET | /api/billing/status | Supabase session | Return customer billing status. | Reads account-owned local billing projection and provider readiness. |
| Contact | POST | /api/contact | Public or session-aware | Validate, rate-limit, and store a contact message. | Normalizes input, enforces abuse controls, persists the message, and queues notification work. |
| Cron | GET | /api/cron/data-retention | CRON_SECRET bearer | Run protected operational cleanup. | Rejects invalid secrets and deletes bounded batches according to retention policy. |
| Cron | GET | /api/cron/notification-outbox | CRON_SECRET bearer | Process a protected notification batch. | Atomically claims bounded work, retries transient failures, and exposes dead letters. |
| Notifications | POST | /api/notifications/webhooks/resend | Resend signature | Apply verified Resend delivery updates. | Verifies before processing and applies provider delivery state to local records. |
| Scheduler | POST | /api/scheduler/publish | CRON_SECRET bearer | Publish scheduled content. | Publishes a bounded eligible set and rejects unsupported scheduler calls. |
| Billing admin | POST | /api/system/billing/customers/[providerCustomerId]/sync | Session + billing operations | Refresh supported provider customer state. | Validates provider customer identity and performs a guarded provider sync. |
| Billing admin | GET | /api/system/billing/export | Session + billing operations | Export guarded billing records. | Rate-limits, bounds, filters, and spreadsheet-sanitizes financial exports. |
| Billing admin | POST | /api/system/billing/refunds | Session + billing operations | Create a guarded provider refund. | Validates amount and provider capability; records auditable financial action. |
| Billing admin | PATCH | /api/system/billing/subscriptions/[providerSubscriptionId] | Session + billing operations | Apply a guarded subscription operation. | Validates operation and provider subscription identity before mutation. |
| Waitlist | GET | /api/waitlist/confirm | Public signed token | Confirm a double-opt-in token. | Rate-limits and consumes a validated confirmation token without exposing signup data. |
| Waitlist | GET | /api/waitlist/export | Session + waitlist operations | Export guarded waitlist records. | Rate-limits, bounds, and spreadsheet-sanitizes personal-data export. |
| Waitlist | POST | /api/waitlist/signup | Public | Validate and store a public signup. | Rate-limits, handles duplicate signup state, and queues configured follow-up. |
| Webhooks | POST | /api/webhooks/lemonsqueezy | Lemon Squeezy signature | Verify and process Lemon Squeezy events. | Claims provider event identity and projects retry-safe local billing state. |
| Webhooks | POST | /api/webhooks/stripe/billing | Stripe signature | Verify and process Stripe billing events. | Claims provider event identity and projects retry-safe local billing state. |