---
title: Export or delete your account
description: Export your account records, each application's database and files, and your tzMesh data before deleting your account with browser approval.
slug: /guides/export-or-delete-your-account
order: 7
visibility: public
redirects_from: []
---

# Export or delete your account

Prompt:

> Export everything about my account, then delete it.

Also works:

- "Save a copy of my account's declarations."
- "Export my app's production database."
- "What does deleting my account remove?"

Save your account's records, including its product records, with `export_account` under your own sign-in. Export each application's database and files with `tzcloud_request_export`, and export your tzMesh participants, channels and messages separately with `tzmesh_export`. Keep the exports before requesting deletion on the website’s Account & security page. Deletion requires your approval in a browser signed in to the same account.

## What your AI tool does

- Reads the `delete-account` [skill](https://turnzero.ai/cloud/concepts/glossary/#skill) (`read_context`, id `skill:delete-account`) and follows it. It does this for an export alone, too, not only for a deletion.
- Saves the `export` document that `export_account` returns to a file in your project. Downloads each application's export into a folder outside the application's folder.
- Asks you to request deletion on the website’s Account & security page. Nothing is deleted until you approve in a browser signed in to the same account.

## What you need

- For a deletion, first save the export somewhere you choose. Then sign in to a browser with the same account. Only a browser signed in to that account can approve the deletion.

## Before your AI starts

**For the AI tool:** Check the following before starting.

- A connected, signed-in AI tool ([Connect your AI assistant](https://turnzero.ai/cloud/getting-started/connect-your-tool/)).
- From `tzcloud_list_applications`: the applications that hold a database or stored files, and the environments each one uses.

## Steps

The whole task runs in this order. Start with `export_account`; if it is partial, follow the cause-specific advice below before any repeat. For each application and environment holding data, call `tzcloud_request_export`, then `tzcloud_read_export` until it completes. Call `tzcloud_request_export` again with `download: true` and that `export`, and run its line. Last, request deletion on the website’s Account & security page and approve it in the browser. Your AI tool cannot request account deletion through its MCP connection.

### 1. Export

`export_account` takes no arguments. It returns the account's declarations and the records listed below as one JSON document under `export`, with a `read_at` time. The document contains:

- the account record and product profiles;
- applications with their manifests, sizes, environments, versions and deployment state;
- the settings of each end-user [realm](https://turnzero.ai/cloud/concepts/glossary/#realm), without its users, with the count of registered devices by platform;
- each environment's push configuration, with the provider identifiers and secret names, without the secret values;
- the storage areas and [upstreams](https://turnzero.ai/cloud/concepts/glossary/#declared-upstream) you declared, and your secret names, without their values;
- your token records, without the token values;
- your feedback, where the platform runs its issue service. This holds your own [reports](https://turnzero.ai/cloud/concepts/glossary/#issue-and-report) with their histories and comments, and the `signals` and `asks` lists. Those two lists are empty. `spaces` holds your own filings from each [issue space](https://turnzero.ai/cloud/concepts/glossary/#issue-tracking-space) you have, your account's own spaces and each application's. Without the issue service, the export leaves this member out;
- your tzTrack records, as `tztrack`, under your own sign-in, where you hold tzTrack and the platform runs its issue service. `spaces` holds each of your account's own issue spaces whole: every issue, comment, landing, build, and check in it, whoever filed it. The `signals` and `asks` lists are empty, and each issue's and check's `lease` is `null`: the export omits the holds `next` placed on them. A pause for a used-up balance does not stop this export.

Your account export contains no tzMesh data. Use `tzmesh_export` separately for your tzMesh participants and the channels they belong to, with their messages. That copy can include what other people wrote.

The export is not a snapshot taken at one moment. It reads these records one after another, so a change made while it runs may show in some parts only. `read_at` is when the export was stamped, just after it read the account record.

If a product cannot be read, the export still returns everything else and says what is missing. `partial` is `true`, and `products_not_read` names `tztrack`. Both stand at the top of the response and inside `export`, so the file you save says it too. `tztrack` here also covers your feedback; where only that read failed, `detail` names your feedback.

When `detail` says `sign_in_required`, repeat the export under your own sign-in. Waiting with the same credential will not fill those product records. The tzTrack bullet above describes what your own sign-in can read.

Keep the partial copy and read `detail` before trying again. After a temporary outage, try again after a short wait. A space or account too large for the read's bounds can stay partial on every repeat; waiting does not remove that bound. Check what your copy is missing before deleting the account.

### 2. Export each application's data

`export_account` contains no application code, database contents, or stored files. Your application code stays with you: the platform never keeps your source. It keeps the image it builds from your [artifact](https://turnzero.ai/cloud/concepts/glossary/#artifact) to run the application, and you cannot download that image.

A zip deployed with `artifact` stays a stored file in your own storage area. A zip uploaded through `tzcloud_deploy`'s upload form stays in the application's [deploy area](https://turnzero.ai/cloud/concepts/glossary/#deploy-area-and-export-area) until the deploy that read it ends. A zip that no deploy reads stays until a later deploy's upload replaces it, or until the platform's daily cleanup deletes it once it is more than a day old.

To export an application's database and stored files, your AI tool calls `tzcloud_request_export`. Each call covers one application and one environment. Where you give no environment, it exports production.

To start an export, call `tzcloud_request_export` with `application` and optionally `environment`, leaving out `download`, `export`, and `local_path`. Use the download form below once the export is complete.

```json
{
  "application": "<application id>",
  "environment": "production"
}
```

It returns 202 at once with the export's `export` id, the state `running`, and `next`, the `tzcloud_read_export` call to make. If an export of the same application and environment is still running, the call returns that export with `repeated: true` and starts no second one. Your AI tool then calls `tzcloud_read_export` with the `application` and the `export` id until the state is `completed`.

```json
{
  "application": "<application id>",
  "export": "<export id>"
}
```

It then calls `tzcloud_request_export` with `download: true` and the `export` id, and runs the returned line, as [Download the export](#download-the-export) shows.

The export writes its files to the application's export area, `export-<application id>`, in a folder named after the export id:

- each database table as one CSV file with a header line, `<export id>/database/<table>.csv`;
- a manifest, `<export id>/manifest.json`, which `tzcloud_read_export` also returns.

The manifest lists each table's file, columns, and row count. It also lists each file in the application's other storage areas, with its size and version. It leaves out the deploy area, `deploy-<application id>`. A new export of the same application and environment first deletes the folders of earlier exports. So `tzcloud_read_export` returns an earlier export with `manifest` null.

Each of the two parts is consistent on its own:

- **The database** is read in one repeatable-read transaction, a read that sees every table at the same moment. So every table is as it was at the manifest's `database.read_at`.
- **The stored files** are listed, not copied. If a download returns a different version (its `ETag`) from the one the manifest lists, the file changed after the listing. The download keeps the file as it arrived and reports it as moved.

The export's files count toward the application's stored-data limit from the next daily check, so delete them once you have them. Uploads stop if the files take the application over that limit. They resume when you delete files and the next check finds it within the limit ([Size and usage](https://turnzero.ai/cloud/guides/plan-and-usage/)). File storage is charged daily; read its rate on the [pricing page](https://turnzero.ai/pricing), or call `read_rate_card`.

If a table's CSV file would pass 16 GiB, the export ends `failed` with `table_bound_exceeded`, and the manifest names the table. The export reads no secret value and no end-user list.

An export is the copy you hold yourself. For backup coverage, restore requests and the data that backups cannot restore, read [Durability and backups](https://turnzero.ai/cloud/guides/add-a-database/#durability-and-backups). A [promote](https://turnzero.ai/cloud/concepts/glossary/#promote), which applies a version to production, takes no snapshot of the production database.

#### Download the export

Once the export is `completed`, call `tzcloud_request_export` with `download: true`, `application`, `export`, and optionally `local_path`. Leave out `environment`: the export already holds it.

In this `tzcloud_request_export` call, `local_path` is the folder on your machine to write into, as an absolute path or one relative to the folder the line runs in. Your AI tool runs the line in the application's folder, as it runs the deploy line. So `../notes-export` puts the export beside the application, so a deploy does not include it. Keep the export outside the repository too, or ignore it in Git.

```json
{
  "download": true,
  "application": "<application id>",
  "export": "<export id>",
  "local_path": "../notes-export"
}
```

The response has one download command in four forms:

- `command_npx` and `command_npx_windows`, through npx for macOS/Linux and Windows, with no global installation needed;
- `command` and `command_windows`, the installed forms, using `turnzero` and `turnzero.cmd`.

Your AI tool first runs `command_npx`, or `command_npx_windows` on Windows, once, exactly as given, before the response's `expires_at`. [Running and writing lines](https://turnzero.ai/cloud/concepts/turnzero-command/#running-and-writing-lines) explains what to do if npx can't run here. For this call, the installed `command` is:

```bash
echo <grant> | turnzero export download --export <application id>/<export id> --path "../notes-export"
```

The line passes a download grant, a kind of [transfer grant](https://turnzero.ai/cloud/concepts/glossary/#transfer-grant), to the [turnzero command](https://turnzero.ai/cloud/concepts/turnzero-command/). The grant is in the line and nowhere else in the response. Until the response's `expires_at`, five minutes after minting by default, it reads, by name, this export's own files and the application's stored files in the exported environment. It lists nothing and writes nothing, a read does not use it up, and every other route refuses it. So no long-lived token reaches your shell.

Of the application's stored files, the grant reads those created by the time the export listed them. The line asks for each file the manifest lists and for no other. A file that was rewritten after the export is downloaded with its newer bytes and reported as moved.

A file first stored after the export is in no manifest, so the line does not read it and counts nothing for it. A file deleted and stored again after the export is in the manifest but is not downloaded. Its read returns 404 `no_such_file`, as a name with no file does, and the line counts it as a failed file. A new export has the application's files as they are now.

The command reads the export's manifest, then each file it lists, four at a time. It writes `manifest.json`, each table as `database/<table>.csv`, and each stored file as `files/<area>/<name>`.

Each file is written under a temporary name first. It takes its final name only once every byte has arrived, so a half-written file never has its final name. If your computer's file system would refuse or change a file name, the command writes the file under an escaped, safe form of the name and prints it. A name with a `.` or `..` path segment is a failed file, and nothing is read for it.

An index file in the folder, `.turnzero-cloud-export.json`, records each finished file, and a second run skips every file it records whose size on disk matches. If the platform returns 429 `rate_capped`, the command waits for the next minute and reads again. It waits for at most five minutes in one run.

Give `local_path` a folder outside your application's folder, so that no deploy zips the export. Without `local_path`, the line writes a new folder, `export-<export id>`, in the folder it runs in, and it refuses to run in a folder that has a `package.json`. The command also refuses a folder that already holds files but no index for this export, so it never writes over a file of yours.

A `local_path` with a character that `tzcloud_deploy_command` refuses in its own `local_path` is refused 400 `invalid_request`, and nothing is minted. The [tzcloud_deploy_command](https://turnzero.ai/cloud/reference/actions/deploy-command/) reference lists those characters. The line does not expand `~`: name your home folder in full.

The line ends with one of four exit statuses:

- 0: every file the manifest lists is on disk;
- 1: a file failed. Run the same line again before the grant expires, and it reads only the files that failed. Where the platform returned HTTP 404 `no_such_file` for a file, the file was not read, and the closing lines say so. The same line fails that file again, as it does a file deleted and stored again after the export. Call `tzcloud_request_export` without `download` again: a new export has your application's files as they are now;
- 2: the run stopped before the end, as when the grant expired. Call `tzcloud_request_export` again with `download: true`, the same `export`, and the same `local_path`, and run the new line. It skips the files already on disk;
- 3: nothing was written, for example because the grant in the line is not valid or the folder is refused.

Your own script can read the same files without the command. It sends `GET /storage/v0/areas/<area>/files/<name>` with a minted token, and sets the `x-turnzero-cloud-environment` header to the exported environment. The database files are in the export area. Each other file is in its own storage area.

### 3. Delete

Once the exports are saved, open the website’s Account & security page and request deletion there. The page opens the approval; it does not export your data first. Your AI tool cannot request account deletion through its MCP connection.

Scripts can still call `delete_account` over HTTPS with a bearer token for that token’s own account. The action is absent from customer MCP tool lists; deletion requires the person’s Allow in a browser signed in to that account.

If a deletion of one of your applications is already running, the account deletion waits for it, for about six minutes at most. If deletions of several of your applications are running, it waits for all of them, for twenty minutes at most in all. If a deletion is still running after that, the account deletion stops with `deletion_in_progress`. Request it again later.

Before you approve, the browser page shows what the deletion removes. It names each application by label and counts each other kind: sign-in identities, product profiles, secrets, upstreams, storage areas, databases, end-user realms, issue spaces where there are any, and minted tokens.

It also says that every session ends and that you should export first, and it names what the export could not read then, including your feedback where that read alone failed. Where your account holds tzMesh, it also says the account export contains no tzMesh data. Above its buttons, the page says the deletion cannot be undone and that Turn Zero offers no way to restore what it deletes.

Each kind is deleted with everything that belongs to it:

- each application, deleted exactly as `tzcloud_delete_application` deletes it, which [Delete the application](https://turnzero.ai/cloud/guides/manage-versions-and-environments/#delete-the-application) lists;
- each storage area with its files, and each database with its roles;
- each end-user realm with its users;
- each issue-tracking space, your applications' and your account's own, with every record in it, deleted at the issue service. Its daily copies are deleted with it. A copy being written at that moment is deleted at the next daily run.

Some things stay. The secret store keeps deleted secret values for ninety days, then purges them. No action of yours can read or restore them ([Secrets](https://turnzero.ai/cloud/backend-packages/secrets/)). To stop a key from working, replace it at the service that issued it.

Console output from container hosting stays in the hosting provider's log store for up to thirty days; deletion and `tzcloud_purge_logs` do not remove it. Saved console excerpts from ended pods are deleted with the environment's log stream.

The platform's record of actions and its usage metering history keep their rows. The event log of the [builder](https://turnzero.ai/cloud/concepts/glossary/#builder) realm, the user list Turn Zero accounts sign in through, keeps every row except the account's views of the Cloud set-up and connect pages. Account deletion deletes those view rows.

Deleting your account erases your identity from every report you filed in the platform's own feedback. It deletes no report, and each report keeps its text as written.

Each deleted application leaves one record with its identifier, its retired label, and the deletion time. Its name, its manifest, and your account's identifier are cleared from that record. Deletion ends the account's services. It does not change who owns your own work, such as your source code.

## Expected result

`export_account` returns `partial`, `products_not_read`, and `export`, which has `read_at`, `partial`, `products_not_read`, and the members `account`, `applications`, `realms`, `push`, `areas`, `images`, `custody`, `upstreams`, and `tokens`. It also has `feedback` where the platform runs its issue service. Under your own sign-in, it has `tztrack` where you hold tzTrack. A member the export could not read is left out, and `products_not_read` names its product.

`images` lists the pictures your account still keeps from generation without an application. Each entry has `name`, `size`, `created_at`, and `kept_until`, with no picture bytes or download links. The list is empty where none remain.

`tzcloud_request_export` returns 202 with `export`, `state: "running"`, `area`, `folder`, and `next`. `tzcloud_read_export` returns `state` `completed` with the `manifest`: its `database` member with `read_at` and one entry per table, and its `files` member with one entry per area.

`tzcloud_request_export` with `download: true` returns `export`, `application`, `environment`, `expires_at`, `command`, `command_windows`, `command_npx`, and `command_npx_windows`. The line prints its version line, then one line that starts with `downloaded:` and counts the files on disk. It ends with status 0.

The website requests a pending action and opens its approval page. After you approve and deletion completes, the account’s services and sessions end.

## Refusals

See the [refusals reference](https://turnzero.ai/cloud/reference/refusals/) for other platform errors.

Four rows, `description_changed`, `deletion_in_progress`, `execution_failed`, and `interrupted`, are outcomes that a pending action records. `read_approval_status` shows them.

| Refusal | Status | Cause | Remedy |
| --- | --- | --- | --- |
| `invalid_request` | 400 | A member is missing or malformed, such as no `id` for `read_approval_status`. The `detail` names it. | Correct the named member and call again. |
| `fresh_authentication_required` | 403 | A change from the dashboard, such as the deletion request, came more than 8 hours after you signed in on that browser. | Follow the page's Sign in again link, then repeat the change. |
| `not_found` | 404 | `read_approval_status` named a pending action that is not yours. Or `tzcloud_read_export`, or `tzcloud_request_export` with `download: true`, named an export the application does not have. The download form also refuses files that a later export replaced or that were deleted. | Use the `id` the destructive call returned, or the `export` id from the export request. If the files are gone, call `tzcloud_request_export` without `download` and download the new export. |
| `no_such_application` | 404 | `tzcloud_request_export` or `tzcloud_read_export` named an application that is not your account's. | Use an `application` id `tzcloud_list_applications` returns. |
| `application_other_account` | 403 | `application` names an application that belongs to another account, not the account the call is signed in as. The `detail` names the account the call acted as and nothing of the other one. | Compare `turnzero whoami` with `read_account` over your AI tool's connection. Make the call from the one signed in to the account that holds the application. |
| `export_not_completed` | 409 | `tzcloud_request_export` with `download: true` named an export that is still running or failed. | For a running export, call `tzcloud_read_export` until it is `completed`, then request its download with `download: true`. For a failed one, call `tzcloud_request_export` without `download` and use the new export's id. |
| `transfer_grant_expired` | 403 | The download grant expired, five minutes after minting by default, before the line read every file. The line ends with status 2 where it had read a file. It ends with status 3, with nothing written, where the grant had expired before its first read. | Call `tzcloud_request_export` again with `download: true`, the same `export`, and the same `local_path` and run the new line. It skips the files already on disk. |
| `transfer_grant_not_admitted` | 403 | The download grant was used for something other than reading a named file of its export or its application, such as a listing. A line run as the call returned it can also be refused by this name on a stored file. | Run the line as the call returned it. Where that line was refused on a stored file, call `tzcloud_request_export` again with `download: true` and the same `export` and run the new line. For any other request, use your signed-in session or a minted token. |
| `no_such_file` | 404 | Under the download grant, a stored file was read that was created after the export listed its files: one deleted and stored again after the export. The line counts it as a failed file. A name with no file returns the same refusal. | Call `tzcloud_request_export` without `download` again and download the new export, which has the application's files as they are now. |
| `approval_expired` | 409 | The pending action expired before you approved it in the browser. `expires_at` gives the time. | Request the action again and approve the new record before it expires. |
| `approval_wrong_account` | 403 | The approving browser is signed in to a different account from the one that asked. | Sign in to the account that asked, then open the approval link again. |
| `description_changed` | none | At approval, the platform's new description of what would be deleted differed from the one you approved. The record ends `declined`, and nothing ran. | Request the action again and approve its current description. |
| `deletion_in_progress` | 409 | Another deletion of one of your applications kept running after the account deletion waited for it. The account deletion stopped without removing that application. The detail gives the application and the time its hold ends. | Wait for that deletion to finish; `read_approval_status` or `tzcloud_list_applications` shows it. Then request the account deletion again. |
| `execution_failed` | none | The deletion failed partway with an error that has no refusal name. The outcome identifies the part that failed, a reference to the platform's record of the error, and what was removed before it. | Read the outcome and the current state, then request the action again. Any `request_id`, or none, starts a new pending action. |
| `interrupted` | none | The deletion ran for more than thirty minutes without finishing and was marked failed. | Check the current state before you request and approve another attempt, because some parts may already be removed. |

## Related

- [Your account](/turnzero/guides/your-account/) reads the account and its [standing](https://turnzero.ai/cloud/concepts/glossary/#standing).
- [Manage versions and environments](https://turnzero.ai/cloud/guides/manage-versions-and-environments/) deletes one application or its development environment.
- [What happens without asking](https://turnzero.ai/cloud/concepts/what-happens-without-asking/#the-pending-action) explains the pending action through which account deletion completes.
- [turnzero command reference](https://turnzero.ai/cloud/reference/turnzero-command/#export-download) lists the download line's options and statuses.
- [Store files](https://turnzero.ai/cloud/guides/store-files/) covers the storage file routes the export's files download over.
- [Glossary](https://turnzero.ai/cloud/concepts/glossary/) defines the terms used on this page.
- [export_account](https://turnzero.ai/cloud/reference/actions/export-account/), [tzcloud_request_export](https://turnzero.ai/cloud/reference/actions/request-export/), [tzcloud_read_export](https://turnzero.ai/cloud/reference/actions/read-export/), [delete_account](https://turnzero.ai/cloud/reference/actions/delete-account/), and [read_approval_status](https://turnzero.ai/cloud/reference/actions/read-approval-status/) in the generated reference give each action's arguments, result, and refusals.
