How to Archive a Confluence Space
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
Regarding spaces, it may come to a point that one or more spaces are not used anymore and you need to archive it. While the best and most pain-free way of doing it would be by leveraging Confluence feature about Retention Rules sometimes you need to do that using a script or custom automated way.
This KB intends to help you understand the possible ways of doing that.
Informational
There are two statuses for a Space – Current and Archived. While you can change this status via the UI, it could be more efficient to bulk edit this status for a large number of spaces by scripting it.
Archiving a space can be useful when the contents of the space are no longer relevant, so these spaces become less visible on your Confluence site. Archiving a space gives you the option to access the space contents at a later time whenever needed.It is also easy to revert an archived space to current again at any time.
Solution
We have a few options to achieve this, and here we will discuss each of them.
Archive space via the Confluence UI
This is the most straightforward method but it does not provide a way to do it in bulk.
You can check our official documentation about how to Archive a Space for more information about how does that work.
Regarding a space archiving of multiple spaces simultaneously, there is an open suggestion to implement this feature under
-
CONFSERVER-83273Getting issue details...
STATUS
Archive space directly in the Database
For this query, it is assumed that you already know the spacekey
of the spaces you want to archive. You may find it helpful to check out Finding Unused Spaces for queries on identifying unused spaces.
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Shutdown Confluence.
The following query can be used to change the status of your space. Replace
<spacekey>
with the desiredspacekey
.UPDATE spaces SET spacestatus = 'ARCHIVED' WHERE spacekey = '<spacekey>';
You can use the same query to change the status of your space from Archived to Current by just replacing the value of spacestatus to 'CURRENT'.
You may need to modify the syntax of your query according to your DBMS. The above query is written for PostgreSQL.
Start Confluence.
If the changes don't take effect, clear the Confluence caches via Cache Management.
Archive space using REST API
From Confluence 8.8 you can use the REST API endpoints, archive
and restore
, to archive and restore a Confluence space.
See Confluence REST API Documentation > api/space > Archive.