n8n Scripts
Download
Download n8n Scripts — zip containing the script and README.
Scripts for managing and backing up n8n workflows via the API.
Scripts
fetch-workflows.sh
Fetches workflows from the n8n API and saves them as JSON files for backup and version control.
Usage:
# Fetch only active (live) workflows (default)
cd scripts/resources/n8n
./fetch-workflows.sh
# Fetch all workflows (including inactive)
./fetch-workflows.sh --all
# Fetch workflows and all tags
./fetch-workflows.sh --tags
# Fetch all workflows and tags
./fetch-workflows.sh --all --tags
What it does:
- Fetches workflows from n8n API (
https://n8n.pacing.agency/api/v1/workflows) - Filters to active workflows only by default (use
--allfor all workflows) - Saves each workflow as a separate JSON file:
{workflow-id}-{workflow-name}.json - Fetches and includes tags for each workflow
- Creates a summary file with workflow metadata
- Organises workflows by tags for easy filtering
Output:
- Individual workflow files:
workflows/{id}-{name}.json - All workflows backup:
workflows/all-workflows-{timestamp}.json - Summary file:
workflows/summary-{timestamp}.json - Console output showing workflow names, IDs, active status, and tags
Requirements:
N8N_API_KEYin project.envfile (see n8n for API key details)jqfor JSON processing (install withbrew install jqon macOS)curlfor API requests (usually pre-installed)
Example output:
=== n8n Workflow Fetcher ===
Base URL: https://n8n.pacing.agency/api/v1
Output directory: scripts/resources/n8n/workflows
Fetching workflows from https://n8n.pacing.agency/api/v1...
Found 7 active workflow(s)
Saved all workflows to: workflows/all-workflows-20250109-143022.json
Saved: Pacing Website - Cache Clear On Publish (ID: N11idwXDFWNwGYDh)
Saved: TTL Website - Cache Clear On Publish (ID: KowT1FqN6Xk6UoRE)
...
Fetching tags for workflows...
Tags for N11idwXDFWNwGYDh: pacing,webflow
=== Workflow Summary ===
Pacing Website - Cache Clear On Publish (ID: N11idwXDFWNwGYDh) - Active: true
...
Workflow Files:
Each workflow is saved with:
- Complete workflow definition (nodes, connections, settings)
- Metadata (name, ID, active status, created/updated dates)
- Tags (if any are assigned)
Use Cases:
- Backup workflows before updates or changes
- Version control for workflow definitions
- Documenting active workflows for client reporting
- Migrating workflows between environments
- Analysing workflow structure and dependencies
Resources
Workflow JSON files are stored in workflows/ subdirectory:
- Individual workflow files:
{id}-{name}.json - Backup files:
all-workflows-{timestamp}.json - Summary files:
summary-{timestamp}.json
These files provide context for:
- Understanding current automation setup
- Documenting client workflows
- Planning workflow improvements
- Troubleshooting workflow issues