Pattern: Data export and account deletion
Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.
For agents
- Offer as a suggestion; whether data export and deletion are legal duties depends on the country and the data, so confirm with a lawyer. Values are examples.
- Core ideas: export and deletion start only from a re-authenticated user, deletion works in the app and on the web, nothing reveals whether an account exists, and every attempt is logged without secrets.
- Related: deletion and retention, passwords and login, strong sign-in.
1. Problem
People want a copy of their data and a way to leave. Stores require account deletion for apps that create accounts. Badly built flows leak account existence, let a thief with a stolen session delete or download everything, or promise deletion that does not happen.
2. Options
| Topic | Option | Upside | Downside |
|---|---|---|---|
| Deletion entry | In app only | Simple | Google Play also requires a web link; people without the app are stuck |
| Deletion entry | In app and web (recommended) | Meets Google Play and Apple rules | A second flow to build and secure |
| Export format | Machine-readable plus human-readable (recommended) | Reusable and understandable | More work |
| Export format | One human-readable PDF | Easy to read | Hard to reuse elsewhere |
| Export delivery | Time-limited link | No data kept in mail | User must act in time |
3. Recommended design
Store rules. Google Play’s account deletion policy says apps that allow account creation must give users an in-app path to delete their account and associated data and also provide a web link where users can request deletion; the link goes into the Data safety form. Apple App Review Guideline 5.1.1(v) requires apps that support account creation to let people initiate account deletion from within the app. Check both pages for current text before release.
Data export
- Start only from inside the app, and ask for the password again (and a second factor if enabled). A stolen session alone must not be enough.
- The package is machine-readable and human-readable. It does not contain password hashes or secrets.
- Delivery by a link that expires (example: 7 days), with a note: “this file is unencrypted; store it somewhere safe”.
- Limit how often an export can be requested (see rate limits).
- Whether the legal basis requires a particular format depends on the country; the EDPB publishes guidance on data portability (ask counsel).
Account deletion
- In the app: re-authenticate, explain what will be deleted and when (deletion and retention), then start the deletion process.
- On the web: the person identifies the account (username or email plus password) → a code is sent to the registered email → the deletion process starts with a recovery window (example: 14 days) in which signing in cancels deletion.
- Account-existence protection applies: the same message whether or not the account exists (see account sign-up).
- Every attempt is logged (time, address, outcome) without writing password or code values.
- At the end: sessions closed, push tokens removed, files queued for deletion, linked records handled per the retention rules.
4. Scenarios and edge cases
- User cannot sign in (forgot password): the web path starts with the recovery flow, then deletion.
- Stolen session requests an export: blocked by re-authentication and, if enabled, the second factor; the owner receives a notification.
- Active subscription: tell the user that deleting the account does not cancel the store subscription, and link to the store’s cancel page.
- Legal hold or open report: deletion is accepted, data stays only as long as the hold requires, and the notice says so honestly.
5. Common mistakes
- Deletion only in the app, no web path.
- “Deactivate” presented as “delete”.
- Export delivered as a permanent public link.
- Password hashes or tokens in the export.
- Different messages for existing and non-existing accounts in the web flow.
- Logging passwords or codes during failed attempts.
6. How to audit
- What: both deletion paths exist.
- How to check: run the in-app flow and the web flow on test accounts.
- Evidence: screenshots; deletion status in the admin view.
- What: export needs a fresh password.
- How to check: try to start an export with only a valid session.
- Evidence: password prompt or refusal.
- What: export contains no secrets.
- How to check: open the package and search for hashes and tokens.
- Evidence: file list and a negative search.
- What: web deletion does not leak existence.
- How to check: submit a known and an unknown account.
- Evidence: identical responses.
Sources
- Understanding Google Play's app account deletion requirements — Google Play Console Help
- 5.1.1(v) Offering account deletion in your app — Apple Developer (App Review)
- European Data Protection Board — EDPB
- User Privacy Protection Cheat Sheet — OWASP Cheat Sheet Series
- Authentication Cheat Sheet — OWASP Cheat Sheet Series
- Logging Cheat Sheet — OWASP Cheat Sheet Series