Automated Notion backups

1. Register GitLab account

2. Extract notion token and space id

  • Open, go to “Settings & Members” → “Settings”
  • Open Chrome DevTools by pressing Command+Option+J (Mac) or Control+Shift+J (Windows, Linux, Chrome OS)
  • Go to the Network tab, as shown on a screenshot below
  • Enable “XHR” filter (1), clear console (2), start the export (3), select “enqueueTask” (4)
spaceId: “4489c211-09d6-4069-ae3b-1665e25d6c03”

3. Create push token in GitLab

4. Create a GitLab repository to store a backup

5. Set up CI/CD script

6. Schedule a backup job

  • Description: anything you like (e.g Notion Backup)
  • Interval pattern: when do you want to run a backup. For example, mine runs at 4 am daily. Please pick a random minute from 0 to 59 and an hour from 0 to 23 when you want to run the backup. For example, if you want it to run at 5:42 am you should put “42 5 * * *” in. Please don’t just copy-paste this value to make sure everyone doesn’t hit Notion servers at the same time. You might find this schedule editor helpful.
  • Cron Timezone: just pick your timezone
  • Target Brance: leave a master
  • Variables: That’s the values we’ve been collecting so far, plus few constants:
NOTION_TOKEN_V2     paste token_v2 from step 2
NOTION_SPACE_ID paste spaceId from step 2
CI_PUSH_TOKEN paste token from step 3
TZ pick yours from
("TZ database name" column)



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store