n8n Package API
N8nPackageClient manages workflow import and export packages.
This handle is beta-aligned with the public API and is useful when you need to move groups of workflows between instances or environments.
Access
const n8nPackage = client.n8nPackage();
Methods
Common Tasks
- export one or more workflows as a gzipped package
- import a package into a target project or folder
- decide how workflow conflicts should be handled during import
exportWorkflows(data)
Export workflows as a downloadable package.
const buffer = await client.n8nPackage().exportWorkflows({
workflowIds: ['wf-1', 'wf-2'],
});
// buffer is ArrayBuffer (gzipped package)
importPackage(pkg, options)
Import a workflow package (zip file). The pkg parameter accepts a File or Blob object.
const result = await client.n8nPackage().importPackage(
fileBlob,
{
projectId: 'proj-123',
folderId: 'folder-456',
credentialMatchingMode: 'id-only',
credentialMissingMode: 'must-preexist',
workflowConflictPolicy: 'new-version',
},
);
workflowConflictPolicy is required. Use it to make import behavior explicit instead of relying on defaults.
Import Options
| Option | Type | Description |
|---|---|---|
projectId | string | Target project for imported workflows |
folderId | string | Target folder for imported workflows |
credentialMatchingMode | 'id-only' | How to match existing credentials |
credentialMissingMode | 'must-preexist' | Fail if credentials are missing |
workflowConflictPolicy | 'new-version' | 'fail' | 'skip' | How to handle workflow conflicts |