CLI

tenon backup

Back up a project and restore it.

tenon backup writes all data of a project into one ZIP file. tenon restore writes such a file back and replaces all data. Both work on the local project or on a deployed site. For what a backup holds and other ways to make one, see Backup and restore.

tenon backup

npx tenon backup
  1. The CLI shows what the backup will hold: entries, media files and their size.
  2. It suggests a file name like tenon-my-site-2026-11-12-1530.zip, from the name in package.json, or from the host with --url. Press Enter to take it, or type another one. Without a terminal, it takes it.
  3. It writes the file.

By default, the file is a full backup: content, versions, media files, users, API keys and jobs. The file appears only when the download is complete, so a failed backup leaves no half-written file.

The file name. The CLI does not ask for it.A content archive: no users, no API keys and no jobs. Use it to move content to another site.Leaves the media files out, for example when the target uses the same bucket.Shows what the backup would hold and the file name, and writes nothing.Takes the suggested file name, and overwrites a file with the same name. Without it and without a terminal, an existing file stops the backup.Backs up a running site instead of the local project. See Local or remote.An API key with read on Backup, instead of tenon login.

tenon restore

npx tenon restore tenon-my-site-2026-11-12-1530.zip
  1. The CLI checks the file against the project, and shows what it deletes and what it writes.
  2. If the file does not fit, it says why and stops. Nothing changes.
  3. It asks whether to back up the current data first. The default is yes.
  4. It asks once more whether to replace all data. The default is no.
  5. It restores the file.
A restore replaces all data and cannot be undone. A full backup also replaces the users and API keys, and signs everyone out. After a remote restore of a full backup, run tenon login again.

A full backup restores only into the same kind of database (SQLite or Postgres) and the same tenoncms version. The check says what differs. A content archive has neither limit, and leaves the users as they are.

Stops after the check. Use it to test a backup before you need it.Backs up the current data first, without asking. --no-backup skips the question.Asks nothing. Without a terminal, it is required. With --yes, the CLI backs up first only with --backup.Restores into a running site instead of the local project.An API key with update on Backup, instead of tenon login.

Examples

Test that last night's backup restores, without changing anything:

npx tenon restore backup.zip --dry-run

Copy the content of production into your local project:

npx tenon login https://example.com
npx tenon backup --url https://example.com --content-only --out production.zip
npx tenon restore production.zip

Back up from a scheduled CI job:

TENON_URL=https://example.com TENON_API_KEY=$BACKUP_KEY npx tenon backup --out "backup-$(date +%F).zip"