User data export
A user downloads a copy of their data from Settings → Data → Download your data. This is the self-service part of their UK and EU GDPR rights of access (Article 15) and portability (Article 20). Deletion is still a request by email.
The request
fe-core user_router.downloadExport()
→ svc-bff GET /api/app/users/me/export (transparent proxy, long timeout)
→ svc-core GET /app/users/me/export (app/router/app/users/router.py)
→ data_export.build_export(db, user, buffer)
├─ postgres-core one query per exported table
├─ svc-ai GET /memory?user_id=… (agent memories)
└─ MinIO uploaded originals
svc-core builds the whole zip into a SpooledTemporaryFile (in memory up to 32 MB, then on disk) before it answers. A failure part-way through is then a 500, not a truncated download that looks complete. It answers Cache-Control: private, no-store, like everything svc-bff proxies.
What the zip holds
| Path | Contents |
|---|---|
memories.json | Every memory svc-ai holds from the user's conversations, across all agents, including CHAINR Bot and agents since deleted: each with its kind (an episode, or a fact, preference or goal kept from their words, with those words as evidence), its workspace, and whether it was replaced by a correction (superseded_at) or ended (expires_at). |
files/knowledge/<knowledge_id>/<document_id>_<name> | The original of each document the user uploaded to knowledge. |
files/uploads/<document_id>_<name> | The original of each document the user uploaded to a chat in their Personal library, since originals were kept (migration 109, October 2026). Earlier uploads have their text in data/uploaded_files.json only. |
README.md | Each file with its row count and a line on what it holds, plus what the export leaves out. |
Rows are serialised from the table's columns, not through the API's Read schemas. A schema holds what a page needs, and an export that drops the fields no page shows is not a copy of the data. Values follow the wire convention in Timestamps: offsets on every timestamp, enum values (not names), UUIDs and decimals as strings.
Which rows: the registry
app/services/data_export.py declares one ExportTable per exported table, each with a selector:
| Selector | Rows |
|---|---|
ByUser(column) | Rows whose column names the user: owner_user_id for owned resources and the activity tables, user_id for memberships, skill runs and uploads, actor_user_id for generation runs. |
ChildOf(parent, column) | Rows hanging off rows of another exported table (messages of conversations, cases of datasets, and so on), as a subquery, so grandchildren compose. |
HistoryOf(resources) | resource_versions rows for any resource the user owns, plus every version the user wrote of anything else. |
Every other table is in NOT_EXPORTED with the reason it isn't the user's data. tests/test_data_export.py fails when a table is in neither, so a new table can't be left out silently. It also checks that:
every table with
owner_user_idis selected by it;every owned resource brings its edit history;
every statement compiles for Postgres.
The SQL itself can't run against the mocked test session. It was checked against a live Postgres, exporting one of two users and confirming the other user's rows never appear.
What it leaves out, and why
Credentials. Any column
history.credential_fieldsnames (the edit history uses the same rule) reads[withheld: may contain credentials]. Today that is MCP serverconnection_configand thesource_configof every knowledge source except a website. An export file ends up in a Downloads folder; a database password should not.Withheld answers. A review item's
withheld_text— an answer an Output rule withheld from the person exporting — reads[withheld: an answer a governance rule withheld](ExportTable.hidden). It is kept for the workspace's reviewers, in the review queue, and nowhere else.Project- and organisation-owned resources. They belong to the project or organisation, and copying them out would hand one member everything the others put there. That includes a document a member uploaded to a shared library (
uploaded_files, migration 88): the upload is on record as theirs in its edit history, which the export carries, but the document is the team's.Website page snapshots. They are fetched copies of other people's pages, not something the user provided. Their records are exported; the HTML is not.
svc-ai's copies. svc-ai keeps its own copy of each chat turn and an
llm_invocationstrace per invocation, with anllm_invocation_callsrow per model call. The conversation content is already inchat_messages; the traces are operational records.svc-auth's sign-in records and sessions. The Security tab shows them.
The README tells the user to email help@datachainr.com for anything else.
Gaps an export can carry
An unreachable svc-ai leaves memories.json out. A stored object that can't be read leaves its file out. Either way the README says so, and the rest of the export still downloads.
Limits
The export is built inside the request, and svc-bff buffers the whole zip before passing it on. svc-bff gives this route its long timeout (PROXY_TIMEOUT_LONG, 180s, instead of production's 20s default), and nginx allows /api/ 180s. Cloudflare's 100s response timeout is the tightest limit. MVP data volumes come nowhere near it. If they start to, move the build to a background job that writes the zip to MinIO and serves it by link.