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

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

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

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.


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 Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free