Have you ever needed to backup your Confluence pages? Or migrate documentation to another system? Or simply want your Confluence content in Markdown format for version control?
I've built Confluence Export CLI - a powerful command-line tool that exports Confluence pages to multiple formats (Markdown, HTML, Text, PDF) with support for bulk exports, parallel fetching, and recursive child page export.
Why I Built This
Working with Confluence documentation, I often needed to:
- Export entire documentation spaces for backup
- Convert Confluence pages to Markdown for Git-based workflows
- Migrate documentation between systems
- Create offline backups of critical documentation
The existing solutions were either too complex, required manual work, or didn't support bulk exports. So I built a tool that does exactly what I needed - and made it open source for others to use.
Key Features
π Multiple Export Formats
Export to the format that works best for your workflow:
- Markdown - Perfect for Git-based documentation
- HTML - Standalone HTML files with embedded CSS
- Plain Text - Great for search and archival
- PDF - Native Confluence PDF export
# Export to multiple formats at once
confluence-export --pages 123456 --format markdown html pdf
π¦ Bulk Export with Parallel Processing
Export hundreds of pages efficiently with configurable parallel workers:
# Export entire space with 8 parallel workers
confluence-export --space DOCS --format markdown --workers 8
π³ Recursive Child Page Export
Automatically export parent pages and all their children:
# Export a page and all its sub-pages
confluence-export --pages 123456 --include-children --format markdown
π― Flexible Input Options
Support for multiple input methods:
-
Full URLs:
https://yoursite.atlassian.net/wiki/spaces/DOCS/pages/123/Page+Title -
Page IDs:
123456 -
From file:
--pages-file pages.txt -
Entire spaces:
--space DOCS
π Progress Display & Export Manifest
Beautiful progress bars using Rich library, plus optional manifest generation:
confluence-export --pages 123456 --include-children --manifest
Creates INDEX.md and manifest.json listing all exported pages.
Quick Start
Installation
pip install confluence-export
Setup Authentication
Get your API token from Atlassian API Tokens:
export CONFLUENCE_BASE_URL=https://yoursite.atlassian.net
export CONFLUENCE_EMAIL=your.email@example.com
export CONFLUENCE_API_TOKEN=your-api-token
Export Your First Page
# Using a full URL
confluence-export --pages "https://yoursite.atlassian.net/wiki/spaces/DOCS/pages/123456/My+Page" --format markdown
# Or using a page ID
confluence-export --pages 123456 --format markdown
Real-World Examples
Backup an Entire Documentation Space
confluence-export \
--space DOCS \
--format markdown html pdf \
--include-children \
--manifest \
--output "./backup-$(date +%Y%m%d)" \
--workers 8
Export Documentation Section with Sub-pages
confluence-export \
--pages "https://mysite.atlassian.net/wiki/spaces/DOCS/pages/123/Getting+Started" \
--include-children \
--format markdown \
--manifest \
--output ./docs
Export from a File of URLs
Create pages.txt:
https://mysite.atlassian.net/wiki/spaces/DOCS/pages/123/Page+One
https://mysite.atlassian.net/wiki/spaces/DOCS/pages/456/Page+Two
789012
Then:
confluence-export --pages-file pages.txt --format markdown
Technical Highlights
Architecture
The tool is built with Python 3.8+ and follows clean architecture principles:
- Modular Design: Separate exporters for each format, easy to extend
-
Parallel Processing: Uses
ThreadPoolExecutorfor concurrent API calls -
Error Handling: Graceful error handling with
--skip-errorsoption - Configuration Layers: CLI args > Config file > Environment variables > Defaults
Distribution Options
I've made it easy to distribute and use:
-
Wheel Package: Install via
pip install confluence-export -
Standalone Executables: No Python required - download and run
- Linux, Windows, and macOS executables
- Built with PyInstaller
- Available in GitHub releases
GitHub Actions Workflow
Automated builds and releases:
- Builds wheel packages and executables for all platforms
- Creates GitHub releases automatically
- Publishes to PyPI on tag push
Configuration File Support
Save your settings to avoid repeating them:
confluence-export --base-url https://mysite.atlassian.net \
--email user@example.com \
--output ./exports \
--format markdown html \
--save-config
Creates .confluence-export.toml:
[auth]
base_url = "https://mysite.atlassian.net"
email = "user@example.com"
[export]
output = "./exports"
formats = ["markdown", "html"]
include_children = true
Now you can just run:
confluence-export --pages 123456
Output Structure
Hierarchical (Default)
Preserves page hierarchy in folder structure:
exports/
βββ Parent-Page-123.md
βββ Parent-Page/
βββ Child-Page-456.md
βββ Child-Page/
βββ Grandchild-789.md
Flat Structure
Use --flat for a single directory:
exports/
βββ Parent-Page-123.md
βββ Child-Page-456.md
βββ Grandchild-789.md
Use Cases
- Documentation Migration: Export Confluence docs before migrating to another platform
- Version Control: Convert Confluence pages to Markdown for Git-based documentation
- Backup: Create regular backups of critical documentation
- Offline Access: Export documentation for offline viewing
- Content Analysis: Export to text format for analysis or search indexing
Contributing
The project is open source and welcomes contributions! Areas where help is appreciated:
- Additional export formats (DOCX, LaTeX, etc.)
- Performance improvements
- Documentation improvements
- Bug fixes and feature requests
Check out the GitHub repository to get started.
Conclusion
Confluence Export CLI solves a real problem for teams working with Confluence documentation. Whether you need to backup your docs, migrate to another system, or simply want your content in a different format, this tool makes it easy.
Try it out:
pip install confluence-export
confluence-export --help
Star the repo: github.com/adriandarian/confluence-export
Have questions or feedback? Open an issue on GitHub or reach out!
Top comments (0)