Skip to main content

Backup and delete workflows to Google Drive with n8n API and form trigger

Workflow preview

Backup and delete workflows to Google Drive with n8n API and form trigger preview
Open on n8n.io

Important notice

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

Overview

πŸ” Description:

Effortlessly delete unused or inactive workflows from your n8n instance while automatically backing them up as .json files into your Google Drive. Keep your instance clean, fast, and organized β€” no more clutter slowing you down. This workflow is ideal for users managing large self-hosted n8n setups, or anyone who wants to maintain optimal performance while preserving full workflow backups.

βœ… What it does:

  • Accepts a full n8n Workflow URL via a form
  • Retrieves workflow info automatically
  • Converts the workflow’s full JSON definition into a file
  • Uploads that file to Google Drive
  • Deletes the workflow safely using the official n8n API
  • Sends a Telegram notification confirming backup and deletion

βš™οΈ How it works:

πŸ“ Form – Collects the full workflow URL from the user πŸ” n8n Node (Get Workflow) – Uses the URL to fetch workflow details πŸ“¦ Code Node ("JSON to File") – Converts the workflow JSON into a properly formatted .json file with UTF-8 encoding, ready to be uploaded to Google Drive. ☁️ Google Drive Upload – Uploads the .json backup file to your selected Drive folder πŸ—‘οΈ n8n Node (Delete Workflow) – Deletes the workflow from your instance using its ID πŸ“¬ Telegram Notification – Notifies you that the workflow was backed up and deleted, showing title, ID, and date

πŸ“‹ Requirements:

  • Google Drive connected to your n8n account
  • Telegram Bot connected to n8n
  • An n8n instance with API access (self-hosted or Cloud)
  • Your n8n API Key (Create one in the settings)

πŸ› οΈ How to Set Up:

βœ… Add your Google Drive credentials βœ… Add your Telegram Bot credentials

🧾 In the β€œJSON to File” Code node, no additional setup is required β€” it automatically converts the workflow JSON into a downloadable .json file using the correct encoding and filename format.

☁️ In the Google Drive node: Binary Property: data Folder ID: your target folder in Google Drive

πŸ”‘ Create a new credential for the n8n node using: API Key: your personal n8n API key Base URL: your full n8n instance API path (e.g. https://your-n8n-instance.com/api/v1) βš™οΈ Use this credential in both the Get Workflow and Delete Workflow n8n nodes

πŸ“¬ In the Telegram node, use this message template: πŸ—‘οΈ Workflow "{{ $json.name }}" (ID: {{ $json.id }}) was backed up to Google Drive and deleted from n8n. πŸ“… {{ $now }}

πŸ”’ Important: This workflow backs up the entire workflow data to Google Drive. Please be careful with the permissions of your Google Drive folder and avoid sharing it publicly, as the backups may contain sensitive information. Ensuring proper security and access control is essential to protect your data.

πŸš€ Activate the workflow and you're ready to safely back up and remove workflows from your n8n instance