How can I export page version history details for a given space?

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Problem

An admin would like to export a simple page history with modification dates, name of last modifier, comments and the page version number for every page in a space. This export would be an export of the data that is seen when viewing <Confluence-Base-URL>/pages/viewpreviousversions.action?pageId=XXXX.

Cause

Currently Confluence native functionality does not offer a way to export this history via the UI.

Resolution

You can extract the page history details by running the following query on your database. Be sure to fill in the value of SPACE KEY before running the query.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 SELECT um.username, c.title, c.version, c.lastmoddate, c.versioncomment, c.contentid FROM content c JOIN user_mapping um ON c.lastmodifier = um.user_key WHERE ( c.prevver IN (SELECT contentid FROM content WHERE prevver IS NULL AND contenttype IN ( 'PAGE', 'BLOGPOST' ) AND content_status = 'current' AND spaceid IN (SELECT spaceid FROM spaces WHERE spacekey = '<SPACE KEY HERE>')) AND c.content_status = 'current' AND c.contenttype IN ( 'PAGE', 'BLOGPOST' ) ) OR ( c.prevver IS NULL AND c.contenttype IN ( 'PAGE', 'BLOGPOST' ) AND c.content_status = 'current' AND c.spaceid IN ((SELECT spaceid FROM spaces WHERE spacekey = '<SPACE KEY HERE>')) ) ORDER BY c.title, c.version DESC

⚠️ Depending on what type of database you are running, you may need to format this query differently.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.