Skip to content

Environment Variables

Logan McDuffie edited this page Dec 19, 2025 · 1 revision

n8n-cli can be configured using environment variables. These take precedence over saved configuration.

Available Variables

Variable Description Default
N8N_API_URL n8n instance URL (from config file)
N8N_API_KEY API authentication key (from config file)
N8N_CLI_FORMAT Default output format json
N8N_CLI_DEBUG Enable debug mode (show stack traces) false

Examples

Override API URL for a single command

N8N_API_URL=http://staging:5678 n8n-cli workflows

Set default table output

export N8N_CLI_FORMAT=table
n8n-cli workflows  # Uses table format

Enable debug mode

N8N_CLI_DEBUG=true n8n-cli workflows

CI/CD Configuration

For CI/CD pipelines, set environment variables instead of using the config file:

# GitHub Actions example
env:
  N8N_API_URL: ${{ secrets.N8N_API_URL }}
  N8N_API_KEY: ${{ secrets.N8N_API_KEY }}

steps:
  - run: n8n-cli workflows --active

Docker Usage

docker run --rm \
  -e N8N_API_URL=http://host.docker.internal:5678 \
  -e N8N_API_KEY=your-api-key \
  your-image n8n-cli workflows

Priority Order

Configuration is loaded in this order (later values override earlier ones):

  1. Config file (~/.config/n8n-cli/.env)
  2. Environment variables
  3. Command-line flags

Clone this wiki locally