Automate n8n Workflow Backups to GitHub with Cron & API

Save time and avoid manual errors by automating n8n workflow backups directly to GitHub. This workflow uses scheduled cron triggers, GitHub API calls, and data merging to keep your workflow versions safe and up to date.
github
cron
httpRequest
+2
Workflow Identifier: 1390
NODES in Use: Cron, HTTP Request, Function, GitHub, Merge
Automate n8n workflow backups to GitHub

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow backs up n8n workflows automatically to a GitHub repository every day at 23:59.
It solves the problem of manually saving workflows, which can waste time and risk losing data.
The workflow fetches local workflows, checks GitHub for existing backups, then creates or updates files only if changes happened.
This saves time, avoids mistakes, and keeps backups up to date without manual work.


Who should use this workflow

This is for users who run their own n8n instance, especially those who want daily backups of workflow data without manual effort.
It is useful for automation specialists and teams managing many workflows.
Anyone wanting safer, versioned backups on GitHub benefits from running this workflow.


Tools and services used


Inputs, processing steps, and outputs

Inputs

  • Schedule trigger from the Cron node at 23:59 daily.
  • Workflow list and details fetched from the local n8n REST API.
  • Existing backup file details and content downloaded from the GitHub repo.

Processing Steps

  • The HTTP Request node calls the n8n API to get all workflow metadata.
  • The Function node splits workflows into individual items.
  • Another HTTP Request fetches detailed data for each workflow.
  • The GitHub node lists files in the backup repository.
  • A Function node transforms the GitHub file list into usable format.
  • An HTTP Request node downloads raw JSON content of existing backup files.
  • Merge nodes compare local workflows and GitHub files to find new or changed workflows.
  • The GitHub node creates new files for workflows not on GitHub yet.
  • Another GitHub node edits existing files if workflow data changed.

Outputs

  • New workflow backup JSON files added to GitHub.
  • Updated workflow files overwritten only when changes exist.
  • GitHub repository remains clean without duplicates or unnecessary commits.
  • Daily saved backups of all n8n workflows secured on GitHub.

Beginner step-by-step: How to use this workflow in n8n

Importing and setup

  1. Download the workflow file using the Download button on this page.
  2. Open your n8n editor and select Import from File option.
  3. Choose the downloaded workflow file to import.
  4. After import, add necessary credentials:
    • Enter your n8n API Basic Auth credentials in the relevant HTTP Request nodes.
    • Set GitHub API credentials (personal access token with repo rights) in the GitHub nodes.
  5. Update GitHub repository fields in the GitHub nodes to match your account and repo.

Run and activate

  1. Test run the workflow manually to check connections and data flow.
  2. After verification, activate the workflow by toggling the enable switch at the top right.
  3. The workflow will now back up your n8n workflows every day at 23:59 automatically.

For safety, monitor the GitHub repo after initial runs to confirm files create and update correctly.
Refer to self-host n8n if you need help with managing your local n8n instance.


Edge cases and troubleshooting

  • GitHub API errors like 403 or rate limits happen if too many requests occur or token lacks rights.
  • Empty or wrong workflow data occurs when n8n REST API is off or wrong credentials used.
  • The Merge node may not filter duplicates properly if wrong property names or data formats are used.
  • Test all credentials and API URLs before enabling production use.

Customization ideas

  • Change the backup time in the Cron node by adjusting the schedule.
  • Back up to a different GitHub repo by editing the repository fields.
  • Add filters in the HTTP Request node fetching workflows to exclude some workflows.
  • Duplicate GitHub nodes to save backups to multiple repositories.
  • Extend workflow to also back up workflow execution history if needed.

Summary

✓ Automatically backs up n8n workflows daily to GitHub.
✓ Avoids manual saving and mistakes.
✓ Only creates or updates files when needed to reduce commits.
✓ Keeps backups organized without duplicates.
✓ Saves user time and protects workflow data securely.


Automate n8n workflow backups to GitHub

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Yes, update the HTTP Request URLs to the cloud instance address and ensure API access and credentials are configured correctly.
The workflow makes several calls daily to list files, download content, and create or update files, which is minimal if run once per day.
Incorrect API URL or missing Basic Auth credentials causes empty or incorrect data from the n8n API HTTP Request node.
This happens when property names used for matching in the Merge node do not exactly match the workflow data fields or the JSON structures differ.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.