N8n cli backup

From 8Dvibes/n8n-cli · View interactive version

N8n cli backup is an AI agent skill from the GitHub repository 8Dvibes/n8n-cli. Back up an entire n8n instance to a git-tracked directory. Exports all workflows, credentials, tags, and variables as a snapshot. NOT single-file export -- use /n8n-export for that. Use when creating full instance snapshots.

How to use this skill

Skill file

/n8n-backup — Full Instance Backup

Export everything from an n8n instance to a structured, git-friendly directory.

Arguments

Procedure

Step 1: Create Backup Directory

BACKUP_DIR=~/GitHub/n8n-backups/$(date +%Y-%m-%d)/<profile-name>
mkdir -p "$BACKUP_DIR/workflows" "$BACKUP_DIR/meta"

Step 2: Export All Workflows

n8n-cli --profile <name> --json workflows list > "$BACKUP_DIR/meta/workflows.json"

# Export each workflow individually (clean filenames)
for each workflow in the list:
    n8n-cli --profile <name> workflows export <id> -o "$BACKUP_DIR/workflows/<safe-name>_<id>.json"

Step 3: Export Metadata

# Credentials (IDs and types only, no secrets)
n8n-cli --profile <name> --json credentials list > "$BACKUP_DIR/meta/credentials.json"

# Tags
n8n-cli --profile <name> --json tags list > "$BACKUP_DIR/meta/tags.json"

# Variables
n8n-cli --profile <name> --json variables list > "$BACKUP_DIR/meta/variables.json"

# Users
n8n-cli --profile <name> --json users list > "$BACKUP_DIR/meta/users.json"

Step 4: Write Manifest

Create a manifest.json with:

Step 5: Git Commit (if in a git repo)

cd ~/GitHub/n8n-backups
git add -A
git commit -m "n8n backup: <profile> — <N> workflows, <timestamp>"

Output

Backup complete: <profile>
  Workflows: N exported
  Credentials: N listed
  Tags: N listed
  Variables: N listed
  Location: ~/GitHub/n8n-backups/2026-04-03/cloud/

Scheduling

This skill works well with /schedule for automated nightly backups:

/schedule "n8n-backup --all" --cron "0 2 * * *"
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.