> For the complete documentation index, see [llms.txt](https://docs.veilio.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.veilio.xyz/documentation/great-to-know/secure-export-workflow.md).

# Secure Export Workflow

This page describes the hardened GDPR/export flow implemented in Veilio.

#### Security posture

* Export request requires authenticated session
* 2FA/TOTP code is required
* Export payload is encrypted at rest
* Download link/token is one-time use
* Token expires automatically
* **Full export is quota-free** (all tokens detokenized regardless of plan)

#### Request flow

1. Client requests export with `POST /api/compliance/export` and body:
   * `format`: `json` or `csv`
   * `code`: TOTP code
2. Veilio validates session + 2FA + rate limit.
3. Export job is created and processed asynchronously.
4. User receives a download link/token (and email notification).

#### Important hardening details

* `GET /api/compliance/export?code=...` is disabled for security.
* Export `fileData` is stored encrypted (`enc_v1:` prefix).
* Download route rotates token on first successful download.
* Reusing same download link returns `410 GONE`.

#### Audit log export (offboarding)

Before deleting an account, users must download audit logs:

```http
GET /api/compliance/logs-export?startDate=YYYY-MM-DD&endDate=YYYY-MM-DD&format=json
```

This step is **mandatory** in the guided offboarding flow (`/dashboard/offboarding`).

#### Guided offboarding

See Offboarding & Account Exit for the full 5-step departure checklist (understand → export data → export logs → confirm → delete).

#### Recommended ops settings

* Keep export token expiry short where possible.
* Monitor repeated failed 2FA/export attempts.
* Keep audit logs for export request + download events.
* **Export before shred/delete** — crypto-shredded tokens cannot be recovered.
