# SFTP (/integrations/sftp)



{/* MANUAL-CONTENT-START:intro */}

Use SFTP (SSH File Transfer Protocol) to upload or download files, list directories with optional metadata, delete files or directories, and create directories on a remote server. Authenticate with a password or OpenSSH private key; provide a passphrase for an encrypted key.

Uploads accept workspace files or direct text content. The current Download operation returns a stored file reference for later workflow steps. Recursive deletion removes directory contents, so check the target path before enabling it.

{/* MANUAL-CONTENT-END */}

## Use the block [#usage-instructions]

Upload, download, list, and manage files on remote servers via SFTP. Supports both password and private key authentication for secure file transfers.

## Actions [#actions]

### SFTP Upload [#sftp-upload]

Upload files to a remote SFTP server

#### Input [#input]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `host` | string | Yes | SFTP server hostname or IP address |
| `port` | number | Yes | SFTP server port (default: 22) |
| `username` | string | Yes | SFTP username |
| `password` | string | No | Password for authentication (if not using private key) |
| `privateKey` | string | No | Private key for authentication (OpenSSH format) |
| `passphrase` | string | No | Passphrase for encrypted private key |
| `remotePath` | string | Yes | Destination directory on the remote server |
| `files` | file\[] | No | Files to upload |
| `fileContent` | string | No | Direct file content to upload (for text files) |
| `fileName` | string | No | File name when using direct content |
| `overwrite` | boolean | No | Whether to overwrite existing files (default: true) |
| `permissions` | string | No | File permissions (e.g., 0644) |

#### Output [#output]

| Parameter | Type | Description |
| - | - | - |
| `success` | boolean | Whether the upload was successful |
| `uploadedFiles` | json | Array of uploaded file details (name, remotePath, size) |
| `message` | string | Operation status message |

### SFTP Download [#sftp-download]

Download a file from a remote SFTP server

#### Input [#input-1]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `host` | string | Yes | SFTP server hostname or IP address |
| `port` | number | Yes | SFTP server port (default: 22) |
| `username` | string | Yes | SFTP username |
| `password` | string | No | Password for authentication (if not using private key) |
| `privateKey` | string | No | Private key for authentication (OpenSSH format) |
| `passphrase` | string | No | Passphrase for encrypted private key |
| `remotePath` | string | Yes | Path to the file on the remote server |

#### Output [#output-1]

| Parameter | Type | Description |
| - | - | - |
| `file` | file | Downloaded file stored in execution files |

### SFTP List Directory [#sftp-list-directory]

List files and directories on a remote SFTP server

#### Input [#input-2]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `host` | string | Yes | SFTP server hostname or IP address |
| `port` | number | Yes | SFTP server port (default: 22) |
| `username` | string | Yes | SFTP username |
| `password` | string | No | Password for authentication (if not using private key) |
| `privateKey` | string | No | Private key for authentication (OpenSSH format) |
| `passphrase` | string | No | Passphrase for encrypted private key |
| `remotePath` | string | Yes | Directory path on the remote server |
| `detailed` | boolean | No | Include detailed file information (size, permissions, modified date) |

#### Output [#output-2]

| Parameter | Type | Description |
| - | - | - |
| `success` | boolean | Whether the operation was successful |
| `path` | string | Directory path that was listed |
| `entries` | json | Array of directory entries with name, type, size, permissions, modifiedAt |
| `count` | number | Number of entries in the directory |
| `message` | string | Operation status message |

### SFTP Delete [#sftp-delete]

Delete a file or directory on a remote SFTP server

#### Input [#input-3]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `host` | string | Yes | SFTP server hostname or IP address |
| `port` | number | Yes | SFTP server port (default: 22) |
| `username` | string | Yes | SFTP username |
| `password` | string | No | Password for authentication (if not using private key) |
| `privateKey` | string | No | Private key for authentication (OpenSSH format) |
| `passphrase` | string | No | Passphrase for encrypted private key |
| `remotePath` | string | Yes | Path to the file or directory to delete |
| `recursive` | boolean | No | Delete directories recursively |

#### Output [#output-3]

| Parameter | Type | Description |
| - | - | - |
| `success` | boolean | Whether the deletion was successful |
| `deletedPath` | string | Path that was deleted |
| `message` | string | Operation status message |

### SFTP Create Directory [#sftp-create-directory]

Create a directory on a remote SFTP server

#### Input [#input-4]

| Parameter | Type | Required | Description |
| - | - | - | - |
| `host` | string | Yes | SFTP server hostname or IP address |
| `port` | number | Yes | SFTP server port (default: 22) |
| `username` | string | Yes | SFTP username |
| `password` | string | No | Password for authentication (if not using private key) |
| `privateKey` | string | No | Private key for authentication (OpenSSH format) |
| `passphrase` | string | No | Passphrase for encrypted private key |
| `remotePath` | string | Yes | Path for the new directory |
| `recursive` | boolean | No | Create parent directories if they do not exist |

#### Output [#output-4]

| Parameter | Type | Description |
| - | - | - |
| `success` | boolean | Whether the directory was created successfully |
| `createdPath` | string | Path of the created directory |
| `message` | string | Operation status message |
