The n8n‑workflow‑sync CLI addresses the gap in n8n's out‑of‑the‑box tooling around version control and automated deployments of your workflows. By default, n8n stores all workflow definitions in its internal database and exposes them only via its web UI. This means:
- No easy Git integration: You can't "git diff" changes, review pull‑requests, or roll back to earlier revisions of a workflow without manually exporting/importing JSON files.
- Manual copy‑paste pain: Every time you want to move a workflow from development to staging or production, you have to export it from one instance and import it into another by hand.
- Limited CI/CD support: There's no straightforward way to script or automate workflow updates in build pipelines.
n8n‑workflow‑sync solves these by giving you a simple CLI that:
- Pulls a workflow's JSON via the n8n REST API into a local directory you can
git initand commit. - Lets you edit the workflow JSON in your favorite editor, tracking every change in Git.
- Pushes your local edits back up to the n8n server, either interactively or non‑interactively (for CI).
All configuration (endpoint) is stored in a config file, your API key lives in your OS keychain, and every pull/push becomes a Git commit. This makes workflow development as friction‑free as normal code, enables code reviews, automated deployments, and full history tracking.
n8n-workflow-sync is a command line tool to list and create workflows on an n8n instance. It aims to let you version control workflows locally and sync them via the n8n REST API.
Pre-built binaries are available on the GitHub releases page. Currently we publish a macOS (Intel) build generated by our GitHub Actions workflow. To install:
-
Download the
n8n-workflow-sync-macosasset from the latest release. -
Mark it as executable:
chmod +x n8n-workflow-sync-macos. -
Move it somewhere on your
PATH, for example:mv n8n-workflow-sync-macos /usr/local/bin/n8n-workflow-sync
Support for additional operating systems will be added in future releases.
Note for macOS users: The binary is not notarised (the maintainer has not joined the Apple Developer Program). The first time you run it, macOS Gatekeeper may block it. Right‑click the file in Finder, choose Open, and confirm the prompt so that future launches work normally.
Set the following environment variables so the CLI can authenticate with your n8n server:
export N8N_HOST=https://your.n8n.instance/
export N8N_API_KEY=your-api-keyThen run n8n-workflow-sync with one of the available subcommands:
# List workflows
n8n-workflow-sync list
# Create a new workflow
n8n-workflow-sync new "My Flow"
# Download an existing workflow
n8n-workflow-sync pull 123 workflow.json
# Upload changes back to n8n
n8n-workflow-sync push 123 workflow.jsonThis project is written in Rust and uses cargo for building and testing:
cargo build
cargo testThis project is licensed under the MIT License. See LICENSE-MIT for details.

