Forums

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

Automation for confluence cloud space export in .xml

Radoslav Yordanov September 30, 2025

I am searching for CLI tool or way using CLI to automate the export of one space or many spaces from my confluence cloud instance into .xml so i can back it up or import into another instance
I’d like to automate this on a schedule (e.g. every night) using a script or integration.

My goal is to regularly back up either the entire space or a specific space/page tree without having to manually initiate the export through the Confluence UI.

2 answers

0 votes
Jayesh Raghuvanshi
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 5, 2025

Hello @Radoslav Yordanov 

While there are few request from atlassian to create a feature for space exports but they are currently in gathering interest phase https://jira.atlassian.com/browse/CONFCLOUD-40457 https://jira.atlassian.com/browse/CONFCLOUD-37995 

My suggesstion:

Confluence Cloud doesnot support fully supported REST API endpoint to trigger XM space export, we are left with CLI automation option

Use the Confluence Command Line Interface available in Atlassian Marketplace by appfire

  • This is a paid plugin which provided pre-defined functions to for multiple options for the space like creating a new space, creating a page, copy the content from one page to another, space export, page export, page permissions ext
  • You can write a script using the CLI tool's command and authenticate using the token created by atlassian admin account.
  • Schedule the script on server as cron job


Below is an example of sample script

#!/bin/bash
# Configuration
CONFLUENCE_URL=""
SPACE_KEY=""
ATLASSIAN_USER=""
API_TOKEN=""
OUTPUT_DIR=""
TIMESTAMP=$(date +%Y%m%d%H%M%S)
EXPORT_FILE="${OUTPUT_DIR}/${SPACE_KEY}-backup-${TIMESTAMP}.xml.zip"

# Use the CLI tool (command will vary based on the specific tool)
confluence-cli --action exportSpace --server ${CONFLUENCE_URL} \
--user ${ATLASSIAN_USER} --password ${API_TOKEN} \
--space ${SPACE_KEY} --exportType xml --outputFile ${EXPORT_FILE}

# Add error handling and log creation here
if [ $? -eq 0 ]; then
echo "Successfully exported space ${SPACE_KEY} to ${EXPORT_FILE}"
else
echo "Export failed for space ${SPACE_KEY}"
fi

 

Let me know if you need any other help, We also provide freelancing support for the same.

Thanks

0 votes
Tomislav Tobijas
Community Champion
October 4, 2025

Hi @Radoslav Yordanov ,

You might want to check this open suggestion (and workarounds listed there): CONFCLOUD-40457: Add REST API endpoint for generating space exports 

This other one is also relatively relevant to what you're looking for: CONFCLOUD-37995: Ability to schedule space exports to HTML, XML, or PDF 

Basically, no out-of-the-box solutions are currently out there, but you might want to try these:

1. The Confluence CLI provides such functionality, but it is a paid third-party add-on. The above functionality would be important to automate migration/backup tasks for administrators.

2. Use the atlassian-python-api library, which provides a method called get_space_export in the confluence.py module. This method allows you to trigger space exports through REST API requests. Please note that this library is community-maintained and is not officially supported by Atlassian

Cheers,
Tobi

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events