How to Archive Stale Confluence Pages with Automation and the REST API
Learn how to use Confluence Automation and the REST API to flag, move, and archive stale pages. A step‑by‑step guide with example rules, safety checks, and trade‑offs for Cloud and Data Center.
05 May 2026, 01:20 UTC

Why Archiving Matters
Confluence can quickly turn into a sprawling archive of pages that are no longer relevant. Unused content inflates storage, pollutes search results, and makes it harder to find the information you actually need. A disciplined archival strategy keeps the space lean, preserves audit trails, and keeps compliance requirements in check.
Key Ingredients of a Policy‑Driven Archive
- Automation – schedule rules that flag or move pages without manual intervention.
- CQL (Confluence Query Language) – filter pages by age, labels, or space.
- Archive Space – a dedicated space that holds archived pages with read‑only permissions.
- REST API – programmatic bulk moves and status changes for fine‑grained control.
Step 1: Create an Archive Space
In Cloud, create a new space called Archive and set its permissions so that only admins can edit but all users can view. In Data Center, use the same naming convention and apply a restrictive Space Permissions tab.
Why a Separate Space?
Moving a page to a different space preserves its version history, comments, and existing links better than deletion. It also keeps the page visible to auditors while removing it from normal search results.
Step 2: Build an Automation Rule
Automation is native in Confluence Cloud and available as an add‑on for Data Center. The rule below runs every day, finds pages older than 30 days that are not marked keep or active, and tags them for archival.
# Rule: Flag stale pages for archival
When: Scheduled – Daily at 02:00 UTC
If: CQL = "lastmodified < -30d AND label NOT IN (keep, active)"
Then:
- Add label: archive-candidate
- Notify: Space admins via email
Placeholders:
lastmodified < -30d– pages not edited in the last 30 days.label NOT IN (keep, active)– exclude pages that are explicitly kept.
Permissions & Limits
- Automation rules require Space Admin rights to create and edit.
- Cloud Free/Standard plans limit the number of rule executions per month; check
Settings → Automationfor your quota. - Data Center needs the Automation for Confluence app license.
Step 3: Move Flagged Pages via the REST API
After the rule has flagged pages, you can batch‑move them to the archive space using the REST API. Below is a curl example that archives a single page; you would loop over the results in a script.
# Variables
API_TOKEN="YOUR_API_TOKEN"
BASE_URL="https://your-site.atlassian.net/wiki"
PAGE_ID="123456" # ID of the flagged page
ARCHIVE_SPACE_KEY="ARCH" # Key of the Archive space
# Archive the page
curl -X POST \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"status":"archived"}' \
"$BASE_URL/rest/api/content/$PAGE_ID?status=archived"
# Move the page to the archive space
curl -X PUT \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"space":{"key":"'${ARCHIVE_SPACE_KEY}'"}}' \
"$BASE_URL/rest/api/content/$PAGE_ID"
Key points:
- Use the
status=archivedquery parameter to set the page to archived. - The
PUT /content/{id}call changes the parent space. - Run the script with
adminOAuth or API token that hasconfluence-adminscope.
Safety Checks
- Verify the page appears in the
Archivespace by browsing it or usingGET /content/{id}. - Confirm the page’s
archivedstatus in the audit log:Settings → Audit Log → Page archived. - Check that the page still shows up in the
Page historyand that comments are intact.
Trade‑Offs and Caveats
Archiving cleans up the UI, but aggressive policies can break hidden dependencies:
- Links from Jira issues or other Confluence pages may point to a moved page; the link will resolve but show a 404 if the user lacks permissions in the archive space.
- External bookmarks or embedded content that reference the page ID will become stale.
- Archived pages still consume storage in Cloud; only permanent deletion frees quota.
A common mitigation is a 90‑day quarantine label. Pages first receive quarantine, notify stakeholders, and after review are either keep or archive-candidate. This gives teams time to discover broken links before the final move.
Practical Checklist
- Create an
Archivespace with read‑only permissions. - Set up an automation rule to flag stale pages.
- Run a dry‑run script that logs candidate page IDs.
- Execute the REST API moves in batches, monitoring the audit log.
- Periodically review the
Archivespace for orphaned or outdated content. - Adjust the CQL thresholds and labels as the team’s workflow evolves.
Actionable Takeaway
Start small: pick a single space, set a 30‑day rule, and archive a handful of pages. Verify the audit trail, check search behavior, and confirm that permissions are preserved. Once the process is validated, scale to the rest of your Confluence environment, keeping an eye on rule execution limits and storage impact.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.