Authentication

Two authentication modes depending on your use case: server integration (API key) or dashboard (JWT).

Authentication modes

ModeUsageHeader
API keyEvent ingestion, customers, webhooksX-API-Key
JWTDashboard, billing, settings, campaignsAuthorization: Bearer
PublicHealth, register, login, plans—

API key (integration)

Protected prefixes: /events, /customers, /churn, /webhooks.

curl https://zedchurn.fr/api/v1/events \
  -H "X-API-Key: api_zedcheckout_xxxxxxxx"

JWT (dashboard)

After POST /auth/login, the token is available via the auth_token cookie (httpOnly, secure, SameSite=Lax) or Bearer header.

// Cookie automatique depuis le BFF Next.js
// Ou explicitement :
fetch('/api/v1/dashboard/customers', {
  headers: { Authorization: 'Bearer <access_token>' },
  credentials: 'include',
});

TOTP 2FA is required when enabled — provide totp_code at login if active.

Multi-tenant isolation