POST
Trigger erasure run

Overview

Manually triggers the GDPR erasure scan that normally runs on a daily schedule (04:00 UTC). The endpoint enqueues a one-shot job onto the worker’s BullMQ queue and returns 202 Accepted immediately — the actual erasure runs out-of-band in the worker process, using the same handler as the scheduled run. The erasure worker tombstones user rows whose deletedAt < now − 30d (the soft-delete clock starts at DELETE /me) and hard-deletes their child data per the carve-outs in GDPR data lifecycle. Useful when:
  • A backlog has built up (the per-run cap is 500 users) and ops wants to drain it before the next 04:00 window.
  • Operational testing — verifying a specific user’s data has been erased after they passed the 30-day clock.
This endpoint parallels retention manual trigger — same shape, same audit pattern, same no-op fallback when Redis is absent.

Authentication

Bearer <accessToken> with scope: 'admin' required (requireAdmin).
Role-gated: SUPER only. Neither MODERATOR nor FINANCE may invoke it — erasure is destructive (PII removal across every collection, only the anonymized audit trail and the financial-retention-protected subscription rows survive). Per QUESTIONS.md §9.1 item 4.

Path parameters

None.

Query parameters

None.

Request body

None.

Response — 202 Accepted

202 means accepted for processing, not completed. The response carries no result counts (scanned/erased/failed) — those are logged by the worker. There is no synchronous “how many users did it erase?” read in Phase 7.

Error responses

Example error — 403 FORBIDDEN

Side effects

  • A one-shot gdpr-erasure job is enqueued on the worker queue with removeOnComplete: true (the Bull list does not grow on every admin click).
  • An audit-log row is written (action erasure.manual-trigger).
  • When no Redis/queue is wired (dev/test), a no-op enqueuer is used and the call still returns 202 — same fallback as Phase 5 push, Phase 6 retention, and Phase 7 GDPR export.

See also

curl

Postman

See docs/postman/swappr.postman_collection.json → Admin Erasure → Run.