Skip to main content
sftp icon

SFTP Connector

Sourcenpm · v0.2.1Connector Changelog

Description​

SFTP (SSH File Transfer Protocol) is a secure file transfer protocol that operates over SSH. The SFTP component allows uploading, downloading, moving, and deleting files on an SFTP server.

A common integration pattern involves listing files in a file store, and performing a series of actions on the array of files that are returned. See our looping over files quickstart for information about how to create a loop over an array of files.

Connections​

Basic Authentication​

key: basic

The Basic Authentication connection is used to connect to SFTP servers that support username / password login.

Prerequisites​

  • An SFTP server with username/password authentication enabled
  • Valid credentials (username and password)

Configure the Connection​

  • Username: Enter the SFTP account username
  • Password: Enter the SFTP account password
  • Host: Enter the SFTP server hostname or IP address
  • Port: Enter the SFTP server port (default: 22)

Advanced Settings (Optional)​

  • Timeout: Connection timeout in milliseconds (default: 3000)
  • Enable Unsecure Server Host Key Algorithms: Enable deprecated host key algorithms for legacy servers
  • Enable Unsecure Ciphers: Enable CBC ciphers for legacy servers
  • Custom Server Host Key Algorithms: Comma-separated list of custom host key algorithms (overrides defaults)
  • Custom Ciphers: Comma-separated list of custom ciphers (overrides defaults)

Consult the SFTP server administrator to determine which login method the server supports.

On-prem enabled: this connection can be configured to connect to an on-prem resource on a private network. Learn more.

InputNotesExample
Custom Ciphers

A comma-separated list of custom ciphers. Overrides the default ciphers. Cipher order matters. Advanced setting.

aes128-ctr, aes192-ctr, aes256-ctr
Custom KEX Algorithms

A comma-separated list of custom key exchange algorithms. Algorithm order matters. Advanced setting.

diffie-hellman-group14-sha1, diffie-hellman-group14-sha256
Custom Server Host Key Algorithms

A comma-separated list of custom server host key algorithms. Overrides the default server host key algorithms. Algorithm order matters. Advanced setting.

ssh-rsa, ssh-dss
Enable Unsecure Ciphers

When true, CBC ciphers will be added to the connection.

false
Enable Unsecure Server Host Key Algorithms

When true, unsecure server host key algorithms will be added to the connection.

false
Host

The address of the SFTP server. This should be either an IP address or hostname.

sftp.example.com
Password

The password for SFTP authentication.

p@s$W0Rd
Port

The port of the SFTP server.

2222
Timeout

How long the client will await a request.

4000
Username

The username for SFTP authentication.

john.doe

Private Key​

key: privateKey

The Private Key connection allows access to an SFTP server via SSH public/private key authentication.

Prerequisites​

  • An SFTP server with public key authentication enabled
  • A generated public/private SSH key pair
  • The public key must be stored on the SFTP server

Setup Steps​

  1. Generate a public/private SSH key pair if not already available
  2. Copy the public key to the SFTP server (usually to ~/.ssh/authorized_keys)
  3. Verify the key is properly configured with the SFTP server administrator

Configure the Connection​

  • Username: Enter the SFTP account username
  • Private Key: Enter the complete private key (including headers and footers)
  • Key Passphrase: Enter the passphrase for the private key (if applicable)
  • Password: Enter the password if the server requires both private key and password authentication (uncommon)
  • Host: Enter the SFTP server hostname or IP address
  • Port: Enter the SFTP server port (default: 22)

Advanced Settings (Optional)​

  • Timeout: Connection timeout in milliseconds (default: 3000)
  • Enable Unsecure Server Host Key Algorithms: Enable deprecated host key algorithms for legacy servers
  • Enable Unsecure Ciphers: Enable CBC ciphers for legacy servers
  • Custom Server Host Key Algorithms: Comma-separated list of custom host key algorithms (overrides defaults)
  • Custom Ciphers: Comma-separated list of custom ciphers (overrides defaults)

Authentication is performed using the username and corresponding private key.

On-prem enabled: this connection can be configured to connect to an on-prem resource on a private network. Learn more.

InputNotesExample
Custom Ciphers

A comma-separated list of custom ciphers. Overrides the default ciphers. Cipher order matters. Advanced setting.

aes128-ctr, aes192-ctr, aes256-ctr
Custom KEX Algorithms

