---
title: "Privacy: data export and deletion"
description: "OneSend gives workspace owners and admins the tools for data protection requests (GDPR and similar laws): export everything in a workspace, delete a workspace, export or erase the data of one contact, and delete your own account."
url: https://onesend.email/docs/privacy/
---
# Privacy: data export and deletion

OneSend gives workspace owners and admins the tools for data protection requests (GDPR and similar laws): export everything in a workspace, delete a workspace, export or erase the data of one contact, and delete your own account. It also limits what is stored: mail is encrypted at rest, and connected mailboxes can be kept as an index only (see [How stored mail is protected](#how-stored-mail-is-protected)).

## Export all workspace data

**Settings → Workspace → Data export**, or `POST /v1/workspace/export` (owners and admins in a dashboard session, or an admin-scoped live API key).

- The export runs in the background. When it is ready, the person who asked gets an email with a download link. The dashboard also shows the link.
- The file is a ZIP with:
  - `README.txt`: what is included and what is not;
  - `workspace.json`: the workspace settings and the members (email, name and role);
  - one JSON file per table (`contacts.json`, `messages.json`, `events.json`, `templates.json`, `template_versions.json`, `campaigns.json`, `inbound_messages.json`, `forms.json` and so on), each a JSON array with the field names of the API;
  - `contacts.csv`, `messages.csv` and `events.csv` with the main fields, for spreadsheets.
- **Never included:** sending provider and AI provider credentials, DNS host tokens, API key hashes, webhook signing secrets, app password hashes, invitation tokens, OAuth tokens and sign-in sessions. Any column whose name contains `secret`, `hash`, `password`, `token`, `nonce` or `lookup` is left out of every table. Raw MIME sources, uploaded import files, mail client (IMAP) state and statistics rollups are not exported either; the content they hold or are computed from is in the other files.
- Message bodies older than `ONESEND_RETENTION_DAYS` were already removed by the server, so they are empty in the export.
- Bodies encrypted at rest are exported decrypted. The blind search index (`search_tokens`) and the workspace's mail encryption key are not exported.
- Messages of connected accounts in index-only storage have `"storage": "index"` and no text, HTML or attachment content: those bodies were never stored on the server and are still in the original mailbox. `README.txt` says so.
- The download link is signed and works for 7 days. Anyone with the link can download the file, so do not forward the email. An owner or admin signed in to the dashboard can also download it without the link. After 7 days the file is deleted and the link answers 410 `export_expired`.
- One export runs at a time per workspace. Starting another one while it runs returns the running one.

Where the file is stored:

| Edition | Storage |
|---|---|
| Node (Docker, `npm start`) | `ONESEND_DATA_DIR/exports/<workspace>/<export>.zip` |
| Cloudflare Workers | the R2 bucket bound as `FILES`, under `exports/`. Without `FILES`, export answers 503 `export_storage_unavailable` |

The export job works in pages and stops before a query budget (400 queries, or 250 on Cloudflare D1) and continues in a new job, so it fits the per-invocation limits of D1. The ZIP is written as it goes (store-only ZIP, no compression) and must stay under 4 GB.

<a id="how-stored-mail-is-protected"></a>
## How stored mail is protected

- **Encryption at rest** (`ONESEND_ENCRYPT_MAIL`, on by default): bodies, snippets, attachment content and raw sources of received and sent mail are encrypted with a key per workspace, which is itself encrypted with `ONESEND_SECRET`. Addresses, subjects, dates, statuses, flags, labels, threading headers and attachment names stay in plaintext so threading, suppression, rules and lists work. Search on encrypted bodies matches whole words through a blind keyword index (keyed hashes, not the words). See [Mail encryption](https://onesend.email/docs/self-hosting/#mail-encryption) for the full list.
- **Index-only connected accounts**: a connected mailbox can be set to keep only headers, flags, folders, labels, the snippet and attachment names. Bodies are fetched from the mailbox when someone opens a message and kept in server memory for at most five minutes, never written to the database. See [Unified inbox](https://onesend.email/docs/unified-inbox/#storage-full-or-index-only).
- **Cloud edition**: personal mailboxes cannot be connected to the hosted service at all; that is offered in the free desktop app and on self-hosted servers. See Cloud edition.

Deleting a workspace deletes its encryption key with the rest of its data.

## Delete a workspace

**Settings → Workspace → Delete workspace**, or `DELETE /v1/workspace` with your password, a two-factor code if two-factor authentication is on, and the workspace name typed exactly:

```bash
curl -X DELETE https://mail.example.com/v1/workspace \
  -H "authorization: Bearer $ONESEND_SESSION" -H 'content-type: application/json' \
  -d '{"password":"…","code":"123456","confirm":"Acme"}'
```

- Only the owner can delete a workspace, in a dashboard session (not with an API key).
- The deletion has a **7-day grace period**. During it:
  - the workspace is read-only: changes answer 409 `workspace_pending_deletion` (members can still manage their own account, leave the workspace, download an export and erase contacts);
  - no email is sent. Queued email waits and goes out if the deletion is canceled;
  - every member gets an email with the date.
- The owner can cancel with **Cancel deletion** or `POST /v1/workspace/deletion/cancel`. `GET /v1/workspace/deletion` shows the state.
- After 7 days, members get a last notice, and 15 minutes later the purge job deletes every row of the workspace in every table: contacts, messages, events, templates, campaigns, the inbox, raw mail sources, mail client state, forms, automations, statistics rollups, billing records, export files and settings. It works in chunks within a query budget and continues in new jobs until nothing is left.
- People keep their accounts. Their sessions lose the workspace. Someone left without any workspace cannot sign in until they are invited to one, and can delete the account (below).
- On the cloud edition, a paid subscription (only when its plans are switched on) is canceled at the end of the paid period when the deletion is requested, and resumed if the deletion is canceled.

The purge goes through the table registry of the database layer, so tables added later are deleted too. A test fails when a table with a `workspace_id` column is not covered.

## Export or erase one contact

For a request from one person:

- **Access:** `GET /v1/contacts/{id}/export` returns, as JSON, the contact, its lists, its suppression, campaign deliveries, messages sent to the address, events, link clicks, conversions, form submissions and mail received from the address.
- **Erasure:** `DELETE /v1/contacts/{id}?erase=true` removes the contact and the address everywhere in the workspace:
  - messages to the address: the address is replaced by `erased@erased.invalid`; messages sent only to that person also lose the subject, body, variables and attachments;
  - events about the address lose the recipient and details;
  - campaign recipient rows stay, without the address, so campaign totals do not change;
  - link clicks and conversions lose the address and the contact; form submissions are deleted;
  - mail received from the address loses its sender, subject and body, and its raw source is deleted.

  A suppression keyed by a hash of the address (`erased:<sha-256>`) replaces any plain suppression, so the person is never mailed again even if the address is imported later. The address itself is not kept. The audit log records the erasure with counts, not the address.

Plain `DELETE /v1/contacts/{id}` (without `erase`) only removes the contact and its list memberships.

## Delete your account

**Account → Delete account**, or `DELETE /v1/account` with your password (and a two-factor code if it is on). This is not possible while you own a workspace: transfer ownership or delete the workspace first (409 `owns_workspaces`). It removes your account, memberships, sessions and app passwords. Data you created stays with each workspace.

An account left without any workspace cannot sign in, so it uses `POST /v1/auth/delete-account` with `email`, `password` and `code`.
