# Export

> Pack up everything a user or an app holds, in formats that work elsewhere.

An **export** packs up what a user holds on NoClick in forms that work without NoClick, so a user who asks for their data, or who leaves, gets something they can use. Everything that holds data exports; this page covers a whole user.

## Export a user

```python
import noclick

user = noclick.User.from_id("user_42")
bundle = user.export().wait()

print(bundle.url)          # a zip; the link works until bundle.expires_at
for item in bundle.contents:
    print(item.kind, item.name, item.detail)
```

```ts
import { User } from "noclick";

const user = User.fromId("user_42");
const bundle = await (await user.export()).wait();

console.log(bundle.url);          // a zip; the link works until bundle.expiresAt
for (const item of bundle.contents) {
  console.log(item.kind, item.name, item.detail);
}
```

`export()` returns an [operation](https://www.noclick.com/docs/guide/operations.md), since a user with a lot of data takes a while; `wait()` gives an [`ExportBundle`](https://www.noclick.com/docs/reference/python/ExportBundle.md#ExportBundle). The user keeps working meanwhile. Each dict and queue is read as it stood at one moment; a bucket, a volume or a database is read as the export reaches it.

## What's in the bundle

| What | Leaves as |
| --- | --- |
| Agents | `agents/<name>.json`: each of the user's own agents' definition (instructions, model, tools, triggers) |
| Conversations | `conversations/<agent>/<conversation>.jsonl`: one transcript per conversation, a message per line, with their own agents and the account's (`@account/<agent>`) |
| Memory | `memory/<agent>/<name>.md`: what each agent remembers about the user, one Markdown file per memory |
| Databases | `databases/<name>.sql`: SQL that recreates the schema and the rows |
| Buckets and volumes | `buckets/<name>/files/`, `volumes/<name>/files/`: every file at its key or path, with an `index.jsonl` beside it |
| Dicts and queues | `dicts/<name>.jsonl`, `queues/<name>.jsonl`: a key or a message per line |
| Code | `repos/<name>.bundle`: each repo with every branch and tag, a git bundle to clone or push elsewhere |
| Apps | `apps/<name>.json`: each app's settings, bindings and secret names; its code and data are in their own places |
| Connections and secrets | `connections.json`, `secrets.json`: names and integrations, names and keys; tokens and secret values never leave |
| Browser profiles | `browser_profiles.json`: each [profile](https://www.noclick.com/docs/guide/browser.md) and the sites it's signed in to, and who signed in; the sign-ins themselves never leave |
| Phone numbers | the call that gives the PIN and account details to port each number to another carrier |
| Domains | the call that gives the code to transfer each domain to another registrar |

Each `ExportItem` has a `kind`, the `name` of the thing, and a `detail` saying where it is in the zip and what to do with it. The zip's `README.md` says the same for a person, and its `manifest.json` for code.

A transfer PIN or a domain's transfer code moves the number or the domain to whoever holds it, so neither goes in a bundle, whose link can be passed on: `phone_number.transfer_out()` and `domain.transfer_out()` give them to the API key that asks.

## What still needs NoClick

`bundle.remaining_dependencies` lists what keeps running on NoClick as long as the user does: `the agent runtime`, `channels`, `people's pending asks`, `app hosting` and `connections`, whichever apply. An export gives you the data, not a running copy, so plan how each of these is replaced before the user goes.

```python
print("Still on NoClick:", ", ".join(bundle.remaining_dependencies))
```

```ts
console.log("Still on NoClick:", bundle.remainingDependencies.join(", "));
```

## Export, then delete

To give a user their data and then remove them, delete with `export=True`:

```python
user = noclick.User.from_id("user_42")
bundle = user.delete(export=True).wait()
```

```ts
import { User } from "noclick";

const user = User.fromId("user_42");
const bundle = await (await user.delete({ export: true })).wait();
```

The user is deleted only once the bundle is stored, and the bundle stays downloadable after. If the export fails or is canceled, nothing is deleted. Only a call acting for the account deletes users.

## Export one thing

A database, a bucket, a volume, a dict, a queue, a repo or an app exports on its own the same way, with the same kind of bundle:

```python
db = noclick.Database.from_name("booking-db")
bundle = db.export().wait()
print(bundle.url)   # the SQL dump, zipped
```

```ts
import { Database } from "noclick";

const db = Database.fromName("booking-db");
const bundle = await (await db.export()).wait();
console.log(bundle.url);   // the SQL dump, zipped
```

See [Databases](https://www.noclick.com/docs/guide/databases.md), [Storage](https://www.noclick.com/docs/guide/storage.md), [Volumes](https://www.noclick.com/docs/guide/volumes.md), [Dicts](https://www.noclick.com/docs/guide/dicts.md), [Queues](https://www.noclick.com/docs/guide/queues.md), [Repos](https://www.noclick.com/docs/guide/repos.md) and [Apps](https://www.noclick.com/docs/guide/apps.md). A repo can also be copied whole into a new GitHub repository with [`export_to_github`](https://www.noclick.com/docs/guide/repos.md#move-it-to-github).

## Limits and billing

| Limit | Value |
| --- | --- |
| The zip's link | 7 days; export again for a fresh one |
| Exports of one user or one thing | one at a time |
| Exports in an account | 10 at a time |
| One bundle | 1 TB |

Starting a second export of the same user or thing raises `noclick.Conflict` naming the running one (`operation_id`); an eleventh at once in the account raises `noclick.QuotaExceeded`. Exports are free. Exporting a Postgres database wakes it, and its compute is billed as any use is.

See also [Users](https://www.noclick.com/docs/guide/users.md) and the reference for [`User.export`](https://www.noclick.com/docs/reference/python/User.md#User.export).