A comma-separated list of custom key exchange algorithms. Algorithm order matters. Advanced setting.

diffie-hellman-group14-sha1, diffie-hellman-group14-sha256
Custom Server Host Key Algorithms

A comma-separated list of custom server host key algorithms. Overrides the default server host key algorithms. Algorithm order matters. Advanced setting.

ssh-rsa, ssh-dss
Enable Unsecure Ciphers

When true, CBC ciphers will be added to the connection.

false
Enable Unsecure Server Host Key Algorithms

When true, unsecure server host key algorithms will be added to the connection.

false
Host

The address of the SFTP server. This should be either an IP address or hostname.

sftp.example.com
Key Passphrase

The passphrase for the private key. Leave blank if none.

p@s$PHr@$3
Password

Though uncommon, some SFTP servers that use private keys may also require a password. Leave blank if none.

p@s$W0Rd
Port

The port of the SFTP server.

2222
Private Key

The SSH private key for authentication.

-----BEGIN OPENSSH PRIVATE KEY----- abc123...
Timeout

How long the client will await a request.

4000
Username

The username for SFTP authentication.

john.doe

Triggers​

New or Modified Files​

Checks for new and modified files in a directory on an SFTP server on a configured schedule. | key: newOrModifiedFiles

InputNotesExample
Connection

The SFTP connection to use.

Include Subdirectories

When true, recursively monitors files in all subdirectories. When false, only monitors files in the specified directory.

false
Path

The path of the directory on the SFTP server to list files from.

/path/to/directory/
Pattern

The glob-style pattern for filtering files (e.g., *.txt).

*.txt

This trigger polls an SFTP server for new and modified files in a specified directory on a configured schedule.

The trigger detects:

  • New files: Files that did not exist during the previous poll
  • Modified files: Files whose size or modification timestamp changed since the previous poll

How It Works​

  1. The trigger runs on the configured schedule (e.g., every 5 minutes)
  2. It connects to the SFTP server and lists all files in the configured directory
  3. Each file's path, size, and modification timestamp are recorded
  4. The current file list is compared against the previous poll's state
  5. Files not present in the previous state are reported as new
  6. Files whose size or modification timestamp differ from the previous state are reported as modified
  7. The trigger updates its state with the current file map for the next poll

If no new or modified files are detected, the trigger reports no changes and the flow does not execute.

Batching

Batching is enabled per flow on this trigger: each changed record is dispatched as its own execution, or grouped by the configured batch size. Batch size and batch concurrency can both be overridden per instance. Raising concurrency increases the request volume sent to the SFTP server.

To turn it on, select the flow's trigger, open the Flow control tab, and switch on Enable Batching. Under Batch Size, keep Trigger default or choose Custom batch size. Batch Concurrency is optional; leave it blank for no batch-level limit.

With batching off, a downstream step reads body.data.newFiles and body.data.modifiedFiles. With batching on, those fields do not exist: each execution receives one { "changeType": ..., "record": ... } item, or an array of them when the batch size is greater than 1. Any step reading the older shape must be updated before batching is enabled. Because batching is enabled per flow, that change is scoped to the flow rather than to the component or to other flows using the same trigger.

Returned Data​

With batching off, the trigger returns an object with two arrays: newFiles for new files and modifiedFiles for modified files.

Example Payload
{
"data": {
"newFiles": [
{
"path": "/uploads/incoming/report-2026-02-11.csv",
"size": 24576,
"modifiedAt": 1739308800000
}
],
"modifiedFiles": [
{
"path": "/uploads/incoming/daily-log.txt",
"size": 102400,
"modifiedAt": 1739312400000
}
]
}
}

Each file entry includes:

  • path: The full path to the file on the SFTP server
  • size: The file size in bytes
  • modifiedAt: The file's last modification timestamp (Unix milliseconds, at whole-second precision)

With batching on, each execution receives one file tagged with how it changed (new or modified), or an array of such items when the batch size is greater than 1. The newFiles and modifiedFiles arrays are not part of this shape.

Batched Item
{
"changeType": "new",
"record": {
"path": "/uploads/incoming/report-2026-02-11.csv",
"size": 24576,
"modifiedAt": 1739308800000
}
}

