Use this robust n8n workflow template to schedule automatic, reliable backups of all your n8n workflow configurations directly to GitHub, ensuring version control and disaster recovery.
Download this n8n workflow template and start using it instantly.
Ensuring the integrity and availability of your automation assets is paramount. This highly valuable n8n workflow solves the critical problem of manual or infrequent backups by automating the entire process. By utilizing a scheduled n8n trigger and leveraging the n8n API, the workflow exports all current n8n workflow definitions as a JSON file and pushes them to a designated GitHub repository every six hours (customizable). This provides immediate, version-controlled disaster recovery capability, allowing users to effortlessly rollback changes, track historical configurations, and gain peace of mind that their hard work—the underlying n8n template logic—is secure. This dedicated n8n node sequence is a vital addition to any self-hosted n8n environment.
This automation initiates using the Schedule Trigger n8n trigger, configured to run every six hours.
Get All Workflows n8n node. This HTTP Request node hits the n8n instance's REST API endpoint (/rest/workflows) to fetch a JSON array containing all active n8n workflow definitions. Authentication is handled via the X-N8N-API-KEY header.Move Binary Data n8n node, which converts the JSON structure into a binary format suitable for file upload, ensuring the backup is handled correctly by GitHub.backup.json file in GitHub using the Edit a file n8n node. This node is configured with an important setting: onError: continueErrorOutput. This means if the file does not exist (resulting in a 404 error from GitHub), the workflow does not stop but passes the error data forward.If file not exits? n8n node checks the output of the 'Edit' step. If the output contains the specific error message, "The resource you are requesting could not be found," it confirms the file is missing.Create a file n8n node, which performs the initial commit of the backup.json file. If the file already existed and was successfully edited, the workflow terminates successfully after Step 3.To deploy and utilize this n8n template, follow these steps:
Edit a file and Create a file n8n node instances. This typically requires a Personal Access Token with repository write permissions.owner, repository, and filePath parameters in both GitHub n8n node instances to match your desired backup repository.Get All Workflows HTTP Request n8n node:https://my.n8n.domain.com/rest/workflows?limit=9999). in the X-N8N-API-KEY header with a valid API key from your n8n user settings.Schedule Trigger n8n trigger node if you require backups more or less frequently than the default 6 hours.This n8n workflow relies on several core n8n node types to achieve reliable, scheduled version control:
Schedule Trigger (n8n trigger):
Function: Starts the entire n8n workflow automation flow at specified intervals.
Key Configuration: Set to trigger every 6 hours (hoursInterval: 6).
Get All Workflows (HTTP Request n8n node):
Function: Retrieves all workflow data from the running n8n instance via the internal REST API.
Key Configuration: Uses a customized URL (/rest/workflows?limit=9999) and requires authentication using the X-N8N-API-KEY header.
Move Binary Data (n8n node):
Function: Converts the JSON data containing all n8n workflow definitions into a binary file format, which is required for GitHub file operations.
Key Configuration: Mode set to jsonToBinary and fileName dynamically set to backup.
Edit a file (GitHub n8n node):
Function: Attempts to update the existing backup.json file in the GitHub repository.
Key Configuration: operation: edit, binaryData: true, and crucially, onError: continueErrorOutput to allow error handling if the file does not exist.
If file not exits? (If n8n node):
Function: Implements conditional logic. It checks if the preceding 'Edit file' n8n node failed because the resource (file) could not be found, indicating a first run or missing backup file.
Key Configuration: Checks if the error message equals "The resource you are requesting could not be found".
Create a file (GitHub n8n node):
* Function: Executes only if the conditional check confirms the file does not exist, creating the initial backup.json file in the repository.
Use this robust n8n workflow to automatically back up all your n8n workflow configurations daily to Google Drive. Features include conditional logic, Gmail alerts, and Discord notifications. Get essential n8n templates here.

Implement a dual-redundancy backup system using this n8n workflow template. Automatically save all n8n workflow configurations to Google Drive and GitHub for secure version control.

Secure your automation logic. This powerful n8n workflow automatically backs up all active n8n templates and n8n workflows to Google Drive using the native n8n node and scheduled n8n trigger.

Use this advanced n8n workflow to automatically backup and version control your n8n workflows to GitHub. Features intelligent change detection, rename support, and optional Telegram reports.

I'm a developer with 5 years of experience in Python and Node.js. Over the past year, I've been building workflows to streamline operations for my team. I have also developed RAG chatbots, AI agents, and WhatsApp automation. If you need any help with N8N workflows, let's connect over a call and solve it together!







































