Workflow Export/Import Feature Guide
Overview
The workflow export/import feature allows you to transfer workflows between environments (e.g., development to production), backup workflows, or share workflow configurations. This is particularly useful for deployment pipelines and environment migrations.
Features
1. Bulk Export
- Select multiple workflows using checkboxes
- Export to a JSON file with metadata
- Includes workflow name, trigger type, flow data, variables, and allowed roles
- File naming:
workflows-export-YYYY-MM-DD.json
2. Import with Preview
- Upload a JSON file containing workflows
- Preview conflicts before importing
- Shows summary of new vs. existing workflows
- Lists workflows that will be overwritten
3. Conflict Resolution
- Import New Only: Skips existing workflows, imports only new ones
- Import & Overwrite: Updates existing workflows and imports new ones
- Clear visualization of conflicts with workflow details
4. Import Results
- Shows number of workflows created, updated, and skipped
- Error handling for invalid files or failed imports
- Automatically refreshes the workflow list after import
API Endpoints
Export Workflows (Bulk)
POST /workflows/export
Content-Type: application/json
Body:
{
"workflowIds": [1, 2, 3]
}
Response: JSON file downloadExport Single Workflow
GET /workflows/:id/export
Response: JSON file downloadImport Preview
POST /workflows/import/preview
Content-Type: multipart/form-data
Body:
- file: JSON file
Response:
{
"total": 5,
"new": 3,
"conflicts": [
{
"id": "workflow-1",
"name": "User Registration",
"trigger_type": "hook"
}
]
}Import Workflows
POST /workflows/import
Content-Type: multipart/form-data
Body:
- file: JSON file
- overwrite: "true" or "false"
Response:
{
"success": true,
"created": 3,
"updated": 2,
"skipped": 0,
"errors": []
}Export File Format
{
"version": "1.0",
"exportedAt": "2025-01-14T10:30:00.000Z",
"exportedBy": "user@example.com",
"workflows": [
{
"id": "workflow-1",
"name": "User Registration",
"description": "Handles new user registration",
"trigger_type": "hook",
"trigger_config": {
"collection": "users",
"event": "create"
},
"status": "active",
"allowed_roles": ["admin", "manager"],
"flow_data": {
"nodes": [...],
"edges": [...]
},
"variables": {},
"options": {}
}
]
}Usage Guide
Exporting Workflows
- Navigate to the Workflows page
- Select workflows using checkboxes
- Click the "Export" button (shows count of selected workflows)
- JSON file downloads automatically
- Selection clears after successful export
Importing Workflows
- Click the "Import" button
- Select a JSON file containing workflows
- Review the import preview:
- Total workflows in file
- New workflows (will be created)
- Existing workflows (conflicts)
- Choose import strategy:
- Import New Only: Keeps existing workflows unchanged
- Import & Overwrite: Updates existing workflows with new data
- Confirm import
- Review success message with import statistics
Best Practices
Development to Production Migration
-
Export from Development:
- Select workflows ready for production
- Export to JSON file
- Version control the export file
-
Review Before Import:
- Always use the preview feature
- Check for conflicts
- Verify workflow configurations
-
Staged Import:
- First, import with "Import New Only" to avoid disruption
- Review imported workflows in production
- Then decide whether to overwrite existing workflows
-
Backup First:
- Export existing production workflows before importing
- Keep backups in version control or secure storage
Workflow Naming Conventions
To minimize conflicts:
- Use consistent naming patterns (e.g.,
prod-,dev-) - Include environment in workflow descriptions
- Document workflow dependencies
Security Considerations
-
Role Restrictions:
- Imported workflows maintain their
allowed_roles - Verify role names match between environments
- Review permissions after import
- Imported workflows maintain their
-
Sensitive Data:
- Export files may contain sensitive configuration
- Store export files securely
- Review variables for credentials or secrets
-
Import Status:
- All imported workflows have status set to "draft"
- Manually activate workflows after testing
- This prevents accidental execution in production
Error Handling
Common Errors
-
Invalid File Format:
- Ensure JSON is valid
- Check file contains required fields
- Use exported files as templates
-
Missing Metadata:
- Export file must include version and workflows array
- Use the export feature to generate valid files
-
Database Errors:
- Check database connectivity
- Verify required collections exist
- Review workflow node configurations
Recovery
If import fails:
- Check the error message in the response
- Review the import file for validity
- Try importing a single workflow first
- Contact support if errors persist
Migration Checklist
- Export workflows from source environment
- Backup destination environment workflows
- Review export file for sensitive data
- Verify role names match between environments
- Import with preview first
- Choose appropriate import strategy
- Review import results
- Test imported workflows in draft mode
- Activate workflows after validation
- Document the migration
Technical Notes
Import Behavior
- Workflows are matched by
idfield (not database ID) - Overwrite updates all fields except database ID and timestamps
- New workflows are created with status "draft"
- Role validation occurs during execution, not import
- Flow data (nodes/edges) is completely replaced on overwrite
Performance
- Export is limited to 100 workflows per request
- Large workflows with complex flow_data may take longer
- Import processing is synchronous (waits for completion)
- Consider exporting in batches for large datasets
Compatibility
- Export format version: 1.0
- Compatible with baasix workflow system v2.0+
- Node types must be supported in destination environment
- Custom node types require extensions to be installed
Support
For issues or questions:
- Check logs in the browser console
- Review API response errors
- Test with a single workflow first
- Verify file format matches documentation
See also
- Workflow Routes - API endpoints for workflow operations
- Custom Workflow Modules - Extend workflows with custom script nodes
- Hooks and Endpoints Guide - Use hooks to trigger workflows and integrate services
- Baasix Extensions - Create extensions for import/export automation
- Deployment Guide - Best practices for migrating workflows between environments
Last Updated: 2025-01-14