Notes​

  • The trigger tracks changes using file size and modification timestamp. If a file is replaced with content of the same size and timestamp, the change will not be detected.
  • Enabling Include Subdirectories on directories with many nested files may increase polling time and SFTP server load.
  • The trigger does not detect deleted files. It only reports files that are new or have changed.
  • On the first poll, all files matching the pattern are reported as new since there is no previous state.

Actions​

Append File​

Append data to an existing file on a SFTP server. | key: appendFile

InputNotesExample
Connection

The SFTP connection to use.

Data

The text or data to append to the file.

Path

The path on the SFTP server where data will be appended.

/path/to/remote/file.txt
Example Payload for Append File⤓
Loading…

Create Directory​

Create a new directory. When Include Subfolders is enabled, recursively creates any missing directories in the path. | key: createDirectory

InputNotesExample
Connection

The SFTP connection to use.

Path

The path of the directory on the SFTP server to list files from.

/path/to/directory/
Include Subfolders

When true, recursively creates any missing directories in the path.

true
Example Payload for Create Directory⤓
Loading…

Delete File​

Delete a file from a SFTP server | key: deleteFile

InputNotesExample
Connection

The SFTP connection to use.

Path

Path of file to delete

/path/to/file.txt
Example Payload for Delete File⤓
Loading…

Fast Get​

Read a file from SFTP | key: fastGet

InputNotesExample
Connection

The SFTP connection to use.

Path

Path of file on SFTP server to read data from

/path/to/file.txt
Return Buffer

When true, treats the file as a binary file with content type 'application/octet-stream', even if it is a text file. This is helpful if you are processing non-UTF-8 text files, as the runner assumes text files are UTF-8.

false
Example Payload for Fast Get⤓
Loading…

List Directory​

List files and directories in a directory on an SFTP server. Optionally list files in subdirectories. | key: listDirectory

InputNotesExample
Connection

The SFTP connection to use.

Include Directories

When true, lists directories in addition to files. When false, only lists files.

false
Include Subdirectories

When true, recursively monitors files in all subdirectories. When false, only monitors files in the specified directory.

false
Path

The path of the directory on the SFTP server to list files from.

/path/to/directory/
Pattern

The glob-style pattern for filtering files (e.g., *.txt).

*.txt
Example Payload for List Directory⤓
Loading…

Move File​

Move a file on an SFTP server | key: moveFile

InputNotesExample
Connection

The SFTP connection to use.

Destination Path

Path of file to move

/my/destination/path.txt
Source Path

Path of file to move

/my/starting/path.txt
Example Payload for Move File⤓
Loading…

Read File​

Read a file from SFTP | key: readFile

InputNotesExample
Connection

The SFTP connection to use.

Path

Path of file on SFTP server to read data from

/path/to/file.txt
Return Buffer

When true, treats the file as a binary file with content type 'application/octet-stream', even if it is a text file. This is helpful if you are processing non-UTF-8 text files, as the runner assumes text files are UTF-8.

false
Example Payload for Read File⤓
Loading…

Stat File​

Pull statistics about a file | key: statFile

InputNotesExample
Connection

The SFTP connection to use.

Path

Path of file on SFTP server to read data from

/path/to/file.txt
Example Payload for Stat File⤓
Loading…

Write File​

Write a file to SFTP | key: writeFile

InputNotesExample
Connection

The SFTP connection to use.

Data

The text or data to write into the file.

Path

The path to the file on the SFTP server.

/we/love/commas.csv
Example Payload for Write File⤓
Loading…

Changelog​

2026-11-19​

Updated dependencies and refactored internal code:

  • tsdown 0.23.7

2026-11-17​

Fixed an error where building a code-native integration that imports the npm package failed on a native binary from the cpu-features dependency

2026-11-16​

Fixed an error where importing the npm package in a code-native integration failed with "no published version matching signature"

2026-11-11​

Refactored internal code

2026-11-11​

Refactored internal code

2026-11-10​

Added trigger batching and published the component as an npm package:

  • Added opt-in batching to the New or Modified Files trigger, dispatching each changed file individually or in configured batches; enabling it changes the shape a downstream step receives
  • Published the component as an npm package, so code-native integrations can install it and call its actions, triggers and data sources from code with TypeScript types

2026-07-17​

Added Custom KEX Algorithms connection input to allow specifying custom key exchange algorithms

2026-04-30​

Updated spectral version

2026-02-24​

  • Added New or Modified Files polling trigger that detects new and modified files in a directory on a configured schedule