Export Workflows
Export workflows from your n8n instance to JSON files.Basic Usage
Export Flags
Export all workflows from the database.
The ID of a specific workflow to export.
Output file path or directory (when using
--separate).Format JSON output for easier reading.
Export each workflow to a separate file. Requires
--output to be a directory.Shortcut that enables
--all --pretty --separate. Only requires --output.The version ID to export (for workflow versioning).
Export the published/active version of workflows.
Export Examples
- Single Workflow
- All Workflows
- Separate Files
- Backup
- Version Export
Export one workflow:With pretty formatting:
Import Workflows
Import workflows from JSON files into your n8n instance.Basic Usage
Import Flags
Input file path or directory (when using
--separate).Import all
*.json files from the specified directory.Assign imported workflows to a specific user ID.
Assign imported workflows to a specific project ID.
Import Examples
- Single File
- Multiple Files
- Assign to User
- Assign to Project
- Restore Backup
Import one workflow file:
Ownership Rules: You cannot use
--userId and --projectId together. If a workflow already exists and is owned by another user/project, the import will fail to prevent accidental ownership changes.Export Credentials
Export credentials from your n8n instance.Security Warning: By default, credentials are exported in encrypted form. Use the
--decrypted flag only when migrating between instances with different encryption keys.Basic Usage
Export Credential Flags
Export all credentials from the database.
The ID of a specific credential to export.
Output file path or directory (when using
--separate).Format JSON output for easier reading.
Export each credential to a separate file.
Shortcut that enables
--all --pretty --separate.Export credentials in plain text. USE WITH CAUTION! All sensitive information will be visible.
Export Credential Examples
- Single Credential
- All Credentials
- Backup
- Decrypted Export
Export one credential (encrypted):
Import Credentials
Import credentials from JSON files into your n8n instance.Basic Usage
Import Credential Flags
Input file path or directory (when using
--separate).Import all
*.json files from the specified directory.Assign imported credentials to a specific user ID.
Assign imported credentials to a specific project ID.
Import Credential Examples
- Single File
- Directory Import
- Assign to User
- Assign to Project
Import one credential file:
Encryption Handling: If you import decrypted credentials (plain text), n8n automatically encrypts them using the instance’s encryption key before storing.
Migration Workflow
Same Encryption Key
If both instances use the same encryption key:Different Encryption Keys
If instances have different encryption keys:Security Best Practice: Always delete decrypted credential files immediately after import. Never commit them to version control or store them unencrypted.
Backup Strategy
Recommended backup approach:Version Control Integration
Export workflows for Git version control:Never commit credentials to version control! Only export and version control workflows. Store credentials separately using secure secret management.
Export/Import Best Practices
Regular Backups
Regular Backups
- Schedule automated daily/weekly backups
- Store backups in multiple locations
- Test restore procedure regularly
- Keep backups for at least 30 days
Security
Security
- Never export decrypted credentials unless necessary
- Delete decrypted files immediately after use
- Store backup files securely with encryption
- Use separate credentials for each environment
Version Control
Version Control
- Use
--pretty --separatefor readable diffs - Only commit workflows, never credentials
- Review changes before committing
- Tag releases with version numbers
Migration
Migration
- Test migration in staging first
- Verify workflow IDs and references
- Check credential mappings
- Update environment-specific values
Troubleshooting
Import fails with ownership error
Import fails with ownership error
Problem: Workflow/credential already exists with different owner.Solution: Remove
--userId or --projectId flag to keep existing ownership, or delete the existing item first.Credentials not working after import
Credentials not working after import
Problem: Imported credentials don’t work in target instance.Solutions:
- Ensure same encryption key if importing encrypted
- Use
--decryptedexport if keys are different - Re-enter credentials manually if issues persist
Cannot export: directory not found
Cannot export: directory not found
Problem: Output directory doesn’t exist.Solution: Create directory first or n8n will create it automatically.
Next Steps
CLI Commands
View all CLI commands
User Management
Manage users via CLI
Configuration
Configure n8n settings
Backup & Restore
Complete backup strategies