Skip to main content

Backup n8n workflows to Bitbucket

Workflow preview

Workflow preview
100%
Backup n8n workflows to Bitbucket preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

An automated backup solution designed for self hosted n8n users to automatically backup their workflows to Bitbucket, leveraging Bitbucket's free private repository offering. Perfect for maintainin...

Best for

  • DevOps automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.code, n8n-nodes-base.scheduletrigger, n8n-nodes-base.n8n, n8n-nodes-base.splitinbatches, n8n-nodes-base.httprequest, n8n-nodes-base.if, n8n-nodes-base.wait, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Gareth B. Davies.

Original n8n.io source

1.1 Workflow description

Title
Backup n8n workflows to Bitbucket
Workflow name
Backup n8n workflows to Bitbucket

An automated backup solution designed for self-hosted n8n users to automatically backup their workflows to Bitbucket, leveraging Bitbucket's free private repository offering.

Perfect for maintaining version control of your n8n workflows without additional costs.

How it works:

  • Runs on a regular schedule to check all workflows in your n8n instance
  • Compares each workflow with its version in Bitbucket
  • Only uploads workflows that are new or have changed
  • Uses basic rate limiting to stay within Bitbucket's API limits
  • Formats filenames for easy tracking and includes timestamps in commit messages
  • Handles errors gracefully with automatic retries

Set up steps (10-15 minutes):

  1. Create a free Bitbucket account and private repository
  2. Create a Bitbucket App Password with repository write access
  3. Add Bitbucket credentials to n8n (using your username and app password)
  4. Set up n8n API access (generate API key in your n8n instance)
  5. Configure your Bitbucket workspace and repository names in the Set node
  6. Optional: Adjust the backup schedule (default: 2 AM daily)

Perfect for n8n self-hosters who want:

  • Version control for their workflows
  • Automated daily backups
  • Free private repository storage
  • Easy workflow recovery
  • Change tracking over time

The workflow includes basic error handling and rate limiting to ensure reliable backups even with larger numbers of workflows. Adjust your timing based on https://support.atlassian.com/bitbucket-cloud/docs/api-request-limits/.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Calculate Wait Time

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 2 - Run Daily at 2 AM

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 3 - Get All Workflows

Type / Role
n8n-nodes-base.n8n - n8n
Config choices
Version 1

Block 4 - Loop Workflows

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 5 - Get Existing Worfklow from Bitbucket

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 6 - New or Changed?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 7 - Upload Workflow to Bitbucket

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 8 - Wait to Avoid Rate Limiting

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 9 - Set Bitbucket Workspace & Repository

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

3. Summary Table

Workflow Backup n8n workflows to Bitbucket
Complexity intermediate
Nodes 9
Categories DevOps
Author Gareth B. Davies
Published 24 Jan 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2787/2787.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Backup n8n workflows to Bitbucket do?

An automated backup solution designed for self hosted n8n users to automatically backup their workflows to Bitbucket, leveraging Bitbucket's free private repository offering. Perfect for maintainin...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.