SFTP

SFTP (SSH File Transfer Protocol) is a secure file transfer protocol that runs over an SSH connection, letting you move and manage files on a remote server without exposing credentials or data in plaintext. It supports authentication via password or private key, making it a standard choice for secure file exchange with servers, hosting providers, and legacy systems.

With this block, you can:

  • Upload files: Send files or direct text content to a directory on a remote server
  • Download files: Retrieve a file from the remote server as text or base64-encoded content
  • List directory contents: Browse files and folders, optionally with detailed metadata like size and permissions
  • Delete files or directories: Remove remote files, with optional recursive deletion for directories
  • Create directories: Make new directories on the remote server, optionally creating parent directories as needed

In Zoen, the SFTP block allows your agents to upload, download, list, delete, and create files and directories on a remote server, all authenticated with a password or private key. This enables workflows that move generated files to a remote destination, pull files from a server for processing, sync directory contents, or manage remote file structures as part of a larger automation.

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

sftp_upload

Upload files to a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesDestination directory on the remote server
filesfile[]NoFiles to upload
fileContentstringNoDirect file content to upload (for text files)
fileNamestringNoFile name when using direct content
overwritebooleanNoWhether to overwrite existing files (default: true)
permissionsstringNoFile permissions (e.g., 0644)

Output

ParameterTypeDescription
successbooleanWhether the upload was successful
uploadedFilesjsonArray of uploaded file details (name, remotePath, size)
messagestringOperation status message

sftp_download

Download a file from a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesPath to the file on the remote server
encodingstringNoOutput encoding: utf-8 for text, base64 for binary (default: utf-8)

Output

ParameterTypeDescription
successbooleanWhether the download was successful
filefileDownloaded file stored in execution files
fileNamestringName of the downloaded file
contentstringFile content (text or base64 encoded)
sizenumberFile size in bytes
encodingstringContent encoding (utf-8 or base64)
messagestringOperation status message

sftp_list

List files and directories on a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesDirectory path on the remote server
detailedbooleanNoInclude detailed file information (size, permissions, modified date)

Output

ParameterTypeDescription
successbooleanWhether the operation was successful
pathstringDirectory path that was listed
entriesjsonArray of directory entries with name, type, size, permissions, modifiedAt
countnumberNumber of entries in the directory
messagestringOperation status message

sftp_delete

Delete a file or directory on a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesPath to the file or directory to delete
recursivebooleanNoDelete directories recursively

Output

ParameterTypeDescription
successbooleanWhether the deletion was successful
deletedPathstringPath that was deleted
messagestringOperation status message

sftp_mkdir

Create a directory on a remote SFTP server

Input

ParameterTypeRequiredDescription
hoststringYesSFTP server hostname or IP address
portnumberYesSFTP server port (default: 22)
usernamestringYesSFTP username
passwordstringNoPassword for authentication (if not using private key)
privateKeystringNoPrivate key for authentication (OpenSSH format)
passphrasestringNoPassphrase for encrypted private key
remotePathstringYesPath for the new directory
recursivebooleanNoCreate parent directories if they do not exist

Output

ParameterTypeDescription
successbooleanWhether the directory was created successfully
createdPathstringPath of the created directory
messagestringOperation status message

On this page