Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add Ente CLI guides

Manav Rathi47d991a25773
diff --git a/docs/docs/.vitepress/config.ts b/docs/docs/.vitepress/config.ts
index b1447de2d5..3d121364b9 100644
--- a/docs/docs/.vitepress/config.ts
+++ b/docs/docs/.vitepress/config.ts
@@ -13,6 +13,8 @@ export default defineConfig({
["link", { rel: "icon", type: "image/png", href: "/help/favicon.png" }],
],
cleanUrls: true,
+ // TODO: Remove after publishing the first CLI release.
+ srcExclude: ["cli/**"],
ignoreDeadLinks: "localhostLinks",
sitemap: {
hostname: `${docsBaseUrl}/`,
diff --git a/docs/docs/cli/accounts.md b/docs/docs/cli/accounts.md
new file mode 100644
index 0000000000..6a4e6d84f2
--- /dev/null
+++ b/docs/docs/cli/accounts.md
@@ -0,0 +1,140 @@
+# Accounts
+
+Log in to Photos:
+
+```sh
+ente account login --account personal --app photos
+```
+
+The CLI asks for your email and password, then for an email verification code or an authenticator code when your account requires one. When it works, it prints the saved account:
+
+```
+Name personal
+Host https://api.ente.com
+Logged in photos
+Selected yes
+ID 1580559962386438
+```
+
+`--account NAME` is the local name for this account on this computer. Without it, the login goes to the selected account, or, when there is none yet, to a new account named after its email. `--app` is `photos`, `auth` or `locker`.
+
+If your account uses a passkey, the CLI opens your browser, or prints the link if it cannot. Approve the login there, return to the terminal, and press Enter. When both a passkey and an authenticator are set up, the CLI asks which to use. Passkey login needs a terminal; it does not work with `--input` or `--no-input`.
+
+## Add a second app
+
+Each app has its own login. Log the same account into Auth:
+
+```sh
+ente account login --account personal --app auth
+```
+
+`Logged in` now shows `photos,auth`.
+
+## Use a self-hosted server
+
+```sh
+ente account login --account home-server --app photos --host https://api.example.org
+```
+
+The server is saved with the account, and every later command uses it. A saved name keeps its server; to log in to another server, use a new name.
+
+## Pick and rename accounts
+
+```sh
+ente account list
+```
+
+```
+SELECTED NAME EMAIL HOST LOGGED IN ID
+* personal [email protected] https://api.ente.com photos,auth 1580559962386438
+ home-server [email protected] https://api.example.org photos 3
+```
+
+Commands use the selected account. Adding an account selects it; logging in to an existing one keeps the selection. Change the selection with `ente account switch home-server`, or pick an account for one command with `--account NAME` after the subcommand. `ente account rename personal alice` changes a local name.
+
+## Create an account
+
+```sh
+ente account create --account personal --app photos
+```
+
+The CLI asks for your email, consent to the terms, the verification code it emails you, and a password. It prints `Created personal and signed into Ente Photos.` Then print and store your recovery key:
+
+```sh
+ente account recovery-key --account personal
+```
+
+If creation is interrupted, run the same `account create` command again with the same CLI home and password; it resumes with its saved keys. If the server already has the account, run `ente account login` instead; it completes the login and clears the unfinished creation.
+
+## Log in without prompts
+
+Write the credentials as JSON. All fields are strings:
+
+```json
+{
+ "email": "[email protected]",
+ "password": "correct horse battery staple",
+ "otp": "123456",
+ "totp": "654321"
+}
+```
+
+Include `otp` only when the server asks for an email code; request it first with `ente account request-otp --email [email protected] --app photos --purpose login`. Include `totp` only when authenticator protection is enabled. Then:
+
+```sh
+ente account login --account personal --app photos --input credentials.json --no-input
+```
+
+`--input -` reads the JSON from stdin. Creation works the same way with `--accept-terms`, an `otp` from `ente account request-otp --email [email protected]`, and no `totp`.
+
+## Protect login with an authenticator
+
+```sh
+ente account totp enable --account personal
+```
+
+The CLI prints a secret to add to your authenticator app, asks for a code from it, and prints `Authenticator protection is enabled.` Without prompts, run `ente account totp setup` to get the secret, then `ente account totp enable --input -` with `{"secret": "...", "totp": "..."}`. `ente account totp status` shows the current setting. This protects your account login and is separate from the codes stored in Auth.
+
+## Get a token
+
+```sh
+ente account token --account personal --app photos
+```
+
+Prints the saved API token for that app login. It is a secret. With `--json` the result is `{"token": "..."}`.
+
+## Log out
+
+```sh
+ente account logout --account personal --app auth
+```
+
+Prints `Logged out of Ente Auth for "personal".` Without `--app`, the CLI logs out of every app and removes the account and its local data: `Logged out of Ente Photos and Ente Auth. Removed account "personal" from this device.` `ente account logout --account personal --local` forgets the account on this computer without contacting the server; it cannot be combined with `--app`.
+
+## CLI home
+
+The CLI home is the directory where the CLI keeps its data: an encrypted vault with your accounts and keys, and a database per account with synced metadata.
+
+| System | CLI home |
+| ------- | ---------------------------------------------------------------------- |
+| macOS | `~/Library/Application Support/ente-cli` |
+| Linux | `$XDG_DATA_HOME/ente-cli`, which defaults to `~/.local/share/ente-cli` |
+| Windows | `%LOCALAPPDATA%\ente-cli` |
+
+Set `ENTE_CLI_HOME` to use another directory. The key that unlocks the vault is stored in your operating system's credential store under the service name `io.ente.cli`, keyed by the path of the CLI home. A CLI home that has been moved cannot find its key; move it back, or supply the original key through `ENTE_CLI_VAULT_KEY`.
+
+## Set up a headless machine
+
+A server or container has no credential store. Generate a key once, keep it in a file outside the CLI home that only the job can read, and supply it on every run:
+
+```sh
+umask 077
+mkdir -p "$HOME/.config/ente-cli"
+(set -C; ente vault key generate > "$HOME/.config/ente-cli/vault-key")
+export ENTE_CLI_HOME="$HOME/.local/share/ente-cli-jobs"
+export ENTE_CLI_VAULT_KEY="$(cat "$HOME/.config/ente-cli/vault-key")"
+ente account login --account personal --app photos --input credentials.json --no-input
+```
+
+`set -C` makes the shell refuse to overwrite an existing key file; a replaced key cannot open the vault it was not used to create. Use the same CLI home and key for every later run. Learn more in [Automation](./automation.md).
diff --git a/docs/docs/cli/admin.md b/docs/docs/cli/admin.md
new file mode 100644
index 0000000000..8ff68e3380
--- /dev/null
+++ b/docs/docs/cli/admin.md
@@ -0,0 +1,68 @@
+# Administration
+
+Administer your own server with the account you have whitelisted as an administrator (see [Whitelist admins](../self-hosting/administration/users.md#whitelist-admins)). Log in to that server, then look up a user:
+
+```sh
+ente account login --account home-server --app photos --host https://api.example.org
+ente admin user view [email protected] --account home-server
+```
+
+```
+ID 1580559962386438
+Created 2026-01-05T10:12:00.000000Z
+Plan free
+Storage 10 GB (10737418240 bytes)
+Expires 2027-01-05T10:12:00.000000Z
+```
+
+A user is selected by email or numeric ID. `ente admin user list --account home-server` lists users in creation order, 100 at a time; add `--all` for every user, or `--since 2026-01-01` for users created after a date.
+
+## Change a free subscription
+
+```sh
+ente admin user update-subscription [email protected] --no-limit --account home-server
+```
+
+`--no-limit` sets 100 TB of storage and an expiry 100 years from now. For other values, pass `--storage 500GB`, `--expires 2027-12-31`, or both; an omitted value stays as it is. The CLI shows the old and new limits and asks:
+
+```
+Storage: 10 GB (10737418240 bytes) -> 100 TB (109951162777600 bytes)
+Expires: 2027-01-05T10:12:00.000000Z -> 2126-10-22T09:00:00.000000Z
+Update subscription for [email protected] (1580559962386438) on https://api.example.org as [email protected] (3)? [y/N]
+```
+
+Sizes accept MB, GB and TB with fractions. Dates accept `YYYY-MM-DD` or an RFC 3339 timestamp with a timezone. Paid plans are rejected.
+
+## Reset a login factor
+
+```sh
+ente admin user disable-totp [email protected] --account home-server
+ente admin user remove-passkeys [email protected] --account home-server
+```
+
+Each asks for confirmation and then prints `[email protected] (1580559962386438): Authenticator-code two-factor authentication disabled.` or `...: All passkeys removed.` Neither changes the other factor.
+
+## Delete a user
+
+```sh
+ente admin user delete [email protected] --account home-server
+```
+
+After confirmation: `[email protected] (1580559962386438): Account deleted; data cleanup scheduled. Subscription cancelled: false.` Deletion needs the email address, not an ID.
+
+## Test email
+
+```sh
+ente admin email test --to [email protected] --from [email protected] --from-name "Ente" --account home-server
+```
+
+Prints `Test email request accepted for [email protected].` This confirms the server accepted the request, not that the message was delivered.
+
+## Run unattended
+
+```sh
+ente admin user update-subscription [email protected] --no-limit --yes --no-input --json --account home-server
+```
+
+`--yes` approves a change; `--no-input` only disables prompts, so a change without `--yes` fails. `--json` prints results; prompts and errors still go to the terminal. `user view` returns `id`, `email`, `createdAt` and `subscription`, which is `null` or an object with `productId`, `storageBytes` and `expiresAt`. Listing users, deleting a user, disabling TOTP and removing passkeys need a login under ten minutes old; when yours is older, the CLI prints `administrator login is too old; run account login --account "home-server" --app photos and retry`. When the account is logged into several apps and Photos is not one of them, add `--app auth` or `--app locker` to pick the login to use.
diff --git a/docs/docs/cli/auth.md b/docs/docs/cli/auth.md
new file mode 100644
index 0000000000..66b53664c7
--- /dev/null
+++ b/docs/docs/cli/auth.md
@@ -0,0 +1,65 @@
+# Auth
+
+Make an encrypted backup of your codes:
+
+```sh
+ente account login --account personal --app auth
+ente auth export "$HOME/Backups/Auth" --account personal
+```
+
+The CLI asks for an export password and its confirmation, refreshes your codes from the server, and prints:
+
+```
+Exported 12 codes to /home/alice/Backups/Auth/ente-auth-2026-10-22.json.
+```
+
+The file name carries the date. A second backup on the same day becomes `ente-auth-2026-10-22-2.json`, then `-3`; the CLI never overwrites a backup. The export password is separate from your account password, and nobody can recover it for you.
+
+## Verify the backup
+
+Import it into the Ente Auth app on another device: open `Settings > Data > Import codes`, choose **Ente encrypted export**, select the file, and enter the export password. Check that the number of codes matches.
+
+## Decrypt a backup
+
+```sh
+ente auth decrypt "$HOME/Backups/Auth/ente-auth-2026-10-22.json" --output codes.txt
+```
+
+Prints `Decrypted to codes.txt.` The output is one `otpauth://` link per line. No account or network is needed. Without `--output`, the links go to stdout.
+
+## Show a current code
+
+```sh
+ente auth code view github --account personal
+```
+
+```
+123456
+Valid until 2026-10-22T10:30:30Z
+```
+
+The selector is a code ID, the displayed name, or words matched against the issuer and account name, ignoring case. When several codes match, the CLI lists them and you pick an ID. `ente auth code list --search github` finds codes without showing their values. Codes depend on your computer's clock, so keep its date and time correct.
+
+## Work offline
+
+Add `--offline` to `code list`, `code view` or `export` to use the codes synced by the last online run.
+
+## Export plaintext or stream to stdout
+
+```sh
+ente auth export "$HOME/Backups/Auth" --plaintext --account personal
+ente auth export --output - --account personal > backup.json
+```
+
+`--plaintext` writes unencrypted `otpauth://` links to a dated `.txt` file. `--output PATH` writes to that exact file and refuses to overwrite it; `--output -` writes the backup to stdout with no summary.
+
+## Use from a script
+
+Set `ENTE_CLI_PASSWORD` to the export password; an encrypted backup with `--no-input` requires it, a `--plaintext` export does not. With `--json`, export prints `{"output": "...", "codes": 12, "failures": {"total": 0}}`, `code list` returns objects with `id`, `name`, `issuer`, `accountName` and `type` (`totp`, `hotp` or `steam`), and `code view` adds `otp` and `validUntil` (UTC). `otp` is a string, so leading zeroes are kept. Learn more in [Automation](./automation.md#back-up-auth-codes).
+
+## Limits
+
+- TOTP and Steam codes are shown. HOTP codes are listed and backed up but not shown.
+- Codes in Trash are not listed or shown, but backups include them. Restore them in the Ente Auth app to use them.
+- The CLI does not add, edit or import codes; use the Ente Auth app.
diff --git a/docs/docs/cli/automation.md b/docs/docs/cli/automation.md
new file mode 100644
index 0000000000..f089210d1c
--- /dev/null
+++ b/docs/docs/cli/automation.md
@@ -0,0 +1,126 @@
+# Automation
+
+Schedule a nightly export. Set up the CLI home and vault key first, as described in [Set up a headless machine](./accounts.md#set-up-a-headless-machine), and log in once with `--input`.
+
+**With cron:** save this as `$HOME/.config/ente-cli/export.sh` and make it executable.
+
+```sh
+#!/bin/sh
+export ENTE_CLI_HOME="$HOME/.local/share/ente-cli-jobs"
+export ENTE_CLI_VAULT_KEY="$(cat "$HOME/.config/ente-cli/vault-key")"
+exec "$HOME/.local/opt/ente-cli/bin/ente" photos export "$HOME/Pictures/Ente" --account personal --no-input --json \
+ > "$HOME/.config/ente-cli/last-export.json" 2>> "$HOME/.config/ente-cli/export.log"
+```
+
+Then add a line with `crontab -e`:
+
+```
+30 2 * * * "$HOME/.config/ente-cli/export.sh"
+```
+
+**With Windows Task Scheduler:** prepare the job's CLI home and key once, in PowerShell:
+
+```powershell
+New-Item -ItemType Directory -Force $env:LOCALAPPDATA\ente-cli | Out-Null
+ente vault key generate | Out-File $env:LOCALAPPDATA\ente-cli\vault-key -Encoding ascii -NoClobber
+$env:ENTE_CLI_HOME = "$env:LOCALAPPDATA\ente-cli\home"
+$env:ENTE_CLI_VAULT_KEY = (Get-Content $env:LOCALAPPDATA\ente-cli\vault-key -Raw).Trim()
+ente account login --account personal --app photos --input credentials.json --no-input
+```
+
+Then save this as `%LOCALAPPDATA%\ente-cli\export.ps1`:
+
+```powershell
+$env:ENTE_CLI_HOME = "$env:LOCALAPPDATA\ente-cli\home"
+$env:ENTE_CLI_VAULT_KEY = (Get-Content $env:LOCALAPPDATA\ente-cli\vault-key -Raw).Trim()
+& "$env:LOCALAPPDATA\Programs\EnteCLI\ente.exe" photos export D:\Pictures\Ente --account personal --no-input --json `
+ 2>> $env:LOCALAPPDATA\ente-cli\export.log | Out-File -Encoding utf8 $env:LOCALAPPDATA\ente-cli\last-export.json
+exit $LASTEXITCODE
+```
+
+Register it to run daily at 02:30:
+
+```powershell
+$action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$env:LOCALAPPDATA\ente-cli\export.ps1`""
+$trigger = New-ScheduledTaskTrigger -Daily -At 02:30
+Register-ScheduledTask -TaskName "Ente export" -Action $action -Trigger $trigger
+```
+
+Each run exits with status 0 when the export is complete, writes the summary to `last-export.json`, and appends progress and errors to `export.log`.
+
+## Read results safely
+
+- Exit status 0 means success, 1 means failure or incomplete work, and 2 means the command line was wrong.
+- stdout carries the result. stderr carries progress, prompts and errors.
+- `--json` formats results, not errors. An error is still a line on stderr starting with `Error:`.
+- A failed command can have written part of its result to stdout. Check the exit status before parsing.
+- Lists are JSON arrays; `view` commands and actions are JSON objects.
+
+Capture first, then parse:
+
+```sh
+result=$(ente photos export "$HOME/Pictures/Ente" --account personal --no-input --json) ||
+ { echo "export failed with status $?" >&2; exit 1; }
+echo "$result" | jq '.changes.exported'
+```
+
+## Export summary
+
+```json
+{
+ "output": "/home/alice/Pictures/Ente",
+ "complete": true,
+ "files": 1180,
+ "copies": { "expected": 1200, "completed": 1200, "pending": 0 },
+ "changes": {
+ "exported": 20,
+ "metadataUpdated": 3,
+ "renamed": 0,
+ "movedToTrash": 1
+ },
+ "failures": { "total": 0, "conflicts": 0 }
+}
+```
+
+`files` counts distinct photos and videos; `copies` counts album copies, a photo placed in an album. Both are `null` when the full size of the export could not be determined. `failures.conflicts` counts paths the CLI left alone: files you changed locally, or your own files sitting where the export needs to write. `complete` is `false` whenever `pending` or `failures.total` is above zero, and the exit status is then 1.
+
+## Commands that write raw bytes
+
+These write their payload to stdout unchanged, even with `--json`:
+
+- `ente auth export --output -`
+- `ente auth decrypt FILE` without `--output`
+- `ente photos api`, `ente auth api`, `ente locker api`
+- `ente completion SHELL`
+
+## Back up Auth codes
+
+```sh
+#!/bin/sh
+export ENTE_CLI_HOME="$HOME/.local/share/ente-cli-jobs"
+export ENTE_CLI_VAULT_KEY="$(cat "$HOME/.config/ente-cli/vault-key")"
+export ENTE_CLI_PASSWORD="$(cat "$HOME/.config/ente-cli/auth-backup-password")"
+exec "$HOME/.local/opt/ente-cli/bin/ente" auth export "$HOME/Backups/Auth" --account personal --no-input --json
+```
+
+`ENTE_CLI_PASSWORD` supplies the password for an encrypted backup and is required with `--no-input`; a `--plaintext` export needs none. The result is `{"output": "/home/alice/Backups/Auth/ente-auth-2026-10-22.json", "codes": 12, "failures": {"total": 0}}`. Test a backup by decrypting it: `ente auth decrypt FILE --output -` with the same variable set.
+
+## Make an API request
+
+```sh
+ente photos api /collections/v2 --query sinceTime=0 --account personal
+ente auth api /authenticator/key --account personal
+```
+
+The CLI adds your token and sends the request to the account's server. The response body is written unchanged; a response status outside 2xx exits with status 1 after the body. `--body PATH` and `--headers PATH` read a request body or a JSON object of headers from a file, or from stdin with `-`.
+
+## Handle a failed job
+
+- Run the export again. It resumes and reuses what is already on disk.
+- Read `export.log` for lines containing `conflict:` (a local edit or an occupied path, see [Photos](./photos.md#keep-an-export-updated)) and lines starting with `album:ID:` or `file:ALBUM:FILE:` (an item that could not be refreshed or downloaded).
+- `HTTP 401` means the login is no longer valid. Log in again with `--input`.
+- `cannot unlock CLI vault` or `no saved vault key` means the job runs with a different key or CLI home than the login did.
+
+## For agents
+
+Run `ente help --all` once to learn every command and flag, then call commands with `--json --no-input` and read stdout only after checking the exit status. Supply credentials through `--input PATH` rather than on the command line, and use `--offline` for repeated reads of data that was synced moments ago. The CLI never asks a question when `--no-input` is set; it fails with a message on stderr instead.
diff --git a/docs/docs/cli/index.md b/docs/docs/cli/index.md
index e69de29bb2..e799bb9d6e 100644
--- a/docs/docs/cli/index.md
+++ b/docs/docs/cli/index.md
@@ -0,0 +1,42 @@
+# Ente CLI
+
+`ente` is Ente's client for terminals and agents. Use it from a shell or a script for things like keeping a copy of your Photos library on your own disk, backing up your Auth codes, or administering your own server.
+
+## Export your Photos library
+
+[Install the CLI](./install.md), then log in and export:
+
+```sh
+ente account login --account personal --app photos
+ente photos export "$HOME/Pictures/Ente" --account personal
+```
+
+Login asks for your email and password, and for a verification code when your account requires one. The export prints progress while it runs and ends with a summary:
+
+```
+/home/alice/Pictures/Ente: 1200/1200 album copies complete, 1200 exported, 0 moved to Trash, 0 failures (0 conflicts).
+```
+
+Run the same command again whenever you want to pick up new photos. Learn more in [Photos](./photos.md).
+
+## Find your task
+
+| I want to… | Page |
+| --------------------------------------------------------------------- | --------------------------------------- |
+| Download the CLI, verify it, add it to my PATH, enable completion | [Install Ente CLI](./install.md) |
+| Log in, use a self-hosted server, keep several accounts, run headless | [Accounts](./accounts.md) |
+| Export my library, keep the export updated, find and download a file | [Photos](./photos.md) |
+| Back up my Auth codes or show a current code | [Auth](./auth.md) |
+| Share text through a one-time link | [Paste](./paste.md) |
+| Manage users on my own server | [Administration](./admin.md) |
+| Schedule exports and read results from a script or an agent | [Automation](./automation.md) |
+| Switch from the previous CLI | [Migration](./migration.md) |
+| Fix an error | [Troubleshooting](./troubleshooting.md) |
+
+## Help and output
+
+- `ente help <command>` prints help for one command, for example `ente help photos export`. `ente help --all` prints help for every command. `ente help migration` lists what changed from the previous CLI.
+- `--json` prints the result as JSON. `--no-input` disables prompts, so a script fails instead of waiting. `--offline` reads data the CLI has already synced.
+- `--account NAME` after a subcommand picks a saved account: `ente photos album list --account personal`.
+
+The CLI keeps its data in the CLI home, a directory described in [Accounts](./accounts.md#cli-home). `ente help`, `ente --version` and `ente completion` never create it.
diff --git a/docs/docs/cli/install.md b/docs/docs/cli/install.md
new file mode 100644
index 0000000000..d4ad924797
--- /dev/null
+++ b/docs/docs/cli/install.md
@@ -0,0 +1,95 @@
+# Install Ente CLI
+
+Download the archive for your system from the latest [Ente CLI release](https://github.com/ente/ente/releases?q=tag%3Aente-cli-v), verify it, extract the `ente` executable, and run `ente --version`.
+
+| System | Archive name ends with |
+| ------------------- | ---------------------- |
+| Linux x86_64 | `-linux-amd64.tar.gz` |
+| Linux ARM64 | `-linux-arm64.tar.gz` |
+| macOS Intel | `-darwin-amd64.tar.gz` |
+| macOS Apple silicon | `-darwin-arm64.tar.gz` |
+| Windows x86_64 | `-windows-amd64.zip` |
+| Windows ARM64 | `-windows-arm64.zip` |
+
+Each archive contains one file, the executable. There are no 32-bit builds.
+
+**On Linux and macOS:** download the archive and `SHA256SUMS` from the release page, then:
+
+```sh
+cd ~/Downloads
+shasum -a 256 --check --ignore-missing SHA256SUMS
+mkdir -p ~/.local/opt/ente-cli/bin
+tar -xzf ente-vX.Y.Z-linux-amd64.tar.gz -C ~/.local/opt/ente-cli/bin
+~/.local/opt/ente-cli/bin/ente --version
+```
+
+Use the name of the archive you downloaded. On Linux, `sha256sum --check --ignore-missing SHA256SUMS` works as well. The check prints `OK` after the archive name, and the last command prints `ente` followed by the version.
+
+On Linux, keep the CLI in its own directory: `/usr/bin/ente` may belong to the Ente Photos desktop app.
+
+**On Windows (PowerShell):** download the archive and `SHA256SUMS` from the release page, then:
+
+```powershell
+cd ~\Downloads
+(Get-FileHash ente-vX.Y.Z-windows-amd64.zip).Hash.ToLower()
+Select-String windows-amd64 SHA256SUMS
+New-Item -ItemType Directory -Force "$env:LOCALAPPDATA\Programs\EnteCLI" | Out-Null
+Expand-Archive ente-vX.Y.Z-windows-amd64.zip -DestinationPath "$env:LOCALAPPDATA\Programs\EnteCLI"
+& "$env:LOCALAPPDATA\Programs\EnteCLI\ente.exe" --version
+```
+
+Use the name of the archive you downloaded. The two hashes must match, and the last command prints `ente` followed by the version.
+
+## Add the CLI to your PATH
+
+**On Linux and macOS:** add this line to your shell startup file (`~/.bashrc`, `~/.zshrc` or `~/.config/fish/config.fish`), then open a new terminal:
+
+```sh
+export PATH="$HOME/.local/opt/ente-cli/bin:$PATH"
+```
+
+In fish, use `fish_add_path ~/.local/opt/ente-cli/bin` instead.
+
+**On Windows:** run this once, then open a new terminal:
+
+```powershell
+[Environment]::SetEnvironmentVariable("Path", "$env:LOCALAPPDATA\Programs\EnteCLI;" + [Environment]::GetEnvironmentVariable("Path", "User"), "User")
+```
+
+## Enable completion
+
+Add the line for your shell to its startup file:
+
+| Shell | Startup file | Line |
+| ---------- | ------------------------- | ---------------------------------------------------------------- |
+| Bash | `~/.bashrc` | `eval "$(ente completion bash)"` |
+| Zsh | `~/.zshrc` | `autoload -Uz compinit; compinit; source <(ente completion zsh)` |
+| PowerShell | `$PROFILE` | `ente completion powershell \| Out-String \| Invoke-Expression` |
+| Elvish | `~/.config/elvish/rc.elv` | `eval (ente completion elvish \| slurp)` |
+
+Fish loads a saved script. Write it once, and again after updating:
+
+```sh
+mkdir -p ~/.config/fish/completions
+ente completion fish > ~/.config/fish/completions/ente.fish
+```
+
+## Update
+
+Download the new archive, verify it, and extract it over the existing executable (on Windows, add `-Force` to `Expand-Archive`). `ente --version` prints the new version. Your accounts and data stay in the CLI home (see [Accounts](./accounts.md#cli-home)).
+
+## Uninstall
+
+Log out of each account first if you want the server to forget this device: `ente account logout --account NAME`. Then delete the directory that holds the executable, remove the PATH line, and delete the CLI home.
+
+## Build from source
+
+```sh
+git clone https://github.com/ente/ente.git
+cd ente
+git checkout ente-cli-vX.Y.Z
+cd rust
+cargo install --locked --path apps/cli --root ~/.local/opt/ente-cli
+```
+
+Use the tag of the release you want, as shown on its release page. The executable is written to `~/.local/opt/ente-cli/bin/ente`.
diff --git a/docs/docs/cli/migration.md b/docs/docs/cli/migration.md
new file mode 100644
index 0000000000..e1b6691c5d
--- /dev/null
+++ b/docs/docs/cli/migration.md
@@ -0,0 +1,110 @@
+# Migration
+
+Ente's original CLI was written in Go. The new CLI, written in Rust, was introduced in October 2026 starting with version 0.4.0. The previous CLI (the `cli-v0.x` releases) keeps working and stays supported during the transition, but new development happens only in the new CLI.
+
+The two can be installed side by side, and nothing changes until you act: the new CLI does not read the previous CLI's settings or credentials, and it leaves your exports alone until you ask it to adopt them. Commands have changed; `ente help migration` prints each old command next to its replacement.
+
+A typical switch, for someone whose previous CLI keeps a Photos export up to date:
+
+1. [Install the new CLI](./install.md) next to the previous one.
+2. Log in: `ente account login --app photos`.
+3. Stop the previous CLI's export job, then let the new CLI adopt the existing export: `ente photos export "$HOME/Pictures/Ente" --adopt`. It takes over the folder in place, without downloading everything again. The previous CLI cannot continue that export afterwards, so keep a copy if you want a way back.
+4. Point the scheduled job at the new CLI, then remove the previous one.
+
+Each step, every command and option change, and scripts that parse output are covered below.
+
+## Identify which executable runs
+
+```sh
+ente --version
+```
+
+The new CLI prints `ente` followed by its version; the previous CLI printed its version with `ente version`. Run `which -a ente` on Linux or macOS, or `where.exe ente` on Windows, to see every `ente` on your PATH. Install the new CLI in its own directory (see [Install Ente CLI](./install.md)) and put that directory first in your PATH, or call it by its full path in scripts. A previous-CLI command typed by mistake prints the replacement:
+
+```
+error: 'account add' has been replaced by 'account login'.
+
+For Photos:
+ ente account login --app photos
+
+See all command changes with:
+ ente help migration
+```
+
+## Log in again
+
+```sh
+ente account login --account personal --app photos
+ente account login --account personal --app auth
+```
+
+Each app needs its own login. Accounts are selected by a local name with `--account`, not by email. The CLI home replaces the previous configuration directory: set `ENTE_CLI_HOME` where you used `ENTE_CLI_CONFIG_DIR`. `ENTE_CLI_SECRETS_PATH` has no equivalent; for a headless machine, use `ENTE_CLI_VAULT_KEY` as described in [Accounts](./accounts.md#set-up-a-headless-machine). Learn more in [Accounts](./accounts.md).
+
+## Replace saved export jobs
+
+The previous CLI stored an export directory per account (`account update --dir`) and exported every account with one `export` command. The new CLI takes the destination on each run, one command per account and app:
+
+```sh
+ente photos export "$HOME/Pictures/Ente" --account personal
+ente auth export "$HOME/Backups/Auth" --account personal
+```
+
+Update your cron jobs or scheduled tasks accordingly. Learn more in [Automation](./automation.md).
+
+## Take over a Photos export
+
+The new CLI can adopt (`--adopt`) an export made by the previous CLI and keep maintaining it in place.
+
+1. Stop the previous CLI's export job, and any schedule that runs it.
+2. Keep a copy of the export directory if you want a way back.
+3. Log in: `ente account login --account personal --app photos`.
+4. Run `ente photos export "$HOME/Pictures/Ente" --adopt --account personal`. Pass the same album filters the previous job used (`--album` for each album, `--exclude-album`, `--exclude-shared`, `--exclude-hidden`), or none when it exported everything. The CLI checks the existing files before taking over.
+5. Check the summary line: every album copy should be complete with no failures, and the previous CLI's files should be in place under their album folders.
+6. Point your schedule at the new command without `--adopt` but with the same album filters; a run without them exports every album.
+
+Album filters are now exact and case-sensitive; the previous CLI matched album names ignoring case. Learn more in [Photos](./photos.md#reconnect-or-adopt-an-export).
+
+## Command changes
+
+| Previous CLI | New CLI |
+| --------------------------- | -------------------------------------------------------------------- |
+| `account add` | `account login --app APP [--account NAME] [--host URL]` |
+| `account list` | `account list`; select with `account switch NAME` |
+| `account update --dir DIR` | Pass `DIR` to `photos export DIR` or `auth export DIR` |
+| `account get-token` | `account token --app APP [--account NAME]` |
+| `export` | `photos export DIR --account NAME`, `auth export DIR --account NAME` |
+| `auth decrypt INPUT OUTPUT` | `auth decrypt INPUT --output OUTPUT` |
+| `version` | `--version` |
+
+Account creation and Paste are new in this CLI; see [Accounts](./accounts.md) and [Paste](./paste.md). The CLI does not export Locker.
+
+## Option changes
+
+| Previous option | New CLI |
+| --------------------------------- | ---------------------------------------------------------- |
+| `endpoint.api` in `config.yaml` | `--host` on login; saved with the account |
+| `--albums` | `--album A --album B` (exact names or IDs) |
+| `--exclude-albums` | `--exclude-album A --exclude-album B` |
+| `--shared=false` | `--exclude-shared` (shared albums are included by default) |
+| `--hidden=false` | `--exclude-hidden` (hidden albums are included by default) |
+| `--emails` | One export per account with `--account NAME` |
+| `--password`, `-p` (auth decrypt) | Prompt, or `ENTE_CLI_PASSWORD` |
+| `--admin-user`, `-a` (admin) | `--account NAME`; the target user is a positional argument |
+
+## Administrator commands
+
+| Previous CLI | New CLI |
+| --------------------------- | ----------------------------------------------------------------------------------------------- |
+| `admin get-user-id` | `admin user view EMAIL\|ID` |
+| `admin list-users` | `admin user list --all` |
+| `admin delete-user` | `admin user delete EMAIL [--yes]` |
+| `admin disable-2fa` | `admin user disable-totp EMAIL\|ID [--yes]` |
+| `admin disable-passkey` | `admin user remove-passkeys EMAIL\|ID [--yes]` |
+| `admin update-subscription` | `admin user update-subscription EMAIL\|ID --no-limit`, or `--storage SIZE` and `--expires DATE` |
+| `admin send-mail` | `admin email test --to EMAIL --from EMAIL --from-name NAME` |
+
+Learn more in [Administration](./admin.md).
+
+## Update scripts that parse output
+
+The previous CLI's output formats are not preserved. Use `--json` and the field names in [Photos](./photos.md#read-as-json), [Auth](./auth.md) and [Administration](./admin.md); check the exit status before parsing; and expect raw bytes from the commands listed in [Automation](./automation.md#commands-that-write-raw-bytes). Add `--no-input` so a script fails instead of waiting for a prompt.
diff --git a/docs/docs/cli/paste.md b/docs/docs/cli/paste.md
new file mode 100644
index 0000000000..daab1b60d5
--- /dev/null
+++ b/docs/docs/cli/paste.md
@@ -0,0 +1,53 @@
+# Paste
+
+Share text through a link that works once:
+
+```sh
+ente paste create "Meeting room code: 4821"
+```
+
+```
+https://paste.ente.com/aB3dE9fG#k7Qw...
+```
+
+Send the whole link, including the part after `#`; that part is the decryption key and never reaches the server. The first person to open the link reads the text, and the server deletes it. Unread pastes expire after 24 hours. No account is needed.
+
+## Add a password
+
+```sh
+ente paste create --input notes.txt --password
+```
+
+The CLI asks for a paste password and its confirmation. The reader needs both the link and the password.
+
+## Open a paste once
+
+```sh
+ente paste consume "https://paste.ente.com/aB3dE9fG#k7Qw..."
+```
+
+Prints the text without a trailing newline and asks for the password when the paste has one. The server copy is deleted as soon as it is fetched, even if the key or password is wrong, so a prompted retry only works while the command is still running. On a terminal, control characters other than tabs and newlines are escaped; add `--raw` to print them as they are. With a token and the key as separate values, run `ente paste consume aB3dE9fG --key k7Qw...`.
+
+## Use from a script
+
+```sh
+ente paste create --input notes.txt --password --json
+cat notes.txt | ente paste create
+ente paste consume "$URL" --json
+```
+
+`create` returns `{"url": "..."}` and `consume` returns `{"text": "..."}`. Piped stdin is read when no text or `--input` is given. `--password` still decides whether a paste is protected; `ENTE_CLI_PASSWORD` only supplies the password instead of a prompt. When opening a protected paste, a wrong value fails immediately and the paste is gone.
+
+## Use your own server
+
+```sh
+ente paste create "hello" --host https://api.example.org --paste-origin https://paste.example.org
+ente paste consume "https://paste.example.org/aB3dE9fG#k7Qw..." --host https://api.example.org
+```
+
+`--host` is the API server; `--paste-origin` is the website written into the link.
+
+## Limits
+
+- 4,000 characters; some emoji count as more than one. Text cannot be blank.
+- One read, then gone; 24 hours at most.
diff --git a/docs/docs/cli/photos.md b/docs/docs/cli/photos.md
new file mode 100644
index 0000000000..885c323c83
--- /dev/null
+++ b/docs/docs/cli/photos.md
@@ -0,0 +1,112 @@
+# Photos
+
+Export your library to a directory:
+
+```sh
+ente photos export "$HOME/Pictures/Ente" --account personal
+```
+
+Progress goes to the terminal while originals download:
+
+```
+Refreshing album metadata.
+Refreshing selected albums and Favorites.
+Maintaining 1200 selected copies.
+Completed 480/1200 selected copies.
+/home/alice/Pictures/Ente: 1200/1200 album copies complete, 1200 exported, 0 moved to Trash, 0 failures (0 conflicts).
+```
+
+An album copy is a photo placed in an album; a photo in two albums is two copies, and the summary counts copies. The command exits with status 0 when every copy is complete and 1 otherwise. Press Ctrl-C to stop; the next run continues where it left off.
+
+## Choose albums
+
+```sh
+ente photos export "$HOME/Pictures/Ente" --album Holidays --album Family --account personal
+ente photos export "$HOME/Pictures/Ente" --exclude-album Screenshots --exclude-shared --exclude-hidden --account personal
+```
+
+An album selector is an album ID or its exact, case-sensitive name; find both with `ente photos album list`. `--exclude-shared` leaves out albums owned by other accounts, and `--exclude-hidden` leaves out hidden albums; files hidden individually inside an exported album are still exported. Filters apply to the run you pass them to; files already exported from an album you now exclude stay where they are.
+
+## Export layout
+
+```
+Ente/
+β”œβ”€β”€ export.json
+β”œβ”€β”€ Holidays/
+β”‚ β”œβ”€β”€ metadata.json
+β”‚ β”œβ”€β”€ IMG_0001.jpg
+β”‚ β”œβ”€β”€ IMG_0002.heic
+β”‚ β”œβ”€β”€ IMG_0002.mov
+β”‚ └── metadata/
+β”‚ β”œβ”€β”€ IMG_0001.jpg.json
+β”‚ β”œβ”€β”€ IMG_0002.heic.json
+β”‚ └── IMG_0002.mov.json
+└── Trash/
+ └── 2019 trip/
+```
+
+- `export.json` records which account the export belongs to in `userID`.
+- `<Album>/metadata.json` is the album record: `title` and an `ente` object with `albumID`, `ownerID` and `type`. When `ownerID` equals the `userID` in `export.json`, you own the album.
+- `<Album>/<file>` is the original. A Live Photo is exported as separate image and video files with the same name and different extensions.
+- `<Album>/metadata/<file>.json` is the sidecar for one file: `title`, `photoTakenTime`, `geoData`, `description`, `favorited`, and an `ente` object with `fileID` and `type`.
+- `Trash/` holds albums and files that were removed from your library or from an album since the last run.
+
+Characters that are not portable across filesystems are replaced with `_` in names; a name that is already taken gets a numeric suffix such as `-1`.
+
+## Keep an export updated
+
+Run the same command again. Unchanged files are reused, new files are exported, renamed albums are renamed on disk, removed items move to `Trash/`, and every sidecar is regenerated. Edits you make to an exported original are protected: the CLI leaves the file alone, reports `conflict: at /home/alice/Pictures/Ente/Holidays/IMG_0001.jpg: locally changed media`, and counts it under `failures (conflicts)`. A file of your own that occupies a path the export needs is reported the same way and left alone. To take the library version again, move the edited file elsewhere and rerun; a missing original is downloaded again.
+
+## Save space with hard links
+
+```sh
+ente photos export "$HOME/Pictures/Ente" --hardlinks --account personal
+```
+
+A photo that is in several albums is stored once and linked from each exported album folder; the copy it links to can also be in `Trash/` or in an album you no longer export. Linked files share contents, timestamps and permissions: editing one changes every copy. Later runs without the flag keep the links. The destination filesystem must support hard links.
+
+## Reconnect or adopt an export
+
+To adopt (`--adopt`) an export means to take over one made by the previous CLI or the Ente Photos desktop app, or to reconnect an export this CLI made after you moved it or lost the CLI home. Without the flag, the CLI refuses:
+
+```
+Error: cannot open Photos export /home/alice/Pictures/Ente: This folder contains an export from the old CLI or Ente Desktop. Use --adopt if you want to take it over.
+```
+
+1. Stop the previous CLI job or the desktop app's export.
+2. Log in with the account that made the export.
+3. Run `ente photos export "$HOME/Pictures/Ente" --adopt --account personal`, with the same album filters as before or none. The CLI checks the existing files before taking over.
+
+The flag cannot adopt an arbitrary folder of photos; the folder must contain an export it recognises. Learn more in [Migration](./migration.md#take-over-a-photos-export).
+
+## Find and download a file
+
+```sh
+ente photos album list --account personal
+ente photos file list --album Holidays --account personal
+ente photos file view IMG_0001.jpg --account personal
+ente photos file download 1580559962386999 --output ./IMG_0001.jpg --account personal
+```
+
+A file selector is a file ID or an exact name; when several files share a name, the CLI lists the candidates and you pick an ID. Download prints `Downloaded "IMG_0001.jpg" to ./IMG_0001.jpg.` and refuses to overwrite an existing file. A Live Photo downloads as a ZIP archive. Lists show 100 results and then print `Showing first 100 results; use --limit N or --all to see more.` on the terminal.
+
+## Read as JSON
+
+Lists return arrays and `view` returns one object. IDs are strings; timestamps are RFC 3339 strings in UTC.
+
+| Command | Fields |
+| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `album list`, `album view` | `id`, `name`, `type` (`album`, `folder`, `favorites`, `uncategorized`, `defaultHidden`, `quicklink`), `visibility` (`visible`, `archived`, `hidden`), `ownerId`, `updatedAt` |
+| `file list`, `file view` | `id`, `name`, `type` (`image`, `video`, `livephoto`), `ownerId`, `albumIds`, `createdAt`, `updatedAt`; nullable `modifiedAt`, `location` (`latitude`, `longitude`), `caption`, `hash`, `dateTime`, `offsetTime`, `visibility`, `durationSeconds`, `width`, `height` |
+| `file download` | `id`, `output`, `bytes` |
+| `export` | See [Automation](./automation.md#export-summary) |
+
+## Read offline
+
+`album list`, `album view`, `file list` and `file view` work with `--offline` using the metadata an earlier online run synced. An online `album list` syncs albums only; run `file list` online for each album whose files you want to read offline. Export and download need the network.
+
+## Limits
+
+- The CLI does not import or upload photos.
+- Up to 16 files are processed at once; change that with `--jobs N`.
+- A non-empty destination must already be an export.
diff --git a/docs/docs/cli/troubleshooting.md b/docs/docs/cli/troubleshooting.md
new file mode 100644
index 0000000000..9e251e6081
--- /dev/null
+++ b/docs/docs/cli/troubleshooting.md
@@ -0,0 +1,78 @@
+# Troubleshooting
+
+Errors are printed on stderr as one line starting with `Error:`, and the command exits with status 1. A wrong command line exits with status 2. Find the message below.
+
+## The command is not recognised
+
+```
+error: 'account add' has been replaced by 'account login'.
+```
+
+You typed a previous-CLI command. The error names the replacement, and `ente help migration` lists all of them. Learn more in [Migration](./migration.md).
+
+If `ente` is not found, the installation directory is not on your PATH; see [Install Ente CLI](./install.md#add-the-cli-to-your-path). If `ente --version` prints an error instead of `ente` and a version, another `ente` is running; see [Identify which executable runs](./migration.md#identify-which-executable-runs).
+
+## The account or app cannot be selected
+
+| Message | Fix |
+| ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
+| `no accounts; use account login --app <APP>` | Log in. Check `ENTE_CLI_HOME` if you expected saved accounts. |
+| `no account selected; use account switch <NAME> or name an account explicitly` | Run `ente account switch NAME`, or add `--account NAME` to the command. |
+| `no account named "work"; use account list` | `ente account list` shows the saved names. |
+| `account "personal" is not logged into Ente Auth; use account login --account "personal" --app auth` | Log that account into the app the command needs. |
+| `multiple apps are saved without Photos; select one with --app` | Add `--app auth` or `--app locker` to the `admin` or `totp` command. |
+
+## The vault cannot be unlocked
+
+| Message | Fix |
+| ----------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
+| `no saved vault key for this CLI home` | The key is tied to the path of the CLI home. Move the directory back, or set the `ENTE_CLI_VAULT_KEY` you generated. |
+| `access to system secret storage was denied` | Unlock the credential store, or use `ENTE_CLI_VAULT_KEY` as in [Set up a headless machine](./accounts.md#set-up-a-headless-machine). |
+| `cannot unlock CLI vault: wrong key or damaged file` | `ENTE_CLI_VAULT_KEY` differs from the key used when the vault was created. |
+| `ENTE_CLI_VAULT_KEY must be standard padded base64 of exactly 32 bytes` | Use the value printed by `ente vault key generate` without edits. |
+
+## Login or creation did not finish
+
+- `login requires otp in --input`: the server wants an email code. Request one with `ente account request-otp --email [email protected] --purpose login`, then add it to the input JSON.
+- `Code not accepted. Check the code and your computer's date and time, then try again.`: authenticator codes depend on the clock.
+- `cannot create this account; use account login for an existing account`: the email is already registered. Log in instead.
+- `unfinished creation uses Ente Auth; resume with --app auth`: rerun `account create` with the app you started with and the same password. If the server already has the account, `account login` completes it.
+- `account already exists on this device; use account login`: the account is saved under another name. `ente account list` shows it.
+- `passkey login requires an interactive terminal`: log in once from a terminal, or enable authenticator protection so `totp` can be supplied in JSON.
+
+## Hosts, TLS and server compatibility
+
+- `cannot reach the selected Ente server`: check the host and your network. The CLI trusts the certificates your operating system trusts.
+- `account "home-server" uses https://api.example.org; supply a new account name to log in to another server`: a saved name keeps its server. Use a different `--account NAME`.
+- `host must be an HTTP or HTTPS origin`: pass only the origin, such as `https://api.example.org`, with no path.
+- `File downloads require the v3 API. Update your Ente server or check its proxy configuration.`: the server or its reverse proxy does not serve `/files/download/v3/`. Update the server, and make sure the proxy forwards that path.
+- `HTTP 401`: the saved login is no longer valid; log in again.
+
+## Offline data is missing
+
+- `no local data; run the command online first` (also `no local Photos data` and `no local Auth data`): `--offline` only reads what an earlier online run synced. Run the command once without `--offline`.
+- `files for album "Holidays" have not finished syncing; run the command online first`: the last online run did not finish that album.
+- `download requires network access` and `export requires network access; remove --offline`: these commands always need the network.
+
+## Export problems
+
+| Message | Fix |
+| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
+| `This folder contains an export from the old CLI or Ente Desktop. Use --adopt if you want to take it over.` | Stop the other writer, then rerun with `--adopt`. See [Take over a Photos export](./migration.md#take-over-a-photos-export). |
+| `this export is not associated with this CLI home; use --adopt` | The export was made from another CLI home. Rerun with `--adopt` to reconnect it. |
+| `nonempty destination has no recognized export.json` | The directory holds other files. Use an empty directory or an existing export. |
+| `another writer is maintaining this export` | An export is already running on this directory. |
+| `this export belongs to another source account` | Export with the account that created it, or choose another directory. |
+| `adoption filters must select exactly the recorded album IDs` | Pass the same album filters the previous job used, or none. |
+| `no album matches "holidays"` or `album "Holidays" is ambiguous` | Names are exact and case-sensitive. Use the album ID from `ente photos album list`. |
+| `conflict: at .../IMG_0001.jpg: locally changed media` | You edited an exported file, or a file of yours occupies that path, and the CLI left it alone. Move it away to let the export write there. |
+| `export is incomplete` | The summary line shows pending copies and failures. Read the lines above it, fix the cause, and rerun. |
+
+## The output path cannot be used
+
+- `output already exists: codes.txt`: `--output` never overwrites. Choose a new name, or let `auth export DIR` pick a dated name.
+- `output parent directory does not exist` and `cannot save download to ./IMG_0001.jpg`: create the directory, or pick a name that does not exist yet.
+
+## Report a problem
+
+Open an issue at [github.com/ente/ente/issues](https://github.com/ente/ente/issues) with the output of `ente --version`, your operating system, the command with secrets removed, and the error line.