DELETE
Delete my account (right-to-erasure)

Overview

The user’s GDPR right-to-erasure entry point. Calling this:
  1. Re-authenticates the caller via currentPassword — defense in depth, the bearer token alone is not enough. The same access token that just logged you in is not sufficient to delete your account.
  2. Soft-deletes the user row (users.deletedAt = now, users.deletedReason = 'user-request'). The row physically remains so foreign-key references (audit_logs, subscriptions, conversations) stay valid.
  3. Cascades soft-delete to the only child table that has a deletedAt field today — current_homes. Other child rows are hard-deleted 30 days later by the daily gdpr-erasure worker.
  4. Revokes all active refresh tokens for the user. Every device is logged out on the next API call.
  5. Writes a user.deleted admin-audit row (actorType: USER).
This endpoint deliberately skips requireOnboarded. A user mid-onboarding has the same GDPR right to erase their data. The cascade and the worker both treat any soft-deleted row identically, regardless of onboarding state (QUESTIONS.md §9.1 item 4).
Idempotent: re-calling on an already soft-deleted user is a 200 no-op — cascades and audit are skipped, the existing deletedAt is returned unchanged. See GDPR data lifecycle for the full 30-day clock, tombstoning, and the carve-outs (audit_logs, subscriptions).

Authentication

Bearer <accessToken> (user scope) required. Re-auth via currentPassword in the body is also required — see request body.

Path parameters

None.

Query parameters

None.

Request body

Example payload

Response — 200 OK

Error responses

Example error — 401 wrong password

Side effects

What happens to my access token?

The current access token continues to work until it expires (15 min default) — the access-token check is stateless. However the refresh token is revoked, so when the access token expires the next refresh call returns TOKEN_REVOKED and the client is forced into the logged-out state. New logins are blocked because the user row’s status and deletedAt are checked at login time.

Changed your mind? (reactivation)

The deletion is reversible for the full 30-day grace window. If the user logs in during that window, POST /auth/login returns 403 ACCOUNT_PENDING_DELETION (carrying meta.deletionScheduledAt) rather than a session — the cue to show a reactivation screen. The user then calls POST /auth/reactivate with their credentials to clear the pending deletion and get a fresh session. After day 30 the row is tombstoned and reactivation is no longer possible.

See also

curl

Postman

See docs/postman/swappr.postman_collection.json → Me → Delete Account.