Restore Pages
page restore puts one page back into Confluence from a backup, and page check tells you first whether it needs to. The backup is a file written by page get — ideally with --attachments-dir, so the page’s files come back too — or one page of a space backup taken with acs2md space get.
Available from acp2md v1.0.12. page restore is the only acp2md command that
writes to Confluence. It shows its plan and asks before writing, and never
deletes, trashes, archives or moves anything.
Back up a page
# The page with its metadata, and its attachments beside it
acp2md page get by-id 2973106197 -o ./backups/page.json --attachments-dir ./backups/attachmentsatlas_doc_format (the page get default) keeps the page’s title, parent, version and labels in the JSON, which is what a restore needs.
page check
Compare one backed-up page with the page Confluence holds now. Nothing changes.
acp2md page check --file PAGE_FILE [--attachments-dir DIR] [flags]
acp2md page check --backup-dir SPACE_BACKUP --page-id PAGE_ID [flags]Aliases: verify, diff
| Flag | Short | Default | Description |
|---|---|---|---|
--file | — | — | Page file written by page get |
--attachments-dir | — | — | Attachments saved by page get --attachments-dir |
--backup-dir | — | — | Space backup written by acs2md space get |
--page-id | — | — | Page of the space backup to check |
--space-key | — | the backup’s | Space to check in |
--title | — | — | Title to look for (needed for a storage file) |
--format | -f | table | Output format: table or json |
--fail-on-drift | — | false | Exit with an error when anything differs |
The report gives the page’s state — ok, changed, renamed, moved, trashed, archived, in another space or missing — the backed-up and live versions, whether the body is the same, and the backed-up attachments and labels the page no longer has.
acp2md page check --file ./backups/page.json --attachments-dir ./backups/attachmentspage restore
acp2md page restore --file PAGE_FILE [--attachments-dir DIR] [flags]
acp2md page restore --backup-dir SPACE_BACKUP --page-id PAGE_ID [flags]Aliases: recover
Examples
# See what would happen first
acp2md page restore --file ./backups/page.json --attachments-dir ./backups/attachments --dry-run
# Restore the page, with its attachments
acp2md page restore --file ./backups/page.json --attachments-dir ./backups/attachments
# Restore one page of a space backup, unattended
acp2md page restore --backup-dir ./backups/DEVOPS --page-id 3134096561 --yes
# Restore under another title, into another space
acp2md page restore --file ./backups/page.json --space-key ARCHIVE --title "Runbook (2025)"Flags
| Flag | Short | Default | Description |
|---|---|---|---|
--file | — | — | Page file written by page get |
--attachments-dir | — | — | Attachments saved by page get --attachments-dir |
--backup-dir | — | — | Space backup written by acs2md space get |
--page-id | — | — | Page of the space backup to restore |
--space-key | — | the backup’s | Space to restore into |
--mode | — | auto | If the page exists: auto, create, update |
--title | — | backed-up title | Title for the restored page |
--parent-id | — | — | Parent page for a created page |
--prefer-version-restore | — | true | Revert to the backed-up version when it exists |
--overwrite-properties | — | false | Replace content properties whose value differs |
--dry-run | — | false | Show the plan without writing anything |
--yes | -y | false | Apply without asking for confirmation |
The plan comes first
♻️ Restore "Release Checklist" from ./backups/page.json
Target space: DevOps (DEVOPS)
In Confluence: trashed
Page: create a new page under "2 - Operations" (3133376085)
Attachments: upload 3 (412.0 KB)
Labels: add release, ops
Properties: add the 2 backed-up ones the new page lacks
Note: the original page is trashed; the restore is a new page with a new ID
Restore this page? [y/N]In a terminal, page restore asks before writing. In a script, pass --yes; without it, the command stops before writing anything. --dry-run shows the plan and writes nothing.
What it does
| The page in Confluence | What page restore does (--mode auto) |
|---|---|
| Current, same version as the backup | Leaves the body; adds back missing attachments, labels and properties |
| Current, newer version | Restores the backed-up version, keeping the page’s ID and history. If that version is no longer in the page’s history, writes the backed-up body as a new version |
| Current, older version | Writes the backed-up body as a new version |
| Trashed, archived, in another space, or gone | Creates a new page with the backed-up title, body and parent |
--mode create always creates a new page; --mode update only updates a page that is current in the space.
Attachments, labels and properties. Backed-up attachments the page does not have are uploaded under their original names, and missing labels and content properties are added. Nothing the page already has is removed. A property with a different value is kept — apps keep their state in properties, such as a document-control approval state — unless you pass --overwrite-properties. Images in an atlas_doc_format body are pointed at the uploaded files.
Where a created page goes. Under --parent-id when given; under its backed-up parent when that page or folder is still in the space; otherwise at the top of the space.
Titles. A space cannot hold two current pages with the same title; a page in the trash does not hold its title, so a trashed page comes back under its own. When a live page already has the title, the restore stops and names that page: rename it, or pass --title.
If the connection drops. A page create whose answer is lost is looked up by title before anything else happens, so a retry never creates a duplicate.
What cannot come back
A created page is a new page: its ID, authors, creation date and version history are new, and links from other pages that pointed at the old ID still point there. The version a restore writes says “Restored by acp2md from a backup taken” and the backup’s date; it never names a local path.
Permissions
Restoring needs the Confluence permissions to add and edit pages in the space, to add attachments, and to add labels.
To restore everything a space lost, or a whole space, use
acs2md space restore.