Backup n8n Workflows to Bitbucket with Rate Limit Handling

Automate daily backups of your n8n workflows directly to Bitbucket, intelligently managing API rate limits to avoid errors. This workflow ensures your automation definitions are safely versioned with minimal manual effort.
scheduleTrigger
httpRequest
code
+5
Workflow Identifier: 1530
NODES in Use: Schedule Trigger, Set, n8n, Split In Batches, HTTP Request, If, Code, Wait
Backup n8n workflows with Bitbucket

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What This Workflow Does

This workflow automatically backs up all n8n workflows to a Bitbucket repository every day at 2 AM.
It solves the problem of manual exports and uploads, avoiding mistakes and saving time.
The result is a reliable daily backup of all workflows with smart handling of Bitbucket API rate limits.


Who Should Use This Workflow

This workflow is for anyone using n8n to create many workflows that need regular backups.
It is good if manual backup is slow, error-prone, or if Bitbucket API limits cause upload failures.


Tools and Services Used

  • n8n: Automation platform with nodes for API calls and workflow control.
  • Bitbucket API: Used to get and update workflow files in the repository.
  • HTTP Basic Auth: Secure login method for Bitbucket API requests.
  • n8n Nodes: Schedule Trigger, Set, n8n API, Split In Batches, HTTP Request, Code, Wait, and If nodes.

Inputs, Processing Steps, and Output

Inputs

  • Daily trigger at 2 AM.
  • Bitbucket workspace and repository info.
  • All current workflows from n8n environment.

Processing Steps

  • Fetch all workflows via n8n API.
  • Split workflows to process one at a time.
  • For each workflow, request existing file from Bitbucket.
  • Compare local and Bitbucket workflows to detect new or changed files.
  • If changed or new, upload the workflow JSON to Bitbucket with a commit message.
  • Read Bitbucket API rate limit headers.
  • Run code to calculate wait time based on remaining API calls and reset time to avoid limits.
  • Wait before next API request.
  • Repeat for all workflows.

Output

Bitbucket repository updated with new or changed workflow files.
Backup runs every day without manual intervention or hitting API limits.


Beginner Step-by-Step: How to Use This Workflow in n8n

1. Import the Workflow

  1. Download the workflow file using the Download button on this page.
  2. In the n8n editor, click the menu and choose “Import from File”.
  3. Select the downloaded file to add it to your workspace.

2. Configure the Workflow

  1. Go to the Set node and update WorkspaceSlug and RepositorySlug to match your Bitbucket workspace and repository.
  2. Make sure the HTTP Request nodes use correct authentication with your Bitbucket HTTP Basic Auth credentials.

3. Test the Workflow

  1. Run the workflow manually once to check it works and backups start.
  2. Look for errors and verify commits appear in Bitbucket.

4. Activate the Workflow

  1. Turn on the workflow to run every day at 2 AM automatically.
  2. Make sure your n8n instance runs continuously; consider self-host n8n options for uptime.

Handling Edge Cases and Failures

  • If the workflow file is not found on Bitbucket, the workflow uploads it as new.
  • If an API call returns 404, check if the workflow filename is sanitized correctly.
  • If rate limit errors appear, increase wait time in the Code node that calculates wait.
  • If authentication fails, update Bitbucket credentials stored in n8n.

Customization Ideas

  • Change the daily schedule time in the Schedule Trigger node.
  • Set branch or subfolder path in Bitbucket by modifying URLs in HTTP Request nodes.
  • Limit backups to specific workflows by modifying the n8n API node filter.
  • Adjust wait times and rate limit thresholds in the Code node to fit your Bitbucket limits.

Summary of Benefits and Results

✓ Saves about 30 minutes per day by automating backups.
✓ Prevents errors from manual backup or overwriting.
✓ Handles Bitbucket API limits dynamically to avoid failures.
✓ Provides versioned backups in Bitbucket with clear commit messages.


Backup n8n workflows with Bitbucket

Visit through Desktop to Interact with the Workflow.

Frequently Asked Questions

Unknown. The provided workflow description does not specify how deletions are handled in the backup process.
The workflow reads Bitbucket API rate limit headers after each request and calculates wait times dynamically in a Code node to space API calls and avoid exceeding limits.
Yes. Users can modify the n8n API node to apply filters, limiting backup to selected workflows.
Yes. HTTP Basic Auth credentials with access to the target Bitbucket repository are required and must be configured in n8n.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.