Automated Versioned Backup and Migration Between n8n Instances - n8n Workflow

Use this robust n8n workflow to automatically backup and version your production n8n workflows to a secondary n8n instance using the n8n API. Includes rolling retention and Notion tracking.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • n8n users requiring high availability and disaster recovery for their critical automations.

  • System Administrators managing multiple n8n environments (e.g., production and staging).

  • Teams needing chronological version control for deployed n8n workflow designs.

  • Users who want centralized tracking of backup events using Notion.

Overview

Maintaining reliable n8n operations often requires robust backup strategies. This sophisticated n8n workflow solves the complexity of backing up and versioning your mission-critical n8n workflow data by automating the transfer of all active n8n workflows from a source instance to a destination instance. It uses the n8n API to perform the migration, appending a date prefix (YYYY-MM-DD_) to each workflow's name on the destination, creating an easily searchable version history. Furthermore, this n8n template implements a rolling retention policy (default is 2 days of backup) and logs the execution statistics into Notion, providing comprehensive visibility and control over your deployment using specialized n8n node configurations.

How it Works

The entire process is initiated by an n8n trigger (manual or scheduled):


  1. Date Preparation: The current date is calculated and formatted as a prefix (todayprefix), and the date for deletion (two days prior) is calculated (yesterdayprefix).

  2. Daily Check: An If n8n node checks Notion to see if a successful backup run was already executed today, preventing duplicate backups.

  3. Retention Execution: If the backup hasn't run, the flow retrieves all destination workflows. It then uses the Filter n8n node to identify and delete all workflows whose names start with the yesterdayprefix date, enforcing the rolling retention policy.

  4. Source Retrieval: The flow uses an n8n node configured as a source API client to retrieve all running n8n workflow definitions.

  5. Creation Loop: The workflow iterates through each retrieved item. A specialized n8n node handles the creation on the destination instance, dynamically renaming the n8n workflow by prepending the todayprefix.

  6. Logging: Finally, a Notion n8n node updates a tracking database with the current backup date and the total number of n8n workflows successfully copied, documenting the success of the n8n workflow execution.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON into your primary n8n instance.

  2. n8n API Credentials: You must create and configure two separate n8n API credentials:

One for the Source n8n instance (used by GET - Workflows).
One for the Destination n8n instance (used by GET - Destination Workflows, CREATE - Workflow, and n8n_destination). These credentials must have read, create, and delete permissions for workflows.

  1. Notion Setup: Configure the Notion n8n node with your credentials and link it to your target database. This database must contain fields for sequence, Value (date), and Comment (count).

  2. Retention Policy: Review the yesterday n8n node. Adjust the 'Duration' parameter if you wish to retain more or fewer days of backup versions (default: 2 days retention, meaning it deletes the workflow from 2 days ago).

  3. Testing: Use the disabled Limit n8n node before Split Out Workflows and set the limit to 1 to test the creation process on a single n8n workflow. Once satisfied, remove the limit or disable the n8n node.

Node Details

Manual Trigger (When clicking ‘Test workflow’): The starting n8n trigger for testing and initial setup. In production, this should be replaced with a Cron n8n trigger for scheduling.
n8n Node (GET - Workflows): Connects to the source n8n instance using API credentials to fetch all existing n8n workflow definitions.
n8n Node (GET - Destination Workflows): Connects to the destination n8n instance to fetch existing versions for retention management.
DateTime Node (todayprefix / yesterdayprefix): These critical date n8n nodes calculate the current backup date prefix (YYYY-MM-DD) and the deletion date prefix, respectively.
n8n Node (CREATE - Workflow): The core migration n8n node. It sends the source workflow data to the destination n8n instance, applying an expression to prepend the date prefix: {{ $('todayprefix').item.json.formattedDate + $json.name }}.
Filter Node (Filter): Used in the retention phase to isolate only the destination workflows that match the calculated deletion prefix (yesterdayprefix).
n8n Node (n8ndestination): Performs the delete operation on the destination instance for the specific workflows identified by the preceding Filter n8n node.
Notion Node (Notion): Updates the Notion database with the completion date and the count of processed n8n workflow items, providing an audit trail for the entire n8n workflow run.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

Data Sommelier | Sales Architect | Advisor | GTM

Featured*