The note-taking tool that I use most is Notion. Most of my personal and professional information is stored there. Losing it would cause real trouble, which is exactly why backing it up matters. I know that, and I still forget to do it once things get busy. What worries me isn’t some dramatic failure. It’s the quiet kind where something important disappears, and I don’t notice until later.
Notion lets you export a single page directly from that page, or export your entire workspace in Settings — both manual. Notion’s own help docs confirm there’s no way to schedule it. Asked directly whether automatic backups are possible, Notion says, “not at the moment.” I went looking for a way around that and found a post by Shayan. He wrote a Go script that calls Notion’s internal export API, runs it on a schedule with cron, and pushes the result into an encrypted Google Drive folder with rclone, an open-source CLI for managing cloud storage.
This was exactly what I was looking for, so I followed it right away and adjusted it to match what my workflow needed. Here’s what I ended up running.
How I run the automated backup
The original method exports one page and recurses down from there, pulling in every block underneath it, including subpages. What I wanted was the whole workspace, and I didn’t need encryption either. If everything you keep in Notion lives under one page, Shayan’s method is the simpler route. See his post linked above for details.
Setup steps
The setup is lightweight. Here are the five steps:
Download the repo from the link below and open Terminal in that folder.
Copy two cookies from your browser, the keys the script uses to access Notion.
Save both cookies in a private file in your home directory.
Run the script once to get your workspace ID.
Set the backup schedule with macOS’s built-in scheduler.
The script keeps everything on your own device, and what you download is Notion’s official export format.
Download link
I used Claude to help write this script in Python. It only uses the standard library, with no extra packages to install. I built and use it on macOS and haven't tested other systems, but it should run fine with minor adjustments.
The next section covers a few key points of this setup. For every step in detail, see README.md.
Key configuration
The script needs two cookies. Getting them is the one part that happens in your browser.
Log into notion.so in Chrome, right-click anywhere and choose Inspect to open DevTools, go to the Application tab, expand Cookies under Storage, and click into https://app.notion.com. Find two rows there, token_v2 and file_token. The former calls the API, and the latter downloads the file.
file_token has a catch. It might not be there yet, because logging in alone doesn’t create it. Notion writes it after you complete an export, so open any page, hit the three dots in the top right, choose Export, and it appears. (A single page is faster than the whole workspace, and this export is just to trigger the cookie.) DevTools’ cookie panel doesn’t auto-refresh, so reload it and you’ll see it’s there.
I store both cookies in a JSON file in my home directory. Treat both like a password, since anyone holding token_v2 is signed in as you. On macOS and Linux, the file's permissions are set to 600 for security, so only your own account can read it, not anyone else logged into the same machine. The script refuses to run if that permission is too loose. Windows handles file permissions differently, so just put the file somewhere no one else can access. (You can use environment variables to store cookies instead, though a few details end up slightly different.)
My remote backup is the lazy version. I already have the Google Drive app installed, so there’s a folder syncing constantly anyway. The script writes a dated zip to a local path, with an optional second path for an extra copy, which is unset by default. Both are configurable. I pointed the second one at a backup folder under my Google Drive, and that’s the whole remote backup.
Near the top of the script are a few export options that match Notion’s own export dialog: markdown or HTML, current view or default view, include uploaded files or not, and separate folders for subpages or not. Adjust them to fit how you work.
Scheduling uses launchd, the scheduler built into macOS. I set mine for Monday at noon, to match my weekly check window. If the Mac is asleep at the scheduled time, launchd runs the backup as soon as it wakes. Miss more than one scheduled run in a row, and they combine into a single one on wake. On Linux, you’d use a systemd timer instead, and on Windows, Task Scheduler.
Once it’s set up, you don’t have to worry about forgetting to back up anymore. It just runs quietly in the background on its own.
Before you rely on this
The catch-up in launchd only covers sleep. If the Mac is fully shut down at the scheduled time, that run is skipped, and the next one happens on its regular schedule.
This script only ever keeps the latest snapshot, which means whatever was downloaded most recently. Once a download finishes, it replaces the previous snapshot with the new one, and the same goes for the sync path. It saves disk space, but if something goes missing without you noticing and the backup interval has already passed, Notion’s own Version history is all you have left to recover it. But on the Free plan, that’s only 7 days.
The cookies also expire eventually. When that happens, the script writes a failure to backup-log.txt in its own folder. Replace both cookie values in the JSON file where you saved them, and the next run will work again.
The way Notion’s API is called could also change with a future update. This isn’t zero-maintenance, so you might need to set it up again down the line.
Also, my version isn’t encrypted. If you’re storing anything sensitive and want encryption, the rclone setup mentioned earlier covers that.
If this tool ever gets updated, I’ll keep this post and the repo in sync. I hope it saves you from that same worry.
Somehow, while building this, I kept thinking about these steps, from getting the cookie to setting up the schedule. All of it still feels like too much. Maybe this should just be an app?


