n8n Restore icon

n8n Restore

Restore and import n8n workflows from GitHub repository backups with conflict resolution and safety options

Overview

The n8n Restore node enables users to restore and import n8n workflows from backup files stored in a GitHub repository. It supports multiple restore modes, including restoring the latest full backup, restoring from a backup on a specific date, or restoring individual workflows by name. The node handles workflow name conflicts with options to skip, rename, or overwrite existing workflows. Additionally, it can activate workflows immediately after restoration if desired.

This node is beneficial for scenarios such as disaster recovery, migrating workflows between n8n instances, or selectively restoring workflows after accidental deletion or modification. For example, a user who regularly backs up their workflows to GitHub can use this node to quickly restore all workflows from the most recent backup or selectively restore only critical workflows that were accidentally deleted.

Properties

Name Meaning
Required Credentials Setup Notice informing users they need two credentials: 1) GitHub API (Personal Access Token), 2) n8n API (API Key from Settings).
Restore Mode Choose how to restore workflows:
- Latest Backup: Restore all workflows from the most recent complete backup file.
- Specific Date: Restore from a backup created on a specific date.
- Individual Workflows: Restore only selected workflows by exact names.
Backup Date (Shown if "Specific Date" mode selected) Select the date of the backup file to restore (format: backup-YYYY-MM-DD.json). Only dates with existing backups will work.
Workflow Names (Shown if "Individual Workflows" mode selected) Comma-separated list of exact workflow names to restore. Names must match exactly as they appear in n8n.
GitHub Repository GitHub repository containing the workflow backups. Must have read access. Format: owner/repository-name. Should be the same repository used for backups.
Branch Name Git branch containing the backup files to restore from. Default is main. Use the same branch name that was used during backup.
Conflict Resolution How to handle workflows that already exist in n8n:
- Skip: Skip existing workflows (safest).
- Rename: Rename restored workflows by adding a timestamp suffix.
- Overwrite: Replace existing workflows (use with caution).
Activate After Restore Whether to activate workflows immediately after restoring them (true or false). Default is false.

Output

The node outputs an array with one item containing a JSON object summarizing the restore operation:

  • success: Boolean indicating overall success.
  • message: Summary message describing how many workflows were restored, skipped, or failed.
  • repository: The GitHub repository used for restoration.
  • branch: The Git branch used.
  • restoreMode: The selected restore mode.
  • restored: Array of objects for successfully restored workflows, each with:
    • id: Workflow ID in n8n.
    • name: Workflow name.
    • action: Either "created" or "updated".
  • skipped: Array of objects for workflows skipped due to conflicts, each with:
    • name: Workflow name.
    • reason: Reason for skipping (e.g., "Workflow already exists").
  • errors: Array of objects for workflows that failed to restore, each with:
    • workflow: Workflow name.
    • error: Error message.
  • totalProcessed: Total number of workflows processed from the backup.

The node does not output binary data.

Dependencies

  • Requires two external API credentials configured in n8n:
    • A GitHub API credential with read access to the repository containing backups.
    • An n8n API credential (API key) to create, update, and activate workflows via the n8n API.
  • Access to the specified GitHub repository and branch where backup JSON files are stored.
  • The node uses helper classes (GitHubHelper and N8nHelper) internally to interact with GitHub and n8n APIs.

Troubleshooting

  • No workflows found to restore: This occurs if the selected backup file is empty or missing workflows. Verify the backup file exists in the GitHub repo and contains valid workflows.
  • Unsupported restore mode: If an invalid restore mode is selected, the node throws an error. Ensure the restore mode property is set to one of the supported options.
  • Workflow name conflicts: If workflows already exist in n8n, conflicts are handled based on the chosen conflict resolution option. Using "overwrite" can replace existing workflows but should be used cautiously.
  • Authentication errors: Ensure both GitHub and n8n API credentials are correctly configured and have necessary permissions.
  • Date selection issues: When using "Specific Date" mode, only dates with existing backup files will work. Check the GitHub repository for available backup dates.
  • Partial failures: Some workflows may fail to restore due to invalid data or API errors. These are reported individually in the errors output array.

If the node encounters an error and "Continue On Fail" is disabled, execution will stop; otherwise, errors are reported in the output.

Links and References

Discussion