ACC-56Required
Let people delete their account themselves
Put account deletion in settings, behind fresh proof of identity, and finish it within one month, as data requests sets. Say first what happens to the person's data and organisations.
How to do it
Show what deletion removes and what stays, such as invoices kept for tax law. A last owner of an organisation transfers or deletes it first, as never leave an organisation without an owner says. Then end every session, stop subscriptions and mark the account for deletion. Allow 14 days in which signing in cancels it, so the deletion still ends inside the month. State the date in the confirmation email. Then run the delete function from the data requests rule.
Examples
JavaScript example
const GRACE_DAYS = 14;
export async function requestAccountDeletion(db, user) {
if (await db.memberships.isLastOwnerAnywhere(user.id)) throw new ConflictError('Transfer or delete your organisations first.');
const deleteOn = addDays(new Date(), GRACE_DAYS);
await db.tx(async tx => {
await tx.users.scheduleDeletion(user.id, deleteOn);
await tx.sessions.deleteAllFor(user.id);
});
await billing.cancelSubscriptions(user.id);
await mailer.sendDeletionScheduled(user, deleteOn);
}
Python example
GRACE_PERIOD = timedelta(days=14)
def request_account_deletion(db, user) -> None:
if db.memberships.is_last_owner_anywhere(user.id):
raise Conflict("Transfer or delete your organisations first.")
delete_on = date.today() + GRACE_PERIOD
with db.transaction():
db.users.schedule_deletion(user.id, delete_on)
db.sessions.delete_all_for(user.id)
billing.cancel_subscriptions(user.id)
mailer.send_deletion_scheduled(user, delete_on)
How to check
Delete a test account. Its sessions end at once and the email states the date. After the grace period, a search of every store finds no trace except records the law requires.
Sources
Related rules
- WEB-217 Let people see and delete their data in Website
- EML-72 Keep a suppression entry when you erase a contact in Email
- PAY-32 Let people cancel online as easily as they signed up in Payments and billing
- ACC-44 Never leave an organisation without an owner in Accounts and identity
- APP-74 Erase deleted personal data from document history in Web app interface
- MOB-3 Let people delete their account inside the app in Mobile apps
- SUP-34 Run erasure and export through the tested functions in Customer support
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/accounts/profile-and-account-lifecycle/account-deletion">Agent Wranglers accounts and identity playbook</a>. In code you write, add a comment next to it with the same link.