Move n8n workflows between instances: JSON, CLI and packages
How to move n8n workflows to another instance: copy and paste, JSON files, the server CLI, or n8n packages, with credentials, dependencies and repeat imports.

To move a single n8n workflow, download it as JSON from the workflow menu and import it on the other instance, then reconnect its credentials. To move many workflows repeatedly, for example from development to production, use n8n packages: a .n8np file you export and import through the public API or the n8n-cli. Packages bring folders, credential references and sub-workflows along, never carry credential secrets, and update existing workflows instead of duplicating them.
The short version:
- One workflow, once: copy and paste nodes, or Download and Import from File in the workflow menu. Credentials travel as name and ID only.
- All workflows at once, with shell access: the server CLI's
n8n export:workflowandimport:workflowcommands run on the instance itself. n8n plans to deprecate them in favor of packages, with no date set. - Repeatable moves: n8n packages, available since n8n 2.27.0 and still in Preview. Exported and imported via
/api/v1/n8n-packagesorn8n-cli package. - Dependencies are strict: a workflow with an error workflow or a sub-workflow fails a default export until you include them.
- Credentials arrive as placeholders you fill in on the target.
We tested packages between two fresh n8n 2.48.6 instances, the current stable release, using the public API.
Which method to use
| Method | Best for | What moves |
|---|---|---|
| Copy and paste nodes | Parts of a workflow, quick one-offs | The selected nodes and their connections |
| Download / Import from File | One whole workflow | The workflow JSON, with credential names and IDs |
Server CLI (n8n export:workflow, n8n import:workflow) | Bulk moves when you have shell access to both instances | Workflow JSON files, and credentials with their own commands |
n8n packages (API or n8n-cli) | Promotions between environments, migrations, sharing without secrets | Workflows, agents, folders or projects, plus credential stubs, data table schemas, variables and tags |
The editor's workflow menu also has Import from URL on 2.x, but n8n 3.0 removes it; see our 3.0 guide.
Move one workflow as JSON
From n8n's export and import docs: open the workflow, select the workflow menu in the canvas header, and choose Download. On the target instance, create a workflow and choose Import from File, or select all nodes on the source canvas (Ctrl+C or Cmd+C) and paste them (Ctrl+V or Cmd+V) into the target.
Two things to know before you share a file:
- Credentials don't travel, but their names do. The docs warn that exported JSON includes credential names and IDs, and that an HTTP Request node imported from cURL can contain authentication headers. Check the file before you share it.
- You reconnect credentials by hand on the target, node by node.
That's fine for one workflow. It gets tedious for twenty, and it does nothing about the error workflow or sub-workflows a workflow depends on.
Move many workflows with the server CLI
If you can run commands on both instances, the server CLI exports and imports workflows as files (CLI docs):
# On the source instance (inside the container for Docker)
n8n export:workflow --all --output=workflows.json
n8n export:workflow --id=<workflow-id> --output=one.json
# On the target instance
n8n import:workflow --input=workflows.jsonThere are matching export:credentials and import:credentials commands. n8n's docs now recommend packages over these commands for new work and say the server CLI export and import commands will be deprecated, though no date is scheduled. They also note a known issue: on an instance that isn't multi-main, a previously active workflow's cron triggers keep running after an import until you restart n8n.
Move workflows with n8n packages
An n8n package is a gzipped tar file (.n8np) with one JSON file per workflow, credential and other entity, plus a manifest.json listing what the target instance has to supply (package docs). Packages arrived in n8n 2.27.0, per n8n's changelog, and are still in Preview: n8n says the format and API may change without a major version bump. There's no package option in the editor.
What travels and what doesn't, per the docs:
| Travels | Doesn't travel |
|---|---|
| Workflows (nodes, connections, settings, published and archived state), folders, projects, tags | Credential secrets and other values typed in directly |
| Credential references: ID, name, type, and fields set by an expression | Data table rows (only the schema travels) |
| Variables, with their values unless you exclude them | Executions, version history, pinned data, users, sharing |
Export
You need an API key with the workflow:export scope. Our public API guide shows how to create one.
curl -X POST 'https://dev.example.com/api/v1/n8n-packages/export' \
-H 'X-N8N-API-KEY: <your-api-key>' \
-H 'Content-Type: application/json' \
-d '{"workflowIds": ["<workflow-id>"], "dependencyPolicy": "include-in-package"}' \
-o sync-orders.n8npOur source instance had a workflow, Sync orders (Schedule Trigger and an HTTP Request node with a Header Auth credential), whose settings named an error workflow, Error alerts. What happened:
- Without
dependencyPolicy, the export returned400with1 workflow dependency not included in the package. Export aborted.The default policy,fail, refuses to leave out a sub-workflow or error workflow you didn't name. - With
"dependencyPolicy": "include-in-package", the export returned200and anX-N8n-Export-Countsheader of{"agents":0,"workflows":2,"folders":0,"credentials":1,...}: both workflows and one credential. - Inside the archive, the credential file held only its ID, name and type. The header value we had saved in the credential appeared nowhere in the package.
The third option, reference-only, leaves dependencies out and lists them in the manifest as things the target must already have. The n8n-cli equivalent is n8n-cli package export --workflow-id=<id> --dependency-policy=include-in-package --output=sync-orders.n8np.
Import
The import endpoint takes a multipart form with the file in a package field. conflictPolicy is required when you call the API directly:
curl -X POST 'https://prod.example.com/api/v1/n8n-packages/import' \
-H 'X-N8N-API-KEY: <your-api-key>' \
-F 'package=@sync-orders.n8np' \
-F 'conflictPolicy=new-version'The key needs workflow:import, plus other scopes depending on what the import creates: tag:create for new tags, workflow:activate to publish, and so on (permissions). n8n checks the whole package before writing anything and lists every problem at once if something would block it, such as a node type the target doesn't have.
On our target instance, the first import returned status: created for both workflows and listed the credential under credentials.stubbed: n8n created an empty credential called Example API key in the target project. The workflows kept their source IDs, and Sync orders still pointed at Error alerts as its error workflow.
Import again to promote changes
We changed the URL in Sync orders on the source, published it there, exported again and imported the new file. Both workflows came back as status: updated, the target still had exactly two workflows, and the new URL was in place. n8n matches a package workflow to the one it created before, so the same command works for every promotion.
By default (publishingPolicy preserve-published-state), a new workflow stays unpublished, and an updated one is republished only if it was published before. With match-source, imported workflows follow the source's published state.
Credentials on the target
Three options control credentials (import docs):
credentialMatchingMode:id-only(default),name-and-typeortype-only. When production has its own credentials with different IDs,name-and-typelets a package find them.credentialMissingMode:create-stub(default) creates an empty placeholder;create-with-valuesfills it from fields set by an expression, such as={{ $secrets.apiKey }}, which suits instances that read secrets from an external store;must-preexistrefuses the import.- Bindings map a package credential to a specific target credential, for example
--bindings='{"credentials":{"<source-id>":"<target-id>"}}'with the CLI. The import response returns the bindings it used, so you can reuse them next time.
Common errors and fixes
| Error | Cause and fix |
|---|---|
1 workflow dependency not included in the package. Export aborted. | The workflow calls a sub-workflow or names an error workflow you didn't export. Add its ID, or use dependencyPolicy include-in-package or reference-only. |
403 on export | The API key lacks workflow:export (or variable:list when the workflows use variables and values are bundled). |
415 on import | The request isn't multipart/form-data. Send the file in a package form field. |
400 on import with an empty conflictPolicy | conflictPolicy is required when you call the API directly; use new-version, fail or skip. |
| A workflow imports but won't publish | It uses a placeholder credential or a node type the instance doesn't have. Fill in the credential or install the node, then publish. |
Related guides
- How to update self-hosted n8n safely: back up before you import into production.
- Self-host n8n with Docker Compose: set up the second instance.
- n8n public API: API keys and scopes for scripting exports and imports.
- n8n source control: on Business and Enterprise plans, keep dev and prod in sync through a Git repository.
Sources
- Export and import workflows (n8n docs)
- n8n packages (n8n docs source on GitHub)
- Export a package (n8n docs source on GitHub)
- Import a package (n8n docs source on GitHub)
- How import works (n8n docs source on GitHub)
- Package limits and permissions (n8n docs source on GitHub)
- CLI commands (n8n docs)
- n8n changelog, n8n packages (n8n docs source on GitHub)
Editorial team
The then8nblog editorial team researches every article from n8n's release notes, documentation and source code, states the n8n version each guide was tested on, and has every post reviewed by a human editor before it goes live.



