Nightly database-hygiene sweep (Vercel Cron)
Bearer-authenticated. Vercel Cron invokes this endpoint per the schedule in `vercel.json` (currently `30 3 * * *` — 03:30 UTC). Six ordered steps in one run: (1) throwaway sessions below the `MIN_REAL_SESSION_*` floor, (2) expired invites, (3) sessions older than `SESSION_RETENTION_DAYS = 7`, (4) tracked users with zero remaining sessions, (5) organisations with zero memberships (after nullifying every `User.activeOrganizationId` that referenced them), (6) `VACUUM FULL` on the churned tables to return freed disk space to the OS. The `GET` verb is Vercel Cron's contract — destructive-on-GET is ugly but the alternative is a wrapper that fights the platform.
/api/cron/daily-cleanupBearer-authenticated. Vercel Cron invokes this endpoint per the schedule in vercel.json (currently 30 3 * * * — 03:30 UTC). Six ordered steps in one run: (1) throwaway sessions below the MIN_REAL_SESSION_* floor, (2) expired invites, (3) sessions older than SESSION_RETENTION_DAYS = 7, (4) tracked users with zero remaining sessions, (5) organisations with zero memberships (after nullifying every User.activeOrganizationId that referenced them), (6) VACUUM FULL on the churned tables to return freed disk space to the OS. The GET verb is Vercel Cron's contract — destructive-on-GET is ugly but the alternative is a wrapper that fights the platform.
Header Parameters
Bearer token matching CRON_SECRET. Vercel injects this on scheduled invocations.
Response Body
application/json
curl -X GET "https://loading/api/cron/daily-cleanup" \ -H "authorization: string"{
"throwawaySessions": 8,
"invites": 4,
"sessions": 132,
"trackedUsers": 17,
"organizations": 2,
"vacuumedTables": 4
}