Back up and restore a deployment
A backup contains the deployment's workspace and document data, including private PRDs. Choose a location with access limited to the operators who need it. Arrange a maintenance window with your team. Pause connected agents and imports, and ask editors to stop editing until the backup finishes. The export reads D1 and each document room in sequence, so edits made during the export can leave them out of sync. Make the source deployment's operator secret available to the CLI as PRDDD_OPERATOR_TOKEN.
prd admin backup --origin https://prd.example.org --out workspace.ndjsonThe NDJSON file holds D1 records and room data, including revision bodies, threads, comments, activity and approvals. Users sign in again after a restore. Sessions, one-time codes and pending invitations are excluded. OAuth account records omit access, refresh and ID tokens. Re-send pending invitations after recovery. Its trailer records the counts and a SHA-256 digest over the preceding lines. The digest finds a damaged file, not a deliberate edit: anyone who can change the file can recompute it, and a restore imports what the file says, accounts included. Keep backups where only operators can write.
Restore into an empty deployment
Deploy the same application version used for the backup into a destination with no workspaces: a restore refuses an archive that another version wrote and names the version it needs. Restore expects matching D1 and room table columns. To upgrade, restore first, then deploy the newer revision. Signing in creates a personal workspace, so perform the restore before the first sign-in. Set PRDDD_OPERATOR_TOKEN to the destination's secret and double-check the origin.
prd admin restore --origin https://restore.example.org --in workspace.ndjsonThe CLI uploads the file in parts of 32 MiB and then asks the deployment to restore them as one archive, so a backup larger than Cloudflare's 100 MB request body limit still restores. Compare the returned counts with the backup trailer. Sign in to the restored site, open a known document and inspect its revision history, a discussion anchor and a gate approval. The restore preserves IDs. A destination that holds any workspace or any user, even one who only signed in, refuses the restore, and nobody can sign up while a restore runs. A 404 from the admin endpoint can mean the operator token is missing or belongs to a different deployment.