Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Confluence automation to archive inactive spaces

Don Hames
Contributor
August 21, 2026

Hi everyone. I took on the "simple" task to write a Confluence Automation Flow that would archive inactive spaces. Since there is no configuration setting to turn off the auto-creation of a personal space whenever you join Confluence, it has resulted in thousands of personal sites that have never been used.

Sounds like a nobel idea to cleanup the unused spaces by deleting or archiving them, right? I know the conditions to check for:

trigger = scheduled

Branch Flow / Related Entities using CQL space.type = personal

AND {{page.count}} = 0

AND ( Last activity date is empty OR Last activity date is more than 180 days ago)

Then archive the space.

The issue I ran into is Confluence CQL does not appear to have a way to check the last activity date on a space. The space object seems to be somewhat limited.

This should be simple, until it's not. In Jira, this would take 20 seconds. Anyone had any success with attempting a Flow like this or something similar?

I truely appreaciate your input. Thanks.

 

2 answers

0 votes
Pratibha Kumari
August 21, 2026

I think the challenge here is that Confluence Automation and CQL expose much less space-level metadata than Jira does. Your logic makes sense, but without a reliable “last activity” field on the space entity, the 180-day condition becomes difficult to evaluate directly.

One possible approach might be to derive inactivity from the content level—such as checking for recently created or updated pages/blog posts—rather than relying on a space-level last activity date. You could then combine that with the personal-space and zero-page conditions before taking the archive action.

It would be great if Atlassian exposed a proper lastActivityDate (or equivalent) for spaces in CQL/Automation. That would make this type of cleanup flow much simpler and safer to automate.

0 votes
Martin Runge
Community Champion
August 21, 2026

Hi @Don Hames

The core issue is that CQL indexes content, not containers, so a space has no "last activity" field to query, and an empty space has no content rows to match. I would skip CQL and use a Send web request in the flow against the v2 API: page through /wiki/api/v2/spaces?type=personal, then for each space hit /wiki/api/v2/spaces/{id}/pages?limit=1&sort=-modified-date to get both the emptiness check and the last modified date in one call, and archive from there.

I have experienced that personal spaces sometimes get recreated the moment the user visits their profile again.

Cheers, Martin

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
ENTERPRISE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events