# Todoist Actual Backup Todoist is a SaaS task manager. Todoist provides backups of current tasks, but they do not include completed tasks, subtask relationships, comments or attachments. Nor does it provide a human-readable backup in HTML. This Python script provides a command-line tool to export all available active and completed tasks from the Todoist API to a JSON file, including attachments, subtasks and comments, and generates a human-readable HTML backup. ## Features - Exports all active and completed tasks from all projects (active and archived) - Nests tasks under their respective projects, including all available fields - Includes comments for each task - Downloads attachments to `output/attachments/` and references them in the JSON and HTML output - JSON and HTML files are named with the current date when the script is run - Maintains `Todoist-Completed-History.json` so completed tasks older than Todoist's 90-day API window stay in future exports - Reuses archived comments for completed tasks to avoid unnecessary API calls (assumes no new comments after completion) ## Setup - Ensure you have Python 3.8 or newer installed. Check with `python --version` on the command line. - The script uses a `.venv` for dependencies. Run: ```bash python -m venv .venv source .venv/bin/activate pip install -r requirements.txt ``` - Get your API key from [Todoist](https://app.todoist.com/app/settings/integrations/developer) - Optionally set your Todoist API key in the `TODOIST_KEY` environment variable. If the environment variable is not set, the script will prompt for it. ## Usage 1. Run `source .venv/bin/activate` if needed to enter the virtual enivronment. 2. To see usage instructions, run the script with no arguments or any argument other than `export`. 3. Run the script with the `export` argument: ```bash python export_todoist.py export ``` This will create `output/Todoist-Actual-Backup-YYYY-MM-DD.json` and `output/Todoist-Actual-Backup-YYYY-MM-DD.html`, and it will update `output/attachments/` with any downloaded files while leaving `Todoist-Completed-History.json` in the project root. Keep `Todoist-Completed-History.json` somewhere safe (e.g., in source control or a backup location); it is the only way the exporter can retain completions older than Todoist's 90-day API retention window. ## Requirements - Python 3.8+ - [todoist-api-python](https://doist.github.io/todoist-api-python/) - [Jinja2](https://palletsprojects.com/p/jinja/) ## MIT License Copyright © 2025 bagaag.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.