n8n Backup icon

n8n Backup

Automatically backup your n8n workflows to GitHub repository with version control, scheduling support, and flexible filtering options

Overview

This node automates backing up your n8n workflows to a GitHub repository with version control. It supports flexible filtering options to select which workflows to back up, including all workflows, only active ones, or those filtered by tags. The backups include workflow definitions and a summary of credentials used in these workflows (without sensitive data). This is useful for maintaining versioned backups of your automation workflows, enabling easy recovery, auditing, or migration.

Common scenarios:

  • Regularly scheduled backups of all or selected workflows to GitHub.
  • Keeping track of changes in workflows over time via Git commits.
  • Filtering backups to only critical or production workflows using tags.
  • Maintaining a credentials summary alongside workflows for audit purposes.

Practical example:
You want to back up all active workflows daily to a GitHub repo named myusername/n8n-workflows-backup on the backups branch, with commit messages timestamped automatically. This node will fetch active workflows, extract their metadata and credentials summary, save them as JSON files, and push them to the specified GitHub repository and branch.


Properties

Name Meaning
Required Credentials Setup Notice informing that two credentials are required: 1) GitHub API credential (Personal Access Token), 2) n8n API credential (API Key from Settings).
Backup Mode Select which workflows to back up:
- All Workflows: All workflows regardless of status.
- Active Only: Only workflows currently active and running.
- Filter by Tags: Only workflows containing any of specified tags.
Tags Comma-separated list of tags to filter workflows when "Filter by Tags" mode is selected. Only workflows containing any of these tags will be backed up. Example: production,important,daily-backup.
GitHub Repository GitHub repository where backups will be stored. Must exist and user must have write access. Format: owner/repository-name (e.g., myusername/n8n-workflows-backup).
Branch Name Git branch to push backups to. Will be created if it doesn't exist. Default is main. You can specify other branches like backups or production.
Commit Message Git commit message for the backup. Supports dynamic expressions such as current date/time ({{$now}}) and workflow name ({{$workflow.name}}). Default includes timestamp.

Output

The node outputs a single JSON object per execution containing:

  • success: Boolean indicating if the backup succeeded.
  • workflowCount: Number of workflows backed up.
  • credentialsCount: Number of credentials summarized.
  • credentialsError: Any error message encountered during credential extraction (if any).
  • files: Array of file paths created in the GitHub repository during this backup.
  • message: A human-readable summary of the backup operation, including counts of workflows and credentials backed up, notes on errors, and number of files created.

No binary data output is produced.


Dependencies

  • Requires two external API credentials configured in n8n:
    • An API key credential for accessing the n8n instance's API to retrieve workflows.
    • A GitHub API credential (Personal Access Token) with write access to the target repository.
  • The target GitHub repository must already exist.
  • The node uses helper classes internally to interact with GitHub and n8n APIs.
  • No additional environment variables are explicitly required beyond these credentials.

Troubleshooting

Common Issues

  • No workflows found matching criteria: If no workflows match the selected backup mode or tags, the node completes successfully but reports zero workflows backed up.
  • GitHub repository access errors: Ensure the GitHub token has write permissions and the repository exists.
  • Branch creation failures: If the specified branch cannot be created or accessed, verify repository settings and token scopes.
  • Credential extraction errors: Errors extracting credentials from workflows are caught and reported but do not stop the backup process. Sensitive credential data is not included for security reasons.
  • Invalid backup mode: If an unsupported backup mode is selected, the node throws an error.

Error Messages and Resolutions

  • "Unsupported backup mode: <mode>": Check that the backup mode parameter is set to one of the supported values (all, active, byTags).
  • "Could not get full data for workflow <name>": Partial failure fetching workflow details; check n8n API availability and permissions.
  • "Unknown error occurred during backup": Generic catch-all error; enable "Continue On Fail" to get detailed error messages in output.

Links and References

Discussion