Secure Credential Restoration from Google Drive Backup - n8n Workflow

Restore your critical n8n credentials from a Google Drive backup file using this robust n8n workflow. It implements duplication checks using the n8n API to ensure data integrity.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

n8n Administrators: Those responsible for maintaining the health and configuration of self-hosted n8n instances.
DevOps Engineers: Professionals managing deployment and recovery processes for n8n.


  • Users Requiring Disaster Recovery: Anyone needing a fast, automated way to restore connections after an n8n instance failure or migration.

Overview

Maintaining the integrity of connection credentials is vital for any production n8n instance. This specialized n8n workflow serves as a powerful recovery tool, automating the critical process of restoring encrypted n8n credentials from a backup stored on Google Drive.

Unlike simple imports, this sophisticated n8n template first uses an Execute Command n8n node to retrieve a list of all existing credentials via the n8n API. It then compares every credential found in the Google Drive backup file (n8nbackupcredentials.json) against the existing list. If a credential name is already in use, the Check For Skipped Credentials n8n node ensures it is skipped, guaranteeing that you only restore new or missing credentials. This robust approach prevents data duplication and keeps your n8n environment clean and operational. This whole process is initiated by a simple On Click Trigger n8n trigger.

How it Works

This highly detailed n8n workflow operates through a structured recovery process:


  1. Preparation (Trigger & Export): The process is started by the manual On Click Trigger n8n trigger. First, the Execute Command Get All Cridentials n8n node runs npx n8n export:credentials --all --decrypted to fetch all currently configured credentials from the running n8n instance.

  2. Data Processing & Aggregation: The JSON Formatting Data n8n node cleans and parses the command line output. The Aggregate Cridentials n8n node then aggregates the names of all existing credentials into a single list, which is essential for the duplication check.

  3. Backup Retrieval: The n8n workflow connects to Google Drive to locate the file named n8nbackupcredentials.json. The file is downloaded using the Google Drive Download File n8n node and then parsed into individual JSON items using the Convert Files To JSON n8n node.

  4. Iteration and Deduplication: The Loop Over Items n8n node begins iterating through each credential object extracted from the backup file.

  5. Conditional Check: The Check For Skipped Credentials n8n node determines if the credential should be restored. It checks if the current credential name is empty or if its name already exists in the list generated by the Aggregate Cridentials n8n node. If either is true, the item is skipped, ensuring zero duplication.

  6. Restoration: If the check passes (the credential is new), the Restore N8n Credentials n8n node uses the internal n8n API to re-create the credential using the name, type, and encrypted data pulled from the backup object. A short Wait n8n node follows the restoration for stability before the next item in the n8n workflow is processed.

Installation Guide

To use this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and paste it into your n8n instance via the 'Import from JSON' option.

  2. n8n API Credential: You must set up an API key credential for the Restore N8n Credentials n8n node (named 'n8n account' in the template). This credential must have access to the internal n8n API to create new credentials.

  3. Google Drive Credential: Configure the Google Drive OAuth2 API credential (named 'AI Auto Google Drive account'). Ensure this account has read access to the Google Drive location where your n8nbackupcredentials.json file is stored.

  4. Execute Command Requirement: Ensure that the user running the n8n service has permission to execute the npx n8n export:credentials command, as this is vital for retrieving the list of currently existing credentials.

  5. Activation: Once credentials are set, activate the n8n workflow and click the On Click Trigger n8n trigger to begin the restoration process.

Node Details

On Click Trigger (n8n trigger): Initiates the entire restoration n8n workflow manually.
Execute Command Get All Cridentials (Execute Command n8n node): Executes npx n8n export:credentials --all --decrypted to securely retrieve all currently saved credentials as JSON output. This forms the basis of the deduplication check.
JSON Formatting Data (Code n8n node): A custom code n8n node that cleans and parses the raw command line output, transforming the string data into a structured JSON array.
Aggregate Cridentials (Aggregate n8n node): Collects the names of all currently existing credentials, creating a simple list to quickly check against backup items.
Google Drive Get Credentials File (Google Drive n8n node): Searches Google Drive for the specified backup file: n8nbackupcredentials.json.
Check For Skipped Credentials (If n8n node): The core deduplication logic. It checks if the credential name is already present in the aggregated list of existing credentials. If it exists, the n8n workflow skips the item, preventing duplicates.
Restore N8n Credentials (n8n n8n node): Uses the 'credential' resource via the internal n8n API to create the new credential, utilizing the name, type, and data retrieved from the backup file. This is where the actual recovery action occurs within the n8n template.
Loop Over Items (Split In Batches n8n node): Manages the iteration process, handling the restoration of credentials one by one.

Related n8n Workflows

Free

Nodes: 12 Nodes
Updated: December 26 2025
View all
Created by

A Growth Hacker, Digital Marketer & AI Automation Builder with 10+ years of experience in Digital Marketing & Workflow Automation. Based in Helsinki, Finland. For questions about my templates and customization, contact me at: [email protected]

Featured*