
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Full-featured n8n CLI - workflow management, validation, node search, and more
Built for AI agents that create, validate, and deploy n8n workflows programmatically.
JSON output everywhere · Schema-aware validation · 800+ nodes bundled offline
15 command groups · 70+ subcommands · 300+ flags
🤖 AI-Native — Every command returns structured JSON for machine consumption
⚡ Offline-First — 800+ nodes bundled locally, no API needed for validation
🔒 Production-Ready — POSIX exit codes, backups, confirmations, and safety rails
📦 Zero Config — Works immediately with npx cli-n8n
This CLI is designed from the ground up for AI agents that generate n8n workflows programmatically. Instead of streaming large JSON through tool calls (which causes token limits and hallucinations), agents can leverage a local-first architecture:
┌─────────────────────────────────────────────────────────────────────────────┐
│ AGENT DEVELOPMENT LOOP │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌─────────────────┐ ┌──────────────────────────┐ │
│ │ 1. GENERATE │───▶│ 2. WRITE FILE │───▶│ 3. VALIDATE LOCALLY │ │
│ │ Workflow │ │ workflow.json │ │ n8n workflows validate │ │
│ └─────────────┘ └─────────────────┘ └───────────┬──────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────┐ ┌─────────────────┐ ┌──────────────────────────┐ │
│ │ 6. DEPLOY │◀───│ 5. ITERATE │◀───│ 4. GET STRUCTURED ERRORS │ │
│ │ to n8n │ │ Fix Issues │ │ with schema hints │ │
│ └─────────────┘ └─────────────────┘ └──────────────────────────┘ │
│ │
│ Tight local loop • No network latency • Instant validation feedback │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
workflow.jsonn8n workflows validate workflow.json --jsoncorrectUsage showing exact scheman8n workflows import workflow.json --json| Principle | Implementation | Benefit |
|---|---|---|
| JSON Everywhere | Every command supports --json flag | Machine-readable output for automation |
| Schema Hints | Validation errors include correctUsage | Agents know exactly what structure to use |
| Offline First | 800+ nodes bundled in SQLite database | No API needed for node lookup/validation |
| POSIX Exit Codes | Standard exit codes (0, 64, 65, 70, etc.) | Reliable scripting and error handling |
| Predictable Structure | n8n <resource> <action> [options] | Consistent command patterns |
| Feature | Description | Use Case |
|---|---|---|
| Workflow Validation | Schema-aware validation with 4 profiles | Catch errors before deployment |
| Expression Validation | Detects missing = prefix in {{ }} | Fix common AI mistakes |
| AI Node Validation | 15+ checks for AI Agent workflows | Validate LLM/tool connections |
| Node Type Suggestions | Fuzzy matching for typos | Auto-fix httprequest → n8n-nodes-base.httpRequest |
| Autofix Engine | 8 fix types with confidence levels | Automated issue resolution |
| Version Management | Local version history with rollback | Safe iteration on workflows |
| Diff Operations | 17 surgical modification types | Update without full replacement |
| Template Deployment | One-command template deploy | n8n workflows deploy-template 3121 |
| Breaking Changes | Version migration analysis | Understand upgrade impacts |
| Offline Node Search | FTS5 full-text search | Find nodes without API |
| Audience | Primary Use Case | Key Features |
|---|---|---|
| 🤖 AI Agents (Primary) | Workflow generation & deployment | JSON output, schema hints, offline validation |
| 👨💻 DevOps Engineers | CI/CD pipeline integration | Exit codes, scripting support, bulk operations |
| ⚡ n8n Power Users | Advanced workflow management | Version control, diff operations, autofix |
| 🔧 Automation Builders | Template-based development | Template search, deploy, customize |
| Approach | n8n Web UI | Raw API Calls | n8n-cli |
|---|---|---|---|
| Validation | Runtime only | None | Pre-deployment with hints |
| Node Lookup | Requires login | Requires API | 800+ nodes offline |
| Error Feedback | Visual in UI | Raw HTTP errors | Structured JSON with fixes |
| Batch Operations | Manual one-by-one | Custom scripting | Built-in bulk commands |
| Version Control | None | Manual | Automatic versioning |
| AI Integration | Not designed for | Token-heavy | Native JSON support |
💡 Tip: For AI agents, start with
n8n nodes searchto discover available nodes, thenn8n nodes show <type> --detail minimal --jsonto get token-efficient schemas.
| Requirement | Minimum Version | Notes |
|---|---|---|
| Node.js | 18.0.0 | LTS versions recommended |
| npm/yarn/pnpm | Any recent version | Package manager of choice |
| Operating System | macOS, Linux, Windows | All platforms supported |
# Run any command without installing
npx cli-n8n --help
npx cli-n8n nodes search "slack"
npx cli-n8n workflows validate workflow.json --json
💡 Best for: Quick testing, CI/CD pipelines, one-off commands
# Install globally
npm install -g cli-n8n
# Verify installation
n8n --version
n8n --help
# Install globally with yarn
yarn global add n8n-cli
# Verify installation
n8n --version
# Install globally with pnpm
pnpm add -g n8n-cli
# Verify installation
n8n --version
# Add to project dependencies
npm install --save-dev n8n-cli
# Run via npx in project
npx n8n --help
# Or add to package.json scripts
# "scripts": { "n8n": "n8n-cli" }
# Check version
n8n --version
# Output: n8n-cli/x.x.x
# Check available commands
n8n --help
# Test offline functionality (no API needed)
n8n nodes search "http"
# Test connection (requires configuration)
n8n health
The recommended workflow for AI agents generating n8n workflows:
# 1. Search for available nodes (offline, no API needed)
n8n nodes search "slack" --json
# 2. Get node schema with minimal tokens (~200 tokens)
n8n nodes show n8n-nodes-base.slack --detail minimal --json
# 3. Get full schema when needed (~3-8K tokens)
n8n nodes show n8n-nodes-base.slack --detail full --json
# 4. Validate generated workflow (returns structured errors)
n8n workflows validate workflow.json --json
# 5. Auto-fix common issues
n8n workflows autofix workflow.json --apply --save fixed.json
# 6. Deploy to n8n instance (requires API configuration)
export N8N_HOST="https://your-n8n.com"
export N8N_API_KEY="your-api-key"
n8n workflows import workflow.json --json
Example JSON Response (Validation Error):
{
"valid": false,
"errors": [{
"code": "EXPRESSION_MISSING_PREFIX",
"nodeName": "HTTP Request",
"path": "nodes[0].parameters.url",
"context": {
"value": "{{ $json.endpoint }}",
"expected": "={{ $json.endpoint }}"
},
"hint": "Add '=' prefix to expression",
"autoFixable": true
}],
"warnings": [],
"stats": { "nodeCount": 5, "connectionCount": 4 }
}
Common operations for human users:
# Check connection to n8n instance
n8n health
# List all workflows
n8n workflows list
# List active workflows only
n8n workflows list --active
# Export a workflow to file
n8n workflows export abc123 -o backup.json
# Validate a workflow file
n8n workflows validate workflow.json
# Validate and auto-fix issues
n8n workflows validate workflow.json --fix --save fixed.json
# Deploy a template from n8n.io in one command
n8n workflows deploy-template 3121 --name "My Chatbot"
# Search for nodes
n8n nodes search "google sheets"
# Get node documentation
n8n nodes show googleSheets --mode docs
💡 Quick Tip: Offline vs Online Commands
These commands work offline (no n8n instance needed):
Command Description nodes search/show/listSearch 800+ bundled nodes workflows validateValidate workflow JSON locally workflows autofixFix common issues automatically templates search --by-nodes/--by-taskSearch bundled templates Everything else requires
N8N_HOSTandN8N_API_KEYconfiguration.
Step 1: Install the CLI
npm install -g cli-n8n
Step 2: Configure Connection (for API commands)
# Option A: Interactive setup
n8n auth login --interactive
# Option B: Environment variables
export N8N_HOST="https://your-n8n-instance.com"
export N8N_API_KEY="your-api-key-from-n8n-settings"
# Option C: Configuration file
echo 'N8N_HOST=https://your-n8n.com
N8N_API_KEY=your-api-key' > ~/.n8nrc
Step 3: Test the Connection
n8n health
# ✓ Connected to https://your-n8n.com
# ✓ API version: 1.0
# ✓ Latency: 45ms
Step 4: Explore Available Nodes (Offline)
# Search nodes by keyword
n8n nodes search "slack"
# List by category
n8n nodes list --by-category
# Get node schema
n8n nodes show slack --schema
Step 5: Validate and Deploy a Workflow
# Validate locally first
n8n workflows validate my-workflow.json
# Deploy if valid
n8n workflows import my-workflow.json --activate
⚠️ Warning: API commands (workflows list, credentials, executions, etc.) require
N8N_HOSTandN8N_API_KEYto be configured. Offline commands (nodes, validate, autofix) work without any configuration.
Organized command reference for experienced users. For detailed documentation, see Commands.
# List & Get
n8n workflows list # List all (limit 20)
n8n workflows list -a -l 50 # Active only, limit 50
n8n workflows list -t production,api # Filter by tags
n8n workflows get abc123 # Get by ID
n8n workflows get abc123 --json # JSON output for scripting
# Export & Import
n8n workflows export abc123 -o backup.json # Export to file
n8n workflows import workflow.json # Import (inactive)
n8n workflows import workflow.json --activate # Import and activate
# Validate & Fix
n8n workflows validate workflow.json # Basic validation
n8n workflows validate abc123 # Validate by ID (API)
n8n workflows validate wf.json -P strict # Strict profile
n8n workflows validate wf.json -P ai-friendly -M full # AI workflow validation
n8n workflows validate wf.json --fix --save fixed.json # Auto-fix issues
n8n workflows autofix wf.json --apply # Full autofix with version upgrades
# Deploy Templates
n8n workflows deploy-template 3121 # Deploy template by ID
n8n workflows deploy-template 3121 -n "My Bot" # Custom name
n8n workflows deploy-template 3121 --dry-run # Preview without creating
# Search & Discover
n8n nodes search "slack" # Basic search
n8n nodes search "http request" --mode AND # All terms must match
n8n nodes search "slak" --mode FUZZY # Typo-tolerant search
n8n nodes list --by-category # Browse by category
# Get Node Info
n8n nodes show slack # Standard info (~1-2K tokens)
n8n nodes show slack --detail minimal # Quick lookup (~200 tokens)
n8n nodes show slack --detail full # Full schema (~3-8K tokens)
n8n nodes show slack --mode docs # Human-readable documentation
n8n nodes show httpRequest --mode versions # Version history
# Validate Nodes in Workflow
n8n nodes validate workflow.json # Check node configurations
n8n nodes breaking-changes workflow.json # Find outdated nodes
n8n credentials list # List all credentials
n8n credentials types # Available credential types
n8n credentials schema githubApi # Get type schema
n8n credentials create -t githubApi -n "GitHub" -d @creds.json # Create from file
n8n credentials delete abc123 --force # Delete without confirmation
n8n executions list # Recent executions
n8n executions list -w abc123 # Filter by workflow
n8n executions list --status error # Failed only
n8n executions get exec123 # Quick preview
n8n executions get exec123 --mode full # Complete data (may be large)
n8n executions retry exec123 # Retry with same workflow version
n8n executions retry exec123 --load-latest # Retry with current workflow
n8n templates search "chatbot" # Keyword search (API)
n8n templates search --by-nodes openAi,slack # Local: by nodes used
n8n templates search --by-task ai_automation # Local: by purpose
n8n templates get 3121 # Template details
n8n templates list-tasks # All task categories
n8n auth login --interactive # Interactive setup
n8n auth status # Check current auth
n8n health # Test connection
n8n audit --categories credentials,nodes # Security audit
n8n config show # Current configuration
| Pattern | Example | Description |
|---|---|---|
| List | n8n <resource> list [--filter] [--limit n] | List resources with optional filters |
| Get | n8n <resource> get <id> [--json] | Get single resource by ID |
| Create | n8n <resource> create [--data @file.json] | Create from data |
| Delete | n8n <resource> delete <id> [--force] | Delete with optional confirmation skip |
| Validate | n8n workflows validate <file> [--profile] | Validate with optional profile |
Validation Error (Terminal):
$ n8n workflows validate workflow.json
✗ Validation failed (2 errors)
❌ HTTP Request (nodes[0])
EXPRESSION_MISSING_PREFIX
Value: {{ $json.endpoint }}
→ Add '=' prefix: ={{ $json.endpoint }}
💡 Auto-fixable with --fix
❌ Switch (nodes[2])
OUTDATED_NODE_VERSION
Current: v2, Latest: v3
→ Run: n8n workflows autofix workflow.json --upgrade-versions
Same Errors (JSON):
{
"valid": false,
"errors": [
{"code": "EXPRESSION_MISSING_PREFIX", "nodeName": "HTTP Request", "autoFixable": true},
{"code": "OUTDATED_NODE_VERSION", "nodeName": "Switch", "autoFixable": true}
]
}
The CLI supports multiple configuration methods with the following priority order (highest to lowest):
--host, --api-key, --profileN8N_HOST, N8N_API_KEY.n8nrc, .n8nrc.json, etc.| Variable | Required | Default | Description |
|---|---|---|---|
N8N_HOST | Yes* | — | n8n instance URL (e.g., https://n8n.example.com) |
N8N_URL | Yes* | — | Alternative to N8N_HOST (same behavior) |
N8N_API_KEY | Yes* | — | API key from n8n Settings → API |
N8N_PROFILE | No | default | Configuration profile to use |
N8N_TIMEOUT | No | 30000 | API request timeout in milliseconds |
N8N_DB_PATH | No | (bundled) | Custom path to nodes SQLite database |
N8N_DEBUG | No | false | Enable debug logging (true/false) |
DEBUG | No | — | Set to n8n-cli for debug output |
N8N_STRICT_PERMISSIONS | No | false | Refuse config files with insecure permissions |
NO_COLOR | No | — | Disable colored output (any value) |
* Required for API commands only. Not required for offline commands (nodes, validate, autofix).
Example Usage:
# Inline environment variables
N8N_HOST="https://n8n.example.com" N8N_API_KEY="xxx" n8n workflows list
# Export for session
export N8N_HOST="https://n8n.example.com"
export N8N_API_KEY="your-api-key"
n8n workflows list
# Debug mode
N8N_DEBUG=true n8n workflows validate workflow.json
# Custom timeout (60 seconds)
N8N_TIMEOUT=60000 n8n workflows import large-workflow.json
The CLI searches for configuration files in these locations (in priority order):
| Priority | Location | Format | Description |
|---|---|---|---|
| 1 | .n8nrc | INI-style | Current directory |
| 2 | .n8nrc.json | JSON | Current directory |
| 3 | ~/.n8nrc | INI-style | Home directory |
| 4 | ~/.n8nrc.json | JSON | Home directory |
| 5 | ~/.config/n8n/config.json | JSON | XDG config directory |
INI-Style Format (.n8nrc):
# Simple key=value format
N8N_HOST=https://n8n.example.com
N8N_API_KEY=your-api-key
N8N_TIMEOUT=30000
JSON Format (.n8nrc.json):
{
"host": "https://n8n.example.com",
"apiKey": "your-api-key",
"timeout": 30000
}
For multiple environments (production, staging, development), use profiles:
{
"default": "prod",
"profiles": {
"prod": {
"host": "https://n8n.example.com",
"apiKey": "prod-api-key-xxx"
},
"staging": {
"host": "https://staging.n8n.example.com",
"apiKey": "staging-api-key-xxx"
},
"dev": {
"host": "http://localhost:5678",
"apiKey": "dev-api-key-xxx"
}
}
}
Using Profiles:
# Command-line flag
n8n workflows list --profile dev
# Environment variable
N8N_PROFILE=staging n8n workflows list
# Default profile is used when not specified
n8n workflows list # Uses "prod" profile (set as default)
| Practice | Recommendation | Example |
|---|---|---|
| File Permissions | Set 600 on config files | chmod 600 ~/.n8nrc |
| API Key Storage | Use environment variables in CI/CD | ${{ secrets.N8N_API_KEY }} |
| No Hardcoding | Never commit API keys to git | Add .n8nrc to .gitignore |
| Credential Files | Use @file.json syntax | --data @secrets.json |
| Strict Mode | Enable permission checking | N8N_STRICT_PERMISSIONS=true |
# Secure configuration file setup
echo 'N8N_HOST=https://n8n.example.com
N8N_API_KEY=your-api-key' > ~/.n8nrc
chmod 600 ~/.n8nrc
export N8N_STRICT_PERMISSIONS=true
n8n workflows list
💡 Tip: For first-time setup, use
n8n auth login --interactivefor guided configuration with connection testing.
| Command Group | Subcommands | Description | API Required |
|---|---|---|---|
auth | login, status, logout | Manage CLI authentication | ✗ (config only) |
health | — | Check n8n instance connectivity | ✓ |
nodes | list, show, get, search, categories, validate, breaking-changes | Search and inspect 800+ bundled nodes | ✗ (offline) |
workflows | list, get, validate, create, import, export, update, autofix, diff, versions, deploy-template, activate, deactivate, delete, trigger, tags | Full workflow lifecycle management | Mixed |
executions | list, get, retry, delete | View and manage workflow executions | ✓ |
credentials | list, create, delete, schema, types, show-type | Manage n8n credentials | Mixed |
variables | list, create, update, delete | Manage environment variables (Enterprise) | ✓ |
tags | list, get, create, update, delete | Organize workflows with tags | ✓ |
templates | search, get, list-tasks | Search and deploy n8n.io templates | Mixed |
audit | — | Generate security audit reports | ✓ |
config | show | View CLI configuration | ✗ |
completion | <shell> | Generate shell completions | ✗ |
validate | — | Legacy workflow validation | ✗ (offline) |
| Offline (No API Needed) | Requires n8n API |
|---|---|
nodes * (all subcommands) | workflows list/get/create/import/update/delete/activate/deactivate/trigger/tags |
workflows validate | executions * (all subcommands) |
workflows autofix | credentials list/create/delete/schema |
workflows versions | variables * (all subcommands) |
credentials types | tags * (all subcommands) |
templates search --local | — |
templates search --by-nodes | health |
templates search --by-task | health |
templates list-tasks | — |
validate (legacy) | — |
config show | — |
completion | — |
These options are available on all commands:
| Option | Short | Description |
|---|---|---|
--version | -V | Output version number and exit |
--verbose | -v | Enable verbose/debug output |
--quiet | -q | Suppress non-essential output |
--no-color | — | Disable colored output |
--profile <name> | — | Use specific configuration profile |
--help | -h | Display help for command |
Common Command Options:
| Option | Description | Available On |
|---|---|---|
--json | Output as JSON (machine-readable) | Most commands |
--save <path> | Save output to file | Most commands |
--force, --yes | Skip confirmation prompts | Destructive commands |
--no-backup | Skip automatic backup | Update/delete commands |
--limit <n> | Limit number of results | List commands |
--cursor <cursor> | Pagination cursor for next page | List commands |
workflowsManage n8n workflows — the complete lifecycle from creation to deployment, validation, versioning, and more.
The workflows command group provides 16 subcommands covering:
| Command | Description | API Required |
|---|---|---|
list | List all workflows | ✓ |
get | Get workflow by ID | ✓ |
validate | Validate workflow structure | ✗ |
create | Create new workflow | ✓ |
import | Import from JSON file | ✓ |
export | Export to JSON file | ✓ |
update | Update existing workflow | ✓ |
autofix | Auto-fix validation issues | ✗ |
diff | Apply incremental changes | ✓ |
versions | Manage version history | ✗ |
deploy-template | Deploy n8n.io template | ✓ |
activate | Activate workflow(s) | ✓ |
deactivate | Deactivate workflow(s) | ✓ |
delete | Delete workflow(s) | ✓ |
trigger | Trigger via webhook | ✓ |
tags | Manage workflow tags | ✓ |
workflows listList all workflows from your n8n instance with filtering and pagination support.
Usage:
n8n workflows list [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--active | -a | Filter active workflows only | — |
--tags <tags> | -t | Filter by tags (comma-separated) | — |
--limit <n> | -l | Limit results (0 = all) | 10 |
--cursor <cursor> | — | Pagination cursor for next page | — |
--save <path> | -s | Save output to JSON file | — |
--json | — | Output as JSON | — |
Examples:
# List all workflows (default limit: 10)
n8n workflows list
# List all active workflows
n8n workflows list --active
# List workflows with specific tags
n8n workflows list --tags production,api
# List all workflows (no limit)
n8n workflows list --limit 0
# Get JSON output for scripting
n8n workflows list --json
# Save to file
n8n workflows list --save workflows.json
# Paginate through results
n8n workflows list --cursor "eyJsaW1pdCI6MTAsIm9mZnNldCI6MTB9"
jq Recipes:
# Extract workflow IDs and names
n8n workflows list --json | jq '.data[] | {id, name}'
# Count active workflows
n8n workflows list --active --limit 0 --json | jq '.data | length'
# Get workflows updated in last 7 days
n8n workflows list --json | jq '.data[] | select(.updatedAt > (now - 604800 | todate))'
workflows getGet a single workflow by ID with configurable output detail.
Usage:
n8n workflows get <id> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--mode <mode> | -m | Output mode: full, details, structure, minimal | full |
--save <path> | -s | Save output to JSON file | — |
--json | — | Output as JSON | — |
Output Modes:
| Mode | Contents | Use Case |
|---|---|---|
full | Complete workflow with all fields | Export, backup |
details | Metadata + node list (no parameters) | Quick overview |
structure | Nodes and connections only | Structure analysis |
minimal | ID, name, active status only | Status checks |
Examples:
# Get full workflow
n8n workflows get abc123
# Get minimal info
n8n workflows get abc123 --mode minimal
# Export to file
n8n workflows get abc123 --save workflow-backup.json
# JSON for scripting
n8n workflows get abc123 --json | jq '.nodes | length'
workflows exportExport a workflow to JSON file.
Usage:
n8n workflows export <id> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--output <path> | -o | Output file path (stdout if not specified) | — |
--full | — | Include all fields (don't strip server-generated) | — |
--json | — | Output as JSON | — |
Examples:
# Export to stdout
n8n workflows export abc123
# Export to file
n8n workflows export abc123 -o backup.json
# Export with all server fields
n8n workflows export abc123 --full -o complete-backup.json
# Pipe to another command
n8n workflows export abc123 | jq '.nodes | length'
workflows validateValidate a workflow JSON file or workflow by ID with comprehensive schema-aware validation. This is the primary validation command with extensive options for different use cases.
Usage:
n8n workflows validate [idOrFile] [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--file <path> | -f | Path to workflow JSON file | — |
--validation-profile <profile> | -P | Profile: minimal, runtime, ai-friendly, strict | runtime |
--validation-mode <mode> | -M | Mode: minimal, operation, full | operation |
--repair | — | Attempt to repair malformed JSON | — |
--fix | — | Auto-fix known issues | — |
--check-upgrades | — | Check for node version upgrades | — |
--upgrade-severity <level> | — | Minimum severity: LOW, MEDIUM, HIGH | — |
--check-versions | — | Check for outdated typeVersions | — |
--version-severity <level> | — | Version severity: info, warning, error | warning |
--skip-community-nodes | — | Skip version checks for community nodes | — |
--validate-expressions | — | Enable expression format validation | true |
--no-validate-expressions | — | Skip expression format validation | — |
--save <path> | -s | Save fixed workflow to file | — |
--json | — | Output as JSON | — |
| Profile | Errors Kept | Warnings Kept | Use Case |
|---|---|---|---|
minimal | Missing required only | Security, deprecated | Fast structure check |
runtime | Critical runtime errors | Security, deprecated | Default for CLI |
ai-friendly | All errors | + Best practice, missing common | AI agent workflows |
strict | All errors | All + enforced error handling | Production validation |
| Mode | Scope | Description |
|---|---|---|
minimal | Required + visible | Only required properties currently visible |
operation | Operation-specific | Properties relevant to current resource/operation |
full | All properties | All properties regardless of visibility |
Use --check-upgrades to analyze nodes in the workflow for available version upgrades:
# Check for upgrade recommendations
n8n workflows validate workflow.json --check-upgrades
# Get JSON output with upgrade analysis
n8n workflows validate workflow.json --check-upgrades --json
# Only show high severity breaking changes
n8n workflows validate workflow.json --check-upgrades --upgrade-severity HIGH
Use --check-versions to check for outdated node typeVersion values:
# Check for outdated node versions
n8n workflows validate workflow.json --check-versions
# Set severity level for version issues
n8n workflows validate workflow.json --check-versions --version-severity error
# Skip community nodes (only check n8n-nodes-base)
n8n workflows validate workflow.json --check-versions --skip-community-nodes
Example: Expression Error
{
"valid": false,
"errors": [{
"code": "EXPRESSION_MISSING_PREFIX",
"nodeName": "HTTP Request",
"path": "nodes[0].parameters.url",
"context": {
"value": "{{ $json.endpoint }}",
"expected": "={{ $json.endpoint }}"
},
"hint": "Add '=' prefix: ={{ $json.endpoint }}",
"autoFixable": true
}]
}
Example: Structural Error
{
"valid": false,
"errors": [{
"code": "N8N_PARAMETER_VALIDATION_ERROR",
"nodeName": "Switch",
"path": "nodes[2].parameters",
"schemaDelta": {
"missing": ["options"],
"extra": ["fallbackOutput"]
},
"correctUsage": {
"conditions": {
"options": {
"caseSensitive": true
}
}
},
"hint": "Remove 'fallbackOutput' and add 'options' property"
}]
}
Example: Node Type Suggestion
{
"valid": false,
"issues": [{
"code": "INVALID_NODE_TYPE_FORMAT",
"message": "Node has invalid type \"httprequest\"",
"nodeName": "HTTP Request",
"path": "nodes[0].type",
"suggestions": [
{
"value": "n8n-nodes-base.httpRequest",
"confidence": 0.95,
"reason": "Missing package prefix",
"autoFixable": true
}
],
"hint": "Did you mean: n8n-nodes-base.httpRequest? (95% match)"
}]
}
Use n8n workflows autofix with --fix-types node-type-correction to automatically fix high-confidence matches (>90%):
n8n workflows autofix workflow.json --apply --fix-types node-type-correction
The CLI validates that n8n expressions have the required = prefix. Expressions like {{ $json.field }} are detected as errors because they won't be evaluated without the prefix.
# Validate with expression checking (default)
n8n workflows validate workflow.json
# Skip expression validation (for templates with intentional placeholders)
n8n workflows validate workflow.json --no-validate-expressions
Example Error Output (Expression):
{
"valid": false,
"errors": [{
"code": "EXPRESSION_MISSING_PREFIX",
"nodeName": "HTTP Request",
"path": "nodes[0].parameters.url",
"context": {
"value": "{{ $json.endpoint }}",
"expected": "={{ $json.endpoint }}"
},
"hint": "Add '=' prefix to expression",
"autoFixable": true
}]
}
When the CLI detects an unknown or misspelled node type, it provides intelligent suggestions using fuzzy matching:
{
"valid": false,
"issues": [{
"code": "INVALID_NODE_TYPE_FORMAT",
"message": "Node has invalid type \"httprequest\"",
"nodeName": "HTTP Request",
"path": "nodes[0].type",
"suggestions": [
{
"value": "n8n-nodes-base.httpRequest",
"confidence": 0.95,
"reason": "Missing package prefix",
"autoFixable": true
}
],
"hint": "Did you mean: n8n-nodes-base.httpRequest? (95% match)"
}]
}
The CLI includes specialized validation for AI Agent workflows, catching common misconfigurations:
| AI Node Type | Validations |
|---|---|
| AI Agent | LLM connection required, fallback model config, output parser, streaming mode, memory limits, tool connections, maxIterations, prompt/systemMessage |
| Chat Trigger | Streaming mode requires AI Agent target, agent can't have main outputs in streaming |
| Basic LLM Chain | Single LLM required, no fallback support, no tools allowed |
| AI Tools (12 types) | HTTP Request, Code, Vector Store, Workflow, MCP Client, Calculator, Think, SerpApi, Wikipedia, SearXNG, WolframAlpha |
AI Validation Error Codes:
| Code | Description |
|---|---|
MISSING_LANGUAGE_MODEL | AI Agent/Chain requires ai_languageModel connection |
TOO_MANY_LANGUAGE_MODELS | Maximum 2 LLMs allowed (for fallback) |
FALLBACK_MISSING_SECOND_MODEL | needsFallback=true but only 1 LLM connected |
MISSING_OUTPUT_PARSER | hasOutputParser=true but no parser connected |
STREAMING_WITH_MAIN_OUTPUT | Agent in streaming mode can't have main outputs |
STREAMING_WRONG_TARGET | Streaming mode only works with AI Agent |
MULTIPLE_MEMORY_CONNECTIONS | Only 1 memory connection allowed |
MISSING_TOOL_DESCRIPTION | AI tool requires toolDescription |
MISSING_PROMPT_TEXT | promptType="define" but text is empty |
workflows createCreate a new workflow from a JSON file.
Usage:
n8n workflows create [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--file <path> | -f | Path to workflow JSON file | — |
--name <name> | -n | Override workflow name | — |
--dry-run | — | Preview without creating | — |
--skip-validation | — | Skip pre-API validation (not recommended) | — |
--json | — | Output as JSON | — |
Examples:
# Create workflow from file
n8n workflows create -f workflow.json
# Create with custom name
n8n workflows create -f workflow.json --name "My Custom Workflow"
# Preview without creating
n8n workflows create -f workflow.json --dry-run
# JSON output for scripting
n8n workflows create -f workflow.json --json
workflows importImport workflow from JSON file. This is an alias for create with slightly different syntax.
Usage:
n8n workflows import <file> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--name <name> | -n | Override workflow name | — |
--dry-run | — | Preview without creating | — |
--activate | — | Activate immediately after import | — |
--skip-validation | — | Skip pre-API validation (not recommended) | — |
--json | — | Output as JSON | — |
Examples:
# Import workflow
n8n workflows import workflow.json
# Import with custom name
n8n workflows import workflow.json --name "Production Workflow"
# Import and activate immediately
n8n workflows import workflow.json --activate
# Preview import
n8n workflows import workflow.json --dry-run
workflows updateUpdate an existing workflow with a new version.
Usage:
n8n workflows update <id> [options]
Options:
| Option | Description | Default |
|---|---|---|
--file <path> | Path to workflow JSON file | — |
--operations <json> | Comma-separated operation IDs | — |
--name <name> | Update workflow name | — |
--activate | Activate the workflow | — |
--deactivate | Deactivate the workflow | — |
--skip-validation | Skip pre-API validation | — |
--force, --yes | Skip confirmation prompts | — |
--no-backup | Skip creating backup | — |
--json | Output as JSON | — |
Examples:
# Update workflow from file
n8n workflows update abc123 -f updated-workflow.json
# Update workflow name only
n8n workflows update abc123 --name "Renamed Workflow"
# Activate/deactivate workflow
n8n workflows update abc123 --activate
n8n workflows update abc123 --deactivate
# Update with force (no confirmation)
n8n workflows update abc123 -f workflow.json --force
workflows activate / deactivateBulk activate or deactivate workflows.
Usage:
n8n workflows activate [options]
n8n workflows deactivate [options]
Options:
| Option | Description | Default |
|---|---|---|
--ids <ids> | Comma-separated workflow IDs | — |
--all | Apply to all workflows | — |
--force, --yes | Skip confirmation prompt | — |
--json | Output as JSON | — |
Examples:
# Activate specific workflows
n8n workflows activate --ids abc123,def456,ghi789
# Deactivate all workflows (with confirmation)
n8n workflows deactivate --all
# Force deactivate without confirmation (still creates backup)
n8n workflows deactivate --all --force
⚠️ Warning:
--allcombined with--forcewill delete all workflows. Use with extreme caution. Backups are saved to~/.n8n-cli/backups/unless--no-backupis specified.
workflows triggerTrigger a workflow via its webhook URL.
Usage:
n8n workflows trigger <webhookUrl> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--data <json> | -d | Request body (JSON string or @file.json) | {} |
--method <method> | -m | HTTP method: GET, POST, PUT, DELETE | POST |
--json | — | Output as JSON | — |
Examples:
# Trigger with POST (default)
n8n workflows trigger https://n8n.example.com/webhook/abc123
# Trigger with data
n8n workflows trigger https://n8n.example.com/webhook/abc123 \
--data '{"name": "John", "email": "john@example.com"}'
# Trigger with data from file
n8n workflows trigger https://n8n.example.com/webhook/abc123 \
--data @payload.json
# Trigger with GET method
n8n workflows trigger https://n8n.example.com/webhook/abc123 --method GET
workflows tagsGet or set tags for a workflow.
Usage:
n8n workflows tags <id> [options]
Options:
| Option | Description | Default |
|---|---|---|
--set <tagIds> | Set tags (comma-separated tag IDs) | — |
--force, --yes | Skip confirmation prompt | — |
--json | Output as JSON | — |
Examples:
# Get current tags
n8n workflows tags abc123
# Set tags (replaces existing)
n8n workflows tags abc123 --set tag1,tag2,tag3
# Force set without confirmation
n8n workflows tags abc123 --set tag1,tag2 --force
workflows autofixAdvanced autofix engine with confidence-based filtering for workflow validation issues.
Usage:
n8n workflows autofix <idOrFile> [options]
Options:
| Option | Description | Default |
|---|---|---|
--preview | Preview fixes without applying | (default) |
--apply | Apply fixes (to file or n8n server) | — |
--confidence <level> | Minimum confidence: high, medium, low | medium |
--fix-types <types> | Comma-separated fix types to apply | all |
--upgrade-versions | Apply version migration fixes | — |
--target-version <version> | Target version for upgrades | Latest |
--max-fixes <n> | Maximum number of fixes | 50 |
--save <path> | Save fixed workflow locally | — |
--force, --yes | Skip confirmation prompts | — |
--no-backup | Skip backup before changes | — |
--no-guidance | Suppress post-update guidance | — |
--json | Output as JSON | — |
| Fix Type | Confidence | Description |
|---|---|---|
expression-format | HIGH | Add missing = prefix to {{ }} expressions |
node-type-correction | HIGH | Fix typos in node types (when >90% match) |
webhook-missing-path | HIGH | Generate UUID paths for webhook nodes |
switch-options | HIGH | Fix Switch/If node options and conditions |
typeversion-correction | MEDIUM | Fix version exceeding max supported |
error-output-config | MEDIUM | Remove invalid onError settings |
typeversion-upgrade | MEDIUM | Suggest version upgrades |
version-migration | LOW | Breaking change migration hints |
After applying fixes, the autofix command displays actionable migration guidance for each affected node:
The guidance is included in JSON output (--json) as a postUpdateGuidance array containing structured migration instructions for each node. Use --no-guidance to suppress the guidance display in the terminal output.
Example Guidance Output:
╔════════════════════════════════════════════════════════╗
║ ℹ Post-Update Guidance ║
╚══════════════════════════════════════════════════════════╝
║ Node: My Switch (abc12345...) ║
║ Type: n8n-nodes-base.switch ║
║ Version: v2 → v3 ║
╟──────────────────────────────────────────────────────────────────────╢
║ Status: ◐ Partial (Manual review required) ║
║ Confidence: MEDIUM ║
║ Est. Time: 2-5 minutes ║
╟──────────────────────────────────────────────────────────────────────╢
║ ✓ Automated Changes (2): ║
║ • Migrated 'rules' to 'conditions.options' ║
║ • Updated rule structure to v3 format ║
╟──────────────────────────────────────────────────────────────────────╢
║ ⚠ Manual Actions Required (1): ║
║ • Review rule conditions and ensure type matching is correct ║
╟──────────────────────────────────────────────────────────────────────╢
║ ℹ Behavior Changes (1): ║
║ • Rule evaluation now strictly enforces data types ║
║ → String "123" will no longer match number 123 ║
╚══════════════════════════════════════════════════════════════════════╝
JSON Output Structure:
{
"success": true,
"fixesApplied": 12,
"postUpdateGuidance": [
{
"nodeId": "abc12345...",
"nodeName": "My Switch",
"nodeType": "n8n-nodes-base.switch",
"fromVersion": 2,
"toVersion": 3,
"status": "partial",
"confidence": "MEDIUM",
"estimatedTime": "2-5 minutes",
"automatedChanges": [
"Migrated 'rules' to 'conditions.options'",
"Updated rule structure to v3 format"
],
"manualActions": [
"Review rule conditions and ensure type matching is correct"
],
"behaviorChanges": [
{
"change": "Rule evaluation now strictly enforces data types",
"example": "String \"123\" will no longer match number 123"
}
]
}
]
}
Examples:
# Preview all fixes (default mode)
n8n workflows autofix abc123
# Preview from local file
n8n workflows autofix workflow.json
# Apply only high-confidence fixes
n8n workflows autofix abc123 --apply --confidence high
# Filter to specific fix types
n8n workflows autofix abc123 --fix-types expression-format,node-type-correction
# Apply version migration fixes
n8n workflows autofix workflow.json --upgrade-versions --apply
# Save fixed workflow locally
n8n workflows autofix workflow.json --apply --save fixed.json
# Apply with JSON output for scripting
n8n workflows autofix abc123 --apply --force --json
# Apply fixes without guidance display
n8n workflows autofix abc123 --apply --no-guidance
workflows versionsManage workflow version history, rollback, and cleanup. Versions are created automatically when you update or autofix workflows, stored locally in ~/.n8n-cli/data.db.
Usage:
n8n workflows versions [id] [options]
Options:
| Option | Description | Default |
|---|---|---|
--limit <n> | Limit version history results | 10 |
--get <version-id> | Get specific version details | — |
--rollback | Rollback to previous version | — |
--to-version <id> | Specific version ID for rollback | — |
--skip-validation | Skip validation before rollback | — |
--compare <v1,v2> | Compare two versions (comma-separated) | — |
--delete <version-id> | Delete specific version | — |
--delete-all | Delete all versions for workflow | — |
--prune | Prune old versions | — |
--keep <n> | Keep N most recent (with --prune) | 5 |
--stats | Show storage statistics (no ID required) | — |
--truncate-all | Delete ALL versions for ALL workflows | — |
--force, --yes | Skip confirmation prompts | — |
--no-backup | Skip backup before rollback | — |
--save <path> | Save version snapshot to JSON file | — |
--json | Output as JSON | — |
Note: Auto-pruning keeps max 10 versions per workflow automatically.
Examples:
# List version history
n8n workflows versions abc123
# View storage statistics (global)
n8n workflows versions --stats
# Get specific version details
n8n workflows versions abc123 --get 42
# Save version to file
n8n workflows versions abc123 --get 42 --save version.json
# Rollback to previous version
n8n workflows versions abc123 --rollback
# Rollback to specific version
n8n workflows versions abc123 --rollback --to-version 42
# Compare two versions
n8n workflows versions abc123 --compare 41,42
# Prune old versions (keep 5 most recent)
n8n workflows versions abc123 --prune --keep 5
# Delete specific version
n8n workflows versions abc123 --delete 42
# Delete all versions for workflow
n8n workflows versions abc123 --delete-all --force
workflows diffApply incremental diff operations to a workflow. Enables surgical modifications without full replacement.
Usage:
n8n workflows diff <id> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--operations <json> | -o | Diff operations (JSON string or @file.json) | — |
--file <path> | -f | Path to operations JSON file | — |
--dry-run | — | Validate without applying changes | false |
--continue-on-error | — | Apply valid operations, report failures | false |
--skip-validation | — | Skip pre-API validation | — |
--force, --yes | — | Skip confirmation prompts | — |
--no-backup | — | Skip backup before changes | — |
--save <path> | -s | Save result workflow to file | — |
--json | — | Output as JSON | — |
Node Operations:
addNode — Add a new noderemoveNode — Remove node and its connectionsupdateNode — Update node parametersmoveNode — Change node positionenableNode — Enable a disabled nodedisableNode — Disable node (keeps in workflow)Connection Operations:
addConnection — Add connection between nodesremoveConnection — Remove a connectionrewireConnection — Change connection targetcleanStaleConnections — Remove orphaned connectionsreplaceConnections — Replace all connectionsMetadata Operations:
updateSettings — Update workflow settingsupdateName — Rename workflowaddTag — Add tag to workflowremoveTag — Remove tag from workflowActivation Operations:
activateWorkflow — Activate workflowdeactivateWorkflow — Deactivate workflowFor IF and Switch nodes, you can use semantic parameters instead of numeric indexes:
| Node Type | Smart Parameter | Alternative | Description |
|---|---|---|---|
| IF Node | branch: "true" | sourceIndex: 0 | Connection from "true" output |
| IF Node | branch: "false" | sourceIndex: 1 | Connection from "false" output |
| Switch Node | case: 0 | sourceIndex: 0 | First case output |
| Switch Node | case: 1 | sourceIndex: 1 | Second case output |
| Switch Node | case: 2 | sourceIndex: 2 | Third case output |
Example using smart parameters:
{
"type": "addConnection",
"source": "IF",
"target": "Success Handler",
"branch": "true"
}
Equivalent using sourceIndex:
{
"type": "addConnection",
"source": "IF",
"target": "Success Handler",
"sourceIndex": 0
}
| Operation | JSON Syntax | Description |
|---|---|---|
addNode | {"type":"addNode","node":{"name":"HTTP","type":"n8n-nodes-base.httpRequest","position":[400,300],"parameters":{"url":"https://api.example.com"}}} | Add new node with position and parameters |
removeNode | {"type":"removeNode","nodeName":"Unused Node"} | Remove node and all its connections |
updateNode | {"type":"updateNode","nodeName":"Slack","updates":{"parameters.channel":"#alerts","parameters.text":"New message"}} | Update node parameters using dot notation |
moveNode | {"type":"moveNode","nodeName":"HTTP","position":[500,400]} | Change node canvas position |
enableNode | {"type":"enableNode","nodeName":"Debug"} | Enable a disabled node |
disableNode | {"type":"disableNode","nodeName":"Debug"} | Disable node (keeps in workflow) |
addConnection | {"type":"addConnection","source":"IF","target":"Success","branch":"true"} | Add connection between nodes |
removeConnection | {"type":"removeConnection","source":"IF","target":"Success","sourceIndex":0} | Remove specific connection |
rewireConnection | {"type":"rewireConnection","source":"IF","oldTarget":"OldNode","newTarget":"NewNode","sourceIndex":0} | Change connection target |
cleanStaleConnections | {"type":"cleanStaleConnections"} | Remove all orphaned connections |
replaceConnections | {"type":"replaceConnections","nodeName":"HTTP","connections":{"main":[[{"node":"Slack","type":"main","index":0}]]}} | Replace all connections for a node |
updateSettings | {"type":"updateSettings","settings":{"executionOrder":"v1"}} | Update workflow settings |
updateName | {"type":"updateName","name":"New Workflow Name"} | Rename workflow |
addTag | {"type":"addTag","tagId":"BCM4YL05avZ5KuP2"} | Add tag to workflow |
removeTag | {"type":"removeTag","tagId":"BCM4YL05avZ5KuP2"} | Remove tag from workflow |
activateWorkflow | {"type":"activateWorkflow"} | Activate workflow |
deactivateWorkflow | {"type":"deactivateWorkflow"} | Deactivate workflow |
Example Operations JSON:
{
"operations": [
{
"type": "addNode",
"node": {
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"position": [400, 300],
"parameters": { "url": "https://api.example.com" }
}
},
{
"type": "updateNode",
"nodeName": "Slack",
"updates": { "parameters.channel": "#alerts", "parameters.text": "New message" }
},
{
"type": "addConnection",
"source": "IF",
"target": "Success Handler",
"branch": "true"
},
{
"type": "removeNode",
"nodeName": "Unused Node"
}
]
}
Examples:
# Apply diff operations from JSON string
n8n workflows diff abc123 -o '{"operations":[{"type":"updateNode","nodeName":"Slack","updates":{"parameters.channel":"#alerts","parameters.text":"New message"}}]}'
# Apply diff operations from file
n8n workflows diff abc123 -f operations.json
# Dry-run to validate operations
n8n workflows diff abc123 -f operations.json --dry-run
# Apply with continue-on-error
n8n workflows diff abc123 -f operations.json --continue-on-error
# Save result without pushing to server
n8n workflows diff abc123 -f operations.json --save result.json
workflows deploy-templateDeploy a workflow template from n8n.io directly to your n8n instance.
Usage:
n8n workflows deploy-template <templateId> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--name <name> | -n | Custom workflow name | Template name |
--no-autofix | — | Skip auto-fix (expression format, etc.) | — |
--keep-credentials | — | Preserve credential references | — |
--dry-run | — | Preview without creating | — |
--save <path> | -s | Save locally instead of deploying | — |
--json | — | Output as JSON | — |
Features:
{{}} → ={{}})Examples:
# Deploy template (shows required credentials)
n8n workflows deploy-template 3121
# Deploy with custom name
n8n workflows deploy-template 3121 --name "My Custom Chatbot"
# Preview without deploying
n8n workflows deploy-template 3121 --dry-run
# Save locally instead of deploying
n8n workflows deploy-template 3121 --save chatbot-template.json
# Deploy without autofix
n8n workflows deploy-template 3121 --no-autofix
# Keep credential references (useful for debugging)
n8n workflows deploy-template 3121 --keep-credentials
Finding Templates:
Use templates search to discover templates before deploying:
# Search by keyword
n8n templates search "keyword"
# Search by nodes used
n8n templates search --by-nodes node1,node2
# Search by task category
n8n templates search --by-task ai_automation
# Get template details
n8n templates get 3121
nodesSearch, browse, and inspect n8n's 800+ bundled nodes entirely offline. All node metadata is stored in a local SQLite database — no API connection required.
| Command | Description | API Required |
|---|---|---|
list | List all available nodes | ✗ |
search | Search nodes by keyword | ✗ |
show | Get detailed node information | ✗ |
get | Alias for show | ✗ |
categories | List node categories | ✗ |
validate | Validate node configuration | ✗ |
breaking-changes | Analyze version breaking changes | ✗ |
nodes listList all available nodes with filtering and grouping options.
Usage:
n8n nodes list [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--by-category | — | Group nodes by category | — |
--category <name> | -c | Filter by specific category | — |
--compact | — | Compact output (name only) | — |
--limit <n> | -l | Limit results | — |
--save <path> | -s | Save output to JSON file | — |
--json | — | Output as JSON | — |
Examples:
# List all nodes
n8n nodes list
# List all nodes in a category
n8n nodes list --category "Marketing & Content"
# Compact list (names only)
n8n nodes list --compact
# JSON output for scripting
n8n nodes list --json | jq '.nodes | length'
nodes searchSearch nodes by keyword with multiple search modes and FTS5 full-text search support.
Usage:
n8n nodes search <query> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--mode <mode> | -m | Search mode: OR, AND, FUZZY | OR |
--category <name> | -c | Filter by category | — |
--limit <n> | -l | Limit results | 20 |
--save <path> | -s | Save output to file | — |
--json | — | Output as JSON | — |
Search Modes:
| Mode | Description | Use Case |
|---|---|---|
OR | Match any keyword | Broad search, discovering options |
AND | Match all keywords | Precise multi-term search |
FUZZY | Levenshtein distance matching | Typo-tolerant search |
When an FTS5 index (nodes_fts table) exists in the bundled database, the CLI automatically uses BM25-ranked full-text search for faster, more relevant results:
| Feature | Description |
|---|---|
| Auto-detection | FTS5 tables detected lazily on first search |
| BM25 ranking | Results sorted by relevance score (term frequency × inverse document frequency) |
| Phrase matching | Use quotes for exact phrases: "http request" |
| Boolean operators | Support for AND, OR, NOT in queries |
| Graceful fallback | Falls back to LIKE search on FTS5 syntax errors |
| FUZZY mode exception | FUZZY mode always uses Levenshtein distance (no FTS5) |
FTS5 Examples:
# OR search with BM25 ranking (default)
n8n nodes search "slack message"
# AND search (all must match)
n8n nodes search "http request" --mode AND
# Phrase search (exact match)
n8n nodes search '"send email"'
# Fuzzy search (typo tolerance)
n8n nodes search "slak" --mode FUZZY
How FTS5 Improves Results:
| Without FTS5 (LIKE search) | With FTS5 (full-text search) |
|---|---|
| Sequential scan through all nodes | Indexed search (faster) |
| No relevance ranking | Results ranked by relevance |
| Results in alphabetical order | Best matches first |
| Basic substring matching | Better handling of partial words |
Examples:
# Basic search (OR mode)
n8n nodes search "slack"
# Multi-word search (all must match)
n8n nodes search "http request" --mode AND
# Fuzzy search (typo tolerance)
n8n nodes search "slak" --mode FUZZY
# Search within category
n8n nodes search "google" --category "Marketing & Content"
# JSON output
n8n nodes search "email" --json
nodes showGet detailed information about a specific node type with multiple output modes and version comparison capabilities.
Usage:
n8n nodes show <nodeType> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--detail <level> | -d | Detail level: minimal (~200 tokens), standard (~1-2K), full (~3-8K) | standard |
--mode <mode> | -m | Operation mode (see table below) | info |
--query <term> | — | Property search term (for search-properties mode) | — |
--from <version> | — | Source version (for compare, breaking, migrations) | — |
--to <version> | — | Target version (for compare, migrations) | Latest |
--max-results <n> | — | Max property search results | 20 |
--include-type-info | — | Include type structure metadata | — |
--include-examples | — | Include real-world configuration examples | — |
--resource <name> | -r | Filter by resource | — |
--operation <name> | -o | Filter by operation | — |
--version <n> | -v | Specific typeVersion | Latest |
--schema | — | Legacy: equivalent to --detail full | — |
--minimal | — | Legacy: equivalent to --detail minimal | — |
--examples | — | Legacy: equivalent to --include-examples | — |
--save <path> | -s | Save output to file | — |
--json | — | Output as JSON | — |
Detail Levels:
| Level | Token Count | Contents | Use Case |
|---|---|---|---|
minimal | ~200 tokens | Basic info + essential properties | Quick lookups, AI context optimization |
standard | ~1-2K tokens | Essential properties + operations | Default for most use cases |
full | ~3-8K tokens | Complete schema with all properties | Workflow generation, comprehensive reference |
Operation Modes:
| Mode | Description | Required Options |
|---|---|---|
info | Node configuration schema (default) | — |
docs | Markdown documentation | — |
search-properties | Find properties by keyword | --query <term> |
versions | Version history with breaking changes | — |
compare | Property diff between versions | --from <version> |
breaking | Breaking changes between versions | --from <version> (optional) |
migrations | Auto-migratable changes | --from <version>, --to <version> (optional) |
Examples:
# Quick lookup (~200 tokens) - ideal for AI agents
n8n nodes show httpRequest --detail minimal --json
# Standard info with examples
n8n nodes show slack --include-examples
# Full schema for workflow generation
n8n nodes show googleSheets --detail full --json
# Search for authentication-related properties
n8n nodes show httpRequest --mode search-properties --query "auth"
# Search for OAuth properties
n8n nodes show googleSheets --mode search-properties --query "oauth" --max-results 5
# View version history
n8n nodes show httpRequest --mode versions
# Compare versions (property diff)
n8n nodes show httpRequest --mode compare --from 1 --to 4.2
# Show breaking changes between versions
n8n nodes show webhook --mode breaking --from 1 --to 2
# Get migration instructions
n8n nodes show switch --mode migrations --from 2 --to 3
# Get specific operation schema
n8n nodes show googleSheets --resource sheet --operation append
# Human-readable documentation
n8n nodes show slack --mode docs
# Get credential requirements
n8n nodes show github --credentials
Token Optimization for AI Agents:
For AI agents working with token limits, use --detail minimal to get essential node information in ~200 tokens:
# Minimal output (200 tokens)
n8n nodes show slack --detail minimal --json
# Only fetch full schema when generating workflows
n8n nodes show slack --detail full --json
nodes getAlias for nodes show for backward compatibility.
Usage:
n8n nodes get <nodeType> [options]
Examples:
# Get node info
n8n nodes get slack
# Get with JSON output
n8n nodes get httpRequest --json
💡 Tip: Use
nodes showfor full feature access including all output modes and filters.
nodes categoriesList all node categories.
Usage:
n8n nodes categories [options]
Options:
| Option | Description | Default |
|---|---|---|
--with-counts | Include node count per category | — |
--json | Output as JSON | — |
Examples:
# List categories
n8n nodes categories
# With node counts
n8n nodes categories --with-counts
# JSON output
n8n nodes categories --json
nodes validateValidate node-specific configurations in a workflow.
Usage:
n8n nodes validate <file> [options]
Options:
| Option | Description | Default |
|---|---|---|
--node-name <name> | Validate specific node only | — |
--node-type <type> | Filter by node type | — |
--json | Output as JSON | — |
The enhanced validator includes operation-aware validation for common node types:
| Node Type | Validations Performed |
|---|---|
| Slack | Channel format (#channel or channel ID), message content required, 40K character limit, thread reply timestamp format, @mention syntax validation, block kit validation |
| HTTP Request | URL format (must start with http/https), method validation (GET/POST/PUT/DELETE/PATCH), authentication method warnings, SSL/TLS options, timeout ranges, proxy configuration |
| Webhook | Path format validation (no special chars), UUID generation for empty paths, response mode validation, error handling recommendations |
| Code | JavaScript/Python syntax checks, return statement validation, async function handling, sandboxed API usage, console.log warnings |
| Database Nodes (Postgres, MySQL, MongoDB) | SQL injection pattern detection, parameterized query suggestions, connection string validation, query syntax checks |
| OpenAI | Model selection validation, token limit warnings (per model), temperature bounds (0-2), max_tokens validation, response format checks |
| Google Sheets | Range format (A1:B10 notation), spreadsheet ID validation (must be 44 chars), operation-specific parameter checks, sharing permission warnings |
| Email (Send Email, Gmail, Outlook) | Email address format validation, attachment size limits, HTML content sanitization, recipient list validation |
| IF/Switch | Condition logic validation, data type compatibility checks, comparison operator validation, fallback configuration |
Slack Node Validation:
n8n nodes validate workflow.json --node-type n8n-nodes-base.slack --json
HTTP Request Node Validation:
n8n nodes validate workflow.json --node-type n8n-nodes-base.httpRequest --json
Code Node Validation:
n8n nodes validate workflow.json --node-type n8n-nodes-base.code --json
Examples:
# Validate all nodes in workflow
n8n nodes validate workflow.json
# Validate specific node by name
n8n nodes validate workflow.json --node-name "Slack"
# Filter by node type
n8n nodes validate workflow.json --node-type n8n-nodes-base.slack
nodes breaking-changesAnalyze breaking changes between node versions.
Usage:
n8n nodes breaking-changes <nodeType> [options]
Options:
| Option | Description | Default |
|---|---|---|
--from <version> | Starting version | — |
--to <version> | Target version | Latest |
--severity <level> | Min severity: LOW, MEDIUM, HIGH | — |
--json | Output as JSON | — |
Examples:
# Check all breaking changes
n8n nodes breaking-changes n8n-nodes-base.switch
# Check specific version range
n8n nodes breaking-changes n8n-nodes-base.switch --from 2 --to 3
# Filter by severity
n8n nodes breaking-changes n8n-nodes-base.if --severity HIGH
credentialsManage n8n credentials for workflow authentication.
| Command | Description | API Required |
|---|---|---|
list | List all credentials | ✓ |
create | Create new credential | ✓ |
delete | Delete credential | ✓ |
schema | Get credential schema | ✓ |
types | List credential types | ✗ |
credentials listList all credentials in your n8n instance.
Usage:
n8n credentials list [options]
Options:
| Option | Description | Default |
|---|---|---|
--limit <n> | Limit results | 20 |
--save <path> | Save output to file | — |
--json | Output as JSON | — |
Examples:
n8n credentials list
n8n credentials list --json
credentials createCreate a new credential.
Usage:
n8n credentials create [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--type <type> | -t | Credential type (required) | — |
--name <name> | -n | Credential name (required) | — |
--data <json> | -d | Credential data (JSON or @file.json) | — |
--json | — | Output as JSON | — |
💡 Security Tip: Use
@file.jsonsyntax to avoid exposing secrets in shell history. Setchmod 600on credential files.
Secure Workflow:
# Step 1: Get credential type schema to know required fields
n8n credentials schema githubApi
# Step 2: Create credential data file with restricted permissions
cat > github-creds.json << 'EOF'
{
"accessToken": "ghp_your_token_here",
"user": "your-username",
"server": "https://api.github.com"
}
EOF
# Step 3: Set restrictive permissions (owner read/write only)
chmod 600 github-creds.json
# Step 4: Create credential using file reference (no secrets in shell history)
n8n credentials create \
--type githubApi \
--name "GitHub Production" \
--data @github-creds.json
# Step 5: Securely delete the temporary file
shred -u github-creds.json # Linux
# or
rm -P github-creds.json # macOS
Why This Matters:
| ⚠️ Insecure Method | ✅ Secure Method |
|---|---|
--data '{"token":"xxx"}' | --data @file.json |
| Secrets in shell history | No shell history exposure |
Visible in ps output | Not visible in process list |
| No permission control | File permissions: 600 |
| Permanent in bash history | File deleted after use |
Additional Security Tips:
N8N_STRICT_PERMISSIONS=true to enforce file permission checks*-creds.json to .gitignoreExamples:
# Create from inline JSON (not recommended)
n8n credentials create -t githubApi -n "GitHub" -d '{"accessToken":"xxx"}'
# Create from file (recommended)
n8n credentials create -t slackApi -n "Slack Bot" -d @slack-creds.json
credentials deleteDelete a credential.
Usage:
n8n credentials delete <id> [options]
Options:
| Option | Description | Default |
|---|---|---|
--force, --yes | Skip confirmation | — |
--json | Output as JSON | — |
credentials schemaGet the JSON schema for a credential type. Alias: show-type.
Usage:
n8n credentials schema <type> [options]
Examples:
n8n credentials schema githubApi
n8n credentials schema slackApi --json
credentials typesList available credential types (offline).
Usage:
n8n credentials types [options]
Options:
| Option | Description | Default |
|---|---|---|
--by-auth | Group by auth type | — |
--search <query> | Search by name | — |
--limit <n> | Limit results | — |
--json | Output as JSON | — |
Examples:
n8n credentials types
n8n credentials types --by-auth
n8n credentials types --search oauth
executionsView and manage workflow execution history.
| Command | Description | API Required |
|---|---|---|
list | List executions | ✓ |
get | Get execution details | ✓ |
retry | Retry failed execution | ✓ |
delete | Delete execution | ✓ |
executions listList workflow executions with filtering and pagination support.
Usage:
n8n executions list [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--workflow <id> | -w | Filter by workflow ID | — |
--status <status> | — | Filter: success, error, waiting, running | — |
--limit <n> | -l | Limit results | 20 |
--cursor <cursor> | — | Pagination cursor for next page | — |
--save <path> | -s | Save output to file | — |
--json | — | Output as JSON | — |
| Status | Description | Retryable | Common Causes |
|---|---|---|---|
success | Completed successfully | ✗ | — |
error | Failed with error | ✓ | Node errors, API failures, invalid data |
waiting | Paused, waiting for input | ✗ | Manual trigger nodes, waiting for webhook |
running | Currently executing | ✗ | Long-running workflows (rare in list) |
canceled | Manually stopped | ✗ | User cancellation |
crashed | n8n process crash | ✓ | Out of memory, system errors |
unknown | Status cannot be determined | ✗ | Database inconsistency |
# Count executions by status
n8n executions list --limit 0 --json | \
jq '.data | group_by(.status) | map({status: .[0].status, count: length})'
# Get IDs of all failed executions
n8n executions list --status error --limit 0 --json | \
jq -r '.data[].id'
# Find executions that took longer than 30 seconds
n8n executions list --limit 0 --json | \
jq '.data[] | select(.duration > 30000) | {id, workflowName, duration}'
# Extract error messages from failed executions
n8n executions list --status error --limit 0 --json | \
jq '.data[] | {id, error: .error.message}'
# Get execution history for specific workflow
WORKFLOW_ID="abc123"
n8n executions list --workflow $WORKFLOW_ID --limit 0 --json | \
jq '.data[] | {id, status, startedAt, duration}'
Examples:
n8n executions list
n8n executions list --workflow abc123
n8n executions list --status error --limit 50
n8n executions list --json | jq '.data[] | select(.status == "error")'
executions getGet detailed execution information.
Usage:
n8n executions get <id> [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--mode <mode> | -m | Output: preview, summary, filtered, full | preview |
--save <path> | -s | Save output to file | — |
--json | — | Output as JSON | — |
Output Modes:
| Mode | Contents | Data Size | Use Case |
|---|---|---|---|
preview | Status + timing + first/last node results | ~5-20 KB | Quick status check, error overview |
summary | All node statuses + execution flow | ~20-100 KB | Execution debugging, flow verification |
filtered | Specific nodes only, truncated data | ~50-200 KB | Focus on specific nodes, reduced payload |
full | Complete execution data including all inputs/outputs | 500 KB - 50+ MB | Deep debugging, data inspection |
⚠️ Warning:
fullmode can return megabytes of data for workflows with large datasets. Use--save <file>to avoid terminal overflow:n8n executions get 9361 --mode full --save execution-dump.json
jq Examples for Execution Analysis:
# Get error details from failed execution
n8n executions get 9361 --json | jq '.data.error'
# Extract specific node's output
n8n executions get 9361 --mode full --json | \
jq '.data.data.resultData.runData["Node Name"][0].data.main[0]'
# Find which node failed
n8n executions get 9361 --json | \
jq '.data.data.resultData.runData | to_entries[] | select(.value[0].error) | .key'
# Get execution timeline (duration per node)
n8n executions get 9361 --mode summary --json | \
jq '.data.data.resultData.runData | to_entries[] | {node: .key, duration: .value[0].executionTime}'
Examples:
n8n executions get exec123
n8n executions get exec123 --mode full --save execution.json
executions retryRetry a failed execution.
Usage:
n8n executions retry <id> [options]
Options:
| Option | Description | Default |
|---|---|---|
--load-latest | Use latest workflow version | — |
--json | Output as JSON | — |
| Aspect | Default Behavior | With --load-latest |
|---|---|---|
| Workflow Version | Uses snapshot from original execution | Uses current workflow version |
| Input Data | Original execution input data | Same (original input data) |
| Credentials | Current credentials | Current credentials |
| Variables | Current environment variables | Current environment variables |
| Node Configurations | From execution snapshot | From current workflow |
--load-latestUse --load-latest when:
Use default (snapshot) when:
💡 Note: Only executions with status
errororcrashedcan be retried. The retry creates a new execution with a new ID.
Examples:
# Retry with exact same workflow version (safe)
n8n executions retry 9361
# Retry with updated workflow (after fixing bug)
n8n executions retry 9361 --load-latest
# Retry and get JSON output
n8n executions retry 9361 --json | jq '.newExecutionId'
executions deleteDelete an execution.
Usage:
n8n executions delete <id> [options]
Options:
| Option | Description | Default |
|---|---|---|
--force, --yes | Skip confirmation | — |
--json | Output as JSON | — |
variablesManage n8n environment variables (Enterprise/Pro feature).
Variables are accessed in workflows using {{ $vars.VARIABLE_KEY }} syntax.
They provide instance-wide environment configuration shared across all workflows, making them ideal for:
Key Format Requirements:
| Requirement | Valid Examples | Invalid Examples |
|---|---|---|
| Must start with letter or underscore | API_KEY, _config, DbUrl | 123_KEY, -value |
| Only letters, numbers, underscores | API_KEY_2, db_host_1 | api-key, db.host, api key |
| Case-sensitive | API_KEY ≠ api_key ≠ Api_Key | — |
| No spaces or special characters | DATABASE_URL, MAX_RETRIES | DATABASE URL, MAX-RETRIES |
Example Usage in Workflow:
{
"nodes": [
{
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"url": "={{ $vars.API_BASE_URL }}/users",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"httpHeaderAuth": {
"name": "Authorization",
"value": "={{ 'Bearer ' + $vars.API_TOKEN }}"
}
}
}
]
}
⚠️ Warning: Deleting a variable that is used in active workflows will cause those workflows to fail with "Variable not found" errors. Check variable usage before deletion:
# Search workflows for variable usage n8n workflows list --json | jq '.data[] | select(.nodes | tostring | contains("$vars.API_KEY"))'
variables listList all variables in your n8n instance.
Usage:
n8n variables list [options]
Options:
| Option | Description | Default |
|---|---|---|
--limit <n> | Limit results | 20 |
--save <path> | Save output to file | — |
--json | Output as JSON | — |
Examples:
n8n variables list
n8n variables list --json
variables createCreate a new variable.
Usage:
n8n variables create [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--key <key> | -k | Variable key (required) | — |
--value <value> | -v | Variable value (required) | — |
--scope <scope> | -s | Scope: global, workflow | global |
--json | — | Output as JSON | — |
Examples:
# Create global variable
n8n variables create --key API_URL --value "https://api.example.com"
# Create workflow-scoped variable
n8n variables create --key DB_PASSWORD --value "secure-pass" --scope workflow
variables updateUpdate an existing variable.
Usage:
n8n variables update [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--key <key> | -k | Variable key (required) | — |
--value <value> | -v | Variable value (required) | — |
--scope <scope> | -s | Scope: global, workflow | — |
--force, --yes | Skip confirmation | — | |
--json | — | Output as JSON | — |
Examples:
# Update global variable
n8n variables update --key API_URL --value "https://new-api.example.com"
# Update workflow-scoped variable
n8n variables update --key DB_PASSWORD --value "new-pass" --scope workflow
variables deleteDelete a variable.
Usage:
n8n variables delete [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--key <key> | -k | Variable key (required) | — |
--scope <scope> | -s | Scope: global, workflow | — |
--force, --yes | Skip confirmation | — | |
--json | — | Output as JSON | — |
Examples:
# Delete global variable
n8n variables delete --key API_URL --force
# Delete workflow-scoped variable
n8n variables delete --key DB_PASSWORD --scope workflow --force
tagsOrganize workflows with tags.
| Command | Description |
|---|---|
list | List all tags |
get | Get tag details |
create | Create new tag |
update | Update tag |
delete | Delete tag |
Examples:
# List tags
n8n tags list
# Create tag
n8n tags create --name "production"
# Update tag
n8n tags update tag123 --name "prod"
# Delete tag
n8n tags delete tag123 --force
💡 Tip: Use
workflows tagscommand to assign tags to workflows.
templatesSearch and manage workflow templates from n8n.io.
| Command | Description | Source |
|---|---|---|
search | Search templates | API or local |
get | Get template details | API |
list-tasks | List task categories | Local |
templates searchSearch templates with multiple modes.
Usage:
n8n templates search [query] [options]
Options:
| Option | Description | Default |
|---|---|---|
--by-nodes <nodes> | Search by nodes used (local) | — |
--by-task <task> | Search by task category (local) | — |
--local | Force local search | — |
--category <name> | Filter by category | — |
--limit <n> | Limit results | 20 |
--json | Output as JSON | — |
Search Modes:
| Mode | Source | Use Case |
|---|---|---|
| Keyword | API | General discovery |
| By Nodes | Local | Find templates using specific nodes |
| By Task | Local | Find templates by purpose |
Use with --by-task for curated template discovery:
| Task Category | Description | Example Use Cases |
|---|---|---|
ai_automation | AI/ML workflows using OpenAI, Anthropic, etc. | Chatbots, content generation, classification |
data_sync | Data synchronization between services | CRM sync, database replication |
webhook_processing | Webhook handlers and API integrations | GitHub webhooks, Stripe events |
email_automation | Email sending, filtering, parsing | Newsletter automation, support tickets |
slack_integration | Slack bots and notifications | Alert systems, slash commands |
data_transformation | ETL and data processing | CSV transformation, API normalization |
file_processing | File upload/download/processing | PDF generation, image processing |
scheduling | Scheduled tasks and cron jobs | Daily reports, cleanup jobs |
api_integration | API workflow orchestration | Multi-API workflows, data aggregation |
database_operations | Database CRUD operations | Backup, migration, cleanup |
social_media | Social media automation | Auto-posting, monitoring |
notifications | Multi-channel notifications | SMS, email, push notifications |
reporting | Report generation and delivery | Analytics, dashboards |
crm_integration | CRM workflows (Salesforce, HubSpot) | Lead management, contact sync |
Task Search Examples:
# Find AI automation templates
n8n templates search --by-task ai_automation
# Find Slack integration templates
n8n templates search --by-task slack_integration --limit 20
# Combine with other filters
n8n templates search --by-task api_integration --complexity simple
| Aspect | API Search (default) | Local Search (--by-nodes, --by-task) |
|---|---|---|
| Speed | 500-2000ms | <50ms |
| Network Required | ✓ | ✗ |
| Freshness | Latest templates | Bundled templates (updated with CLI) |
| Coverage | All public templates | ~2000 most popular templates |
| Ranking | Relevance + popularity | Category-based |
| Use Case | General discovery | Quick offline reference |
When to Use Each:
Use API Search when:
Use Local Search when:
Examples:
# Keyword search (API)
n8n templates search "keyword"
# Search by nodes (local, offline)
n8n templates search --by-nodes openAi,slack
# Search by task category
n8n templates search --by-task ai_automation
# Combined filters
n8n templates search "sales" --category "Sales"
templates getGet detailed template information.
Usage:
n8n templates get <templateId> [options]
Examples:
n8n templates get 3121
n8n templates get 3121 --json
n8n templates get 3121 --save template.json
templates list-tasksList available task categories for --by-task search.
Usage:
n8n templates list-tasks [options]
auditGenerate security and configuration audit reports.
Usage:
n8n audit [options]
Options:
| Option | Description | Default |
|---|---|---|
--categories <list> | Filter categories | all |
--min-risk <level> | Minimum risk level | — |
--save <path> | Save report to file | — |
--json | Output as JSON | — |
Audit Categories:
| Category | Description |
|---|---|
credentials | Credential security analysis |
database | Database configuration |
filesystem | File system security |
nodes | Node risk assessment |
instance | Instance settings |
Examples:
# Full audit
n8n audit
# Specific categories
n8n audit --categories credentials,nodes
# High-risk issues only
n8n audit --min-risk high
# JSON output for CI/CD
n8n audit --json --save audit-report.json
# Get high-risk issues only
n8n audit --json | jq '.sections[] | select(.riskScore >= 7)'
# Count issues by severity
n8n audit --json | jq '[.sections[].issues[] | .severity] | group_by(.) | map({severity: .[0], count: length})'
# List all high-severity issues across all categories
n8n audit --json | jq '.sections[].issues[] | select(.severity == "high") | {category: .category, title: .title, description: .description}'
# Get credentials that haven't been used in 90+ days
n8n audit --categories credentials --json | jq '.sections[] | select(.title == "Unused Credentials") | .issues[].affectedResources[]'
# Find workflows with risky nodes (Code, Execute Command)
n8n audit --categories nodes --json | jq '.sections[] | select(.title | contains("Risky")) | .issues[].affectedResources[]'
# Export audit summary to CSV
n8n audit --json | jq -r '["Category","Risk Score","Issues"], (.sections[] | [.title, .riskScore, (.issues | length)]) | @csv' > audit-summary.csv
💡 Note: Some audit checks require admin privileges on the n8n instance. Instance-level checks may not be available on cloud/shared hosting.
authManage CLI authentication configuration.
auth loginConfigure API credentials.
Usage:
n8n auth login [options]
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--host <url> | -h | n8n host URL | N8N_HOST env |
--api-key <key> | -k | API key | N8N_API_KEY env |
--profile <name> | -p | Configuration profile | default |
--interactive | -i | Interactive setup wizard | — |
When using --interactive, the CLI guides you through setup with prompts:
$ n8n auth login --interactive
╔════════════════════════════════════════════════════════╗
║ n8n CLI Configuration Setup ║
╚════════════════════════════════════════════════════════╝
? n8n Host URL: https://your-n8n.com
(The URL of your n8n instance, e.g., https://n8n.example.com)
? API Key: ********************************
(Get from n8n Settings → API → Create API Key)
? Configuration Profile Name: [production]
(Optional: Save as named profile. Press Enter for 'default')
? Test connection now? [Y/n] Y
✓ Testing connection...
✓ Connected successfully to https://your-n8n.com
✓ API version: 1.56.0
✓ Latency: 45ms
? Save configuration? [Y/n] Y
✓ Configuration saved to ~/.n8nrc
You're all set! Try: n8n workflows list
For temporary usage or CI/CD, use environment variables instead of saving configuration:
# One-time usage (doesn't save to file)
N8N_HOST=https://n8n.example.com \
N8N_API_KEY=your-api-key \
n8n workflows list
# Export for current session
export N8N_HOST=https://n8n.example.com
export N8N_API_KEY=your-api-key
n8n workflows list
# GitHub Actions / GitLab CI
env:
N8N_HOST: ${{ secrets.N8N_HOST }}
N8N_API_KEY: ${{ secrets.N8N_API_KEY }}
Getting Your API Key:
Examples:
# Interactive setup (recommended for first time)
n8n auth login --interactive
# Direct configuration
n8n auth login --host https://n8n.example.com --api-key your-key
# Named profile
n8n auth login --host https://staging.n8n.example.com --profile staging
auth statusCheck current authentication status. Alias: whoami.
Usage:
n8n auth status
n8n auth whoami
auth logoutClear stored authentication.
Usage:
n8n auth logout
healthCheck n8n instance connectivity and API status.
Usage:
n8n health [options]
Options:
| Option | Description | Default |
|---|---|---|
--json | Output as JSON | — |
Checks Performed:
| Error Message | Cause | Solution |
|---|---|---|
getaddrinfo ENOTFOUND | DNS resolution failed | • Check hostname spelling • Verify DNS is working • Try IP address instead |
connect ECONNREFUSED | Connection refused | • Wrong port (check :5678 vs :443) • n8n not running • Firewall blocking connection |
connect ETIMEDOUT | Connection timeout | • Network issue • Firewall/proxy blocking • n8n behind VPN • Try increasing timeout: N8N_TIMEOUT=60000 |
401 Unauthorized | Invalid API key | • Regenerate API key in n8n Settings • Check for extra spaces in key • Verify key hasn't been revoked |
403 Forbidden | API access disabled | • Enable API in n8n Settings • Check user permissions |
certificate error / UNABLE_TO_VERIFY_LEAF_SIGNATURE | Self-signed SSL cert | • Add cert to system trust store • Use NODE_TLS_REJECT_UNAUTHORIZED=0 (dev only)• Use http:// instead of https:// (dev only) |
404 Not Found | Wrong API endpoint | • Check n8n version (API changed in v1.0) • Verify host URL path (should end at domain, no /api) |
502 Bad Gateway | Reverse proxy issue | • Check nginx/apache config • Verify n8n is running • Check reverse proxy logs |
EPROTO / SSL routines | SSL/TLS version mismatch | • Update Node.js version • Check server TLS configuration |
Debug Connection Issues:
# Test with verbose output
N8N_DEBUG=true n8n health
# Test with curl first
curl -I https://your-n8n.com/api/v1/workflows
# Test API authentication
curl -H "X-N8N-API-KEY: your-key" https://your-n8n.com/api/v1/workflows
# Custom timeout (60 seconds)
N8N_TIMEOUT=60000 n8n health
# Ignore SSL errors (dev/testing only)
NODE_TLS_REJECT_UNAUTHORIZED=0 n8n health
Examples:
n8n health
n8n health --json
configView CLI configuration.
config showDisplay current configuration.
Usage:
n8n config show [options]
Options:
| Option | Description | Default |
|---|---|---|
--json | Output as JSON | — |
completionGenerate shell completion scripts.
Usage:
n8n completion <shell>
Supported Shells: bash, zsh, fish
Installation:
# Bash
n8n completion bash >> ~/.bashrc
# Zsh
n8n completion zsh >> ~/.zshrc
# Fish
n8n completion fish > ~/.config/fish/completions/n8n.fish
validate (Legacy)Legacy validation command for basic JSON structure checking.
Note: For comprehensive validation with profiles, AI node validation, version checks, and auto-fix capabilities, use
n8n workflows validateinstead.
Usage:
n8n validate <file> [options]
Options:
| Option | Description | Default |
|---|---|---|
--repair | Attempt to fix common JSON syntax errors | — |
--fix | Apply automatic fixes | — |
--save <path> | Save output to file | — |
--json | Output as JSON | — |
The --repair flag attempts to fix common JSON syntax errors before validation:
Repairs Applied:
| Issue | Example | Fixed |
|---|---|---|
| Trailing commas | {"key": "value",} | {"key": "value"} |
| Unquoted keys | {key: "value"} | {"key": "value"} |
| Single quotes | {'key': 'value'} | {"key": "value"} |
| JavaScript objects | {name: value, id: 123} | {"name": "value", "id": 123} |
| Missing commas | {"a": 1 "b": 2} | {"a": 1, "b": 2} |
| Comments | {"key": "value" /* comment */} | {"key": "value"} |
| Backticks | {"key": `template ${x}`} | {"key": "template value"} |
Repair Examples:
# Repair and validate
n8n validate broken-workflow.json --repair
# Repair, validate, fix issues, and save
n8n validate broken-workflow.json --repair --fix --save fixed.json
# JSON output with repair details
n8n validate broken-workflow.json --repair --json
Example Repair Output:
{
"repaired": true,
"repairs": [
{
"type": "TRAILING_COMMA",
"line": 15,
"column": 5,
"description": "Removed trailing comma after last object property"
},
{
"type": "UNQUOTED_KEY",
"line": 23,
"column": 3,
"description": "Added quotes around object key 'parameters'"
}
],
"valid": true
}
💡 Note: For full validation features (profiles, AI node validation, version checks), use
n8n workflows validateinstead of the legacyvalidatecommand.
Examples:
# Basic validation
n8n validate workflow.json
# With repair
n8n validate broken-workflow.json --repair
# JSON output
n8n validate workflow.json --json
This section provides guidance for AI agents integrating with n8n-cli.
┌─────────────────────────────────────────────────────────────────────────┐
│ AGENT WORKFLOW │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ 1. Agent receives user request for n8n workflow │
│ │ │
│ ▼ │
│ 2. Search nodes: n8n nodes search "keyword" --json │
│ │ │
│ ▼ │
│ 3. Get schemas: n8n nodes show <type> --detail minimal --json │
│ │ │
│ ▼ │
│ 4. Generate workflow JSON and write to file │
│ │ │
│ ▼ │
│ 5. Validate: n8n workflows validate workflow.json --json │
│ │ │
│ ┌─────────┴─────────┐ │
│ ▼ ▼ │
│ [Valid] [Errors] │
│ │ │ │
│ │ ▼ │
│ │ 6. Parse errors, fix issues, goto step 5 │
│ │ │
│ ▼ │
│ 7. Deploy: n8n workflows import workflow.json --json │
│ │
└─────────────────────────────────────────────────────────────────────────┘
| Challenge | CLI Solution |
|---|---|
| Token limits on large JSON | Write to file, validate locally |
| API rate limits | Offline validation and node lookup |
| Hallucinated schemas | correctUsage in error responses |
| Debugging complex workflows | Local iteration without network |
| Version control | Local files, git-friendly |
For richer AI integration, see the companion n8n-mcp project which provides Model Context Protocol (MCP) tools for n8n workflow development.
The CLI uses POSIX-standard exit codes for reliable scripting:
| Code | Name | Description | When Returned |
|---|---|---|---|
0 | SUCCESS | Command completed successfully | All data valid, operation successful |
1 | GENERAL_ERROR | General/unknown error | Unhandled exceptions, unexpected failures |
64 | USAGE_ERROR | Invalid command usage | Wrong arguments, unknown command, missing required option |
65 | DATAERR | Invalid input data | Validation failed, malformed JSON, resource not found |
66 | NOINPUT | Cannot open input file | File doesn't exist, permission denied on read |
70 | SOFTWARE_ERROR | Internal error | CLI bug, assertion failure, database corruption |
73 | NETWORK_ERROR | Network/API failure | Connection timeout, DNS failure, API error (5xx) |
78 | CONFIG_ERROR | Configuration error | Missing config, invalid credentials, auth failure |
#!/bin/bash
# Validate and deploy workflow with error handling
WORKFLOW_FILE="workflow.json"
# Validate workflow
n8n workflows validate "$WORKFLOW_FILE" --json > result.json
EXIT_CODE=$?
case $EXIT_CODE in
0)
echo "✓ Validation passed. Deploying..."
n8n workflows import "$WORKFLOW_FILE" --activate
if [ $? -eq 0 ]; then
echo "✓ Deployment successful"
exit 0
else
echo "✗ Deployment failed"
exit 1
fi
;;
65)
echo "✗ Validation failed:"
jq -r '.errors[] | " - \(.nodeName): \(.code)"' result.json
exit 65
;;
66)
echo "✗ File not found: $WORKFLOW_FILE"
exit 66
;;
73)
echo "✗ Network error - check connection to n8n instance"
exit 73
;;
78)
echo "✗ Configuration error - check N8N_HOST and N8N_API_KEY"
exit 78
;;
*)
echo "✗ Unknown error (exit code: $EXIT_CODE)"
exit 1
;;
esac
import subprocess
import sys
import json
def validate_workflow(file_path):
"""Validate workflow and return structured result."""
result = subprocess.run(
['n8n', 'workflows', 'validate', file_path, '--json'],
capture_output=True,
text=True
)
if result.returncode == 0:
return {'valid': True, 'data': json.loads(result.stdout)}
elif result.returncode == 65:
return {'valid': False, 'errors': json.loads(result.stdout).get('errors', [])}
elif result.returncode == 73:
raise ConnectionError("Network error - check n8n connection")
elif result.returncode == 78:
raise ValueError("Configuration error - check credentials")
else:
raise RuntimeError(f"Unknown error: {result.returncode}")
# Usage
try:
result = validate_workflow('workflow.json')
if result['valid']:
print("✓ Valid")
else:
for error in result['errors']:
print(f"✗ {error['nodeName']}: {error['code']}")
except Exception as e:
print(f"Error: {e}")
sys.exit(1)
.PHONY: validate deploy
validate:
@echo "Validating workflows..."
@for file in workflows/*.json; do \
n8n workflows validate "$$file" --profile strict || exit 65; \
done
@echo "✓ All workflows valid"
deploy: validate
@echo "Deploying workflows..."
@for file in workflows/*.json; do \
n8n workflows import "$$file" --activate || exit 1; \
done
@echo "✓ All workflows deployed"
# Count workflows
n8n workflows list --json | jq '.data | length'
# Get active workflow IDs
n8n workflows list --active --limit 0 --json | jq '.data[].id'
# Extract validation errors
n8n workflows validate wf.json --json | jq '.errors[] | "\(.nodeName): \(.code)"'
# Find nodes by type
n8n workflows get <id> --json | jq '.nodes[] | select(.type | contains("slack"))'
name: Validate Workflows
on: [push, pull_request]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install n8n-cli
run: npm install -g cli-n8n
- name: Validate Workflows
run: |
for f in workflows/*.json; do
n8n workflows validate "$f" --profile strict
done
validate-workflows:
image: node:20
script:
- npm install -g cli-n8n
- |
for f in workflows/*.json; do
n8n workflows validate "$f" --profile strict
done
n8n auth login --interactive # Interactive setup
n8n auth status # Check auth
n8n health # Test connection
n8n workflows list # List all
n8n workflows list --active # Active only
n8n workflows get <id> # Get one
n8n workflows export <id> -o f.json # Export
n8n workflows validate f.json # Validate
n8n workflows validate f.json --fix --save fixed.json # Fix
n8n workflows import f.json # Deploy
n8n workflows autofix f.json --apply # Auto-fix
n8n workflows deploy-template 3121 # Deploy template
n8n nodes search "slack" # Search
n8n nodes show slack --detail minimal # Quick lookup
n8n nodes show slack --schema # Full schema
n8n nodes categories # List categories
n8n credentials list # List all
n8n credentials types # Available types
n8n credentials create -t type -n name -d @creds.json
n8n executions list # Recent
n8n executions list --status error # Failed only
n8n executions get <id> # Details
n8n executions retry <id> # Retry
n8n templates search "keyword" # Search
n8n templates search --by-task ai_automation # By task
n8n templates get 3121 # Get details
| Error | Cause | Solution |
|---|---|---|
Missing N8N_HOST | Host not configured | Set env var or config file |
Missing N8N_API_KEY | API key not configured | Get from n8n Settings → API |
401 Unauthorized | Invalid API key | Regenerate key |
Connection refused | Wrong host/port | Check URL |
ENOTFOUND | DNS resolution failed | Check hostname |
ETIMEDOUT | Connection timeout | Check firewall/proxy |
Certificate error | TLS issue | Check SSL cert |
# Test connectivity
curl -I https://your-n8n.com/api/v1/workflows
# Check with verbose
N8N_DEBUG=true n8n health
# Use custom timeout
N8N_TIMEOUT=60000 n8n workflows list
Q: Does this CLI work offline? A: Node lookup, validation, and autofix work offline. API operations (list, create, deploy) require n8n connection.
Q: Where are workflows validated? A: Locally against bundled schemas. No data sent to n8n until deployment.
Q: How do I use multiple n8n instances?
A: Use profiles in .n8nrc.json and --profile flag or N8N_PROFILE env var.
Q: Is my API key secure?
A: Use chmod 600 on config files, prefer env vars in CI/CD.
Q: Why do expressions need = prefix?
A: n8n requires ={{ }} not {{ }} for expression evaluation.
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 64 | Usage error |
| 65 | Data/validation error |
| 66 | Input not found |
| 70 | Software error |
| 73 | Network error |
| 78 | Config error |
# Clone repository
git clone https://github.com/yigitkonur/n8n-cli.git
cd n8n-cli
# Install dependencies
npm install
# Build
npm run build
# Run locally
node dist/cli.js --help
# Type check
npm run typecheck
# Run tests
npm test
src/
├── cli.ts # Entry point, command registration
├── commands/ # Command handlers
│ ├── workflows/ # Workflow commands
│ ├── nodes/ # Node commands
│ ├── credentials/ # Credential commands
│ └── ...
├── core/ # Core logic
│ ├── api/ # API client
│ ├── validation/ # Validators
│ ├── autofix/ # Autofix engine
│ ├── versioning/ # Version management
│ └── db/ # SQLite adapter
├── types/ # TypeScript types
└── utils/ # Utilities
FAQs
Full-featured n8n CLI - workflow management, validation, node search, and more
The npm package n8n-cli receives a total of 50 weekly downloads. As such, n8n-cli popularity was classified as not popular.
We found that n8n-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.