### n8n Scripts

Utility scripts to batch upload, download and transfer workflows as JSON data to and from an n8n instance via
its REST API.

=========================================================================================
### Features
- download: Fetch items workflows from n8n and store locally.
- upload: Push local workflows to n8n.
- transfer: Combine download then upload for migrating between two instances without local storage
- cli: Unified command line entrypoint wrapping the download and upload operations.

=========================================================================================
### Installation
```bash
poetry install
```

=========================================================================================
### Usage

#### Interactive Mode
```bash
poetry run python ./main.py
```

The api_key can also be provided in files [root directory]:
- `api_key_download.txt` for download operations
- `api_key_upload.txt` for upload operations

#### CLI Mode
Download
```bash
poetry run python ./cli.py download --instance_url <INSTANCE_URL> --api_key <API_KEY> --folder_path <FOLDER_PATH>
```

Upload
```bash
poetry run python ./cli.py upload --instance_url <INSTANCE_URL> --api_key <API_KEY> --folder_path <FOLDER_PATH>
```

The api_key can also be provided via the N8N_API_KEY environment variable.