Trigger erasure run
Erasure
Trigger erasure run
Enqueue a one-shot GDPR erasure scan. Returns 202. SUPER role only.
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 returns202 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.
Authentication
Bearer <accessToken> with scope: 'admin' required (requireAdmin).
Path parameters
None.Query parameters
None.Request body
None.Response — 202 Accepted
| Field | Type | Notes | Example |
|---|---|---|---|
status | string | Always "enqueued". The job has been placed on the queue; it has not necessarily run yet. | enqueued |
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
| Status | Code | Meaning |
|---|---|---|
| 401 | UNAUTHENTICATED | Missing, malformed, expired, or non-admin-scope token. |
| 403 | FORBIDDEN | Caller is a MODERATOR or FINANCE admin. SUPER only. |
Example error — 403 FORBIDDEN
Side effects
- A one-shot
gdpr-erasurejob is enqueued on the worker queue withremoveOnComplete: 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
- GDPR data lifecycle — the full erasure story: the 30-day clock, tombstoning, carve-outs (audit_logs, subscriptions, gdpr_export_jobs).
- Worker bootstrap and queues — the BullMQ wiring + scheduling.
- Delete account — where the 30-day clock starts.
- Trigger retention run — the sibling SUPER-only manual kick for tenancy-document retention.
curl
Postman
Seedocs/postman/swappr.postman_collection.json → Admin Erasure → Run.