# SFTP Component

![](/docs/img/components/icons/60/c2Z0cA==.png)

#### Read, write, move and delete files on an SFTP server

Component key: **sftp**

[Changelog ↓](#changelog)

## Description[​](#description "Direct link to Description")

[SFTP (SSH File Transfer Protocol)](https://www.ssh.com/academy/ssh/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](https://prismatic.io/docs/integrations/common-patterns/loop-over-files.md) quickstart for information about how to create a loop over an array of files.

## Connections[​](#connections "Direct link to Connections")

### Basic Authentication[​](#basic "Direct link to Basic Authentication")

**key: basic**

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

#### Prerequisites[​](#prerequisites "Direct link to Prerequisites")

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

#### Configure the Connection[​](#configure-the-connection "Direct link to 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)[​](#advanced-settings-optional "Direct link to 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](https://prismatic.io/docs/integrations/connections/on-prem-agent.md).

| Input                                      | Notes                                                                                                                                                     | Example                            |
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| 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 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[​](#privatekey "Direct link to Private Key")

**key: privateKey**

The **Private Key** connection allows access to an SFTP server via SSH [public/private key authentication](https://www.ssh.com/academy/ssh/public-key-authentication).

#### Prerequisites[​](#prerequisites-1 "Direct link to 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[​](#setup-steps "Direct link to 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[​](#configure-the-connection-1 "Direct link to 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)[​](#advanced-settings-optional-1 "Direct link to 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](https://prismatic.io/docs/integrations/connections/on-prem-agent.md).

| Input                                      | Notes                                                                                                                                                     | Example                                       |
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| 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 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[​](#triggers "Direct link to Triggers")

### New or Modified Files[​](#newormodifiedfiles "Direct link to New or Modified Files")

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

| Input                  | Notes                                                                                                                    | Example             |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------- |
| 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[​](#how-it-works "Direct link to 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.

#### Configuration[​](#configuration "Direct link to Configuration")

Configure the following inputs:

* **Connection**: The SFTP server connection credentials
* **Path**: The directory path on the SFTP server to monitor (e.g., `/uploads/incoming/`)
* **Pattern**: A glob-style pattern to filter files (e.g., `*.csv`, `*.txt`). Defaults to `*` (all files)
* **Include Subdirectories**: When enabled, the trigger recursively scans subdirectories within the specified path. Defaults to `false`

#### Returned Data[​](#returned-data "Direct link to Returned Data")

Example Payload

```json
{
  "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)

#### Notes[​](#notes "Direct link to 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[​](#actions "Direct link to Actions")

### Append File[​](#appendfile "Direct link to Append File")

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

| Input      | Notes                                                    | Example                  |
| ---------- | -------------------------------------------------------- | ------------------------ |
| 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

```json
{
  "data": "Appended data to /upload/path/to/file.txt"
}

```

***

### Create Directory[​](#createdirectory "Direct link to Create Directory")

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

| Input              | Notes                                                               | Example             |
| ------------------ | ------------------------------------------------------------------- | ------------------- |
| 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

```json
{
  "data": "/path/to/new/directory/"
}

```

***

### Delete File[​](#deletefile "Direct link to Delete File")

Delete a file from a SFTP server | **key: deleteFile**

| Input      | Notes                       | Example           |
| ---------- | --------------------------- | ----------------- |
| Connection | The SFTP connection to use. |                   |
| Path       | Path of file to delete      | /path/to/file.txt |

### Example Payload for <!-- -->Delete File

```json
{
  "data": null
}

```

***

### Fast Get[​](#fastget "Direct link to Fast Get")

Read a file from SFTP | **key: fastGet**

| Input         | Notes                                                                                                                                                                                                                        | Example           |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| 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

```json
{
  "data": {
    "type": "Buffer",
    "data": [
      83,
      97,
      109,
      112,
      108,
      101,
      32,
      102,
      105,
      108,
      101,
      32,
      99,
      111,
      110,
      116,
      101,
      110,
      116,
      115
    ]
  },
  "contentType": "text/plain"
}

```

***

### List Directory[​](#listdirectory "Direct link to List Directory")

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

| Input                  | Notes                                                                                                                    | Example             |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------- |
| 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

```json
{
  "data": [
    "folder1/file.txt",
    "folder1/subfolder/example.txt",
    "root.txt"
  ]
}

```

***

### Move File[​](#movefile "Direct link to Move File")

Move a file on an SFTP server | **key: moveFile**

| Input            | Notes                       | Example                  |
| ---------------- | --------------------------- | ------------------------ |
| 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

```json
{
  "data": null
}

```

***

### Read File[​](#readfile "Direct link to Read File")

Read a file from SFTP | **key: readFile**

| Input         | Notes                                                                                                                                                                                                                        | Example           |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| 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

```json
{
  "data": "Sample file contents",
  "contentType": "text/plain"
}

```

***

### Stat File[​](#statfile "Direct link to Stat File")

Pull statistics about a file | **key: statFile**

| Input      | Notes                                         | Example           |
| ---------- | --------------------------------------------- | ----------------- |
| 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

```json
{
  "data": {
    "mode": 33279,
    "uid": 1000,
    "gid": 985,
    "size": 5,
    "accessTime": 1566868566000,
    "modifyTime": 1566868566000,
    "isDirectory": false,
    "isFile": true,
    "isBlockDevice": false,
    "isCharacterDevice": false,
    "isSymbolicLink": false,
    "isFIFO": false,
    "isSocket": false
  }
}

```

***

### Write File[​](#writefile "Direct link to Write File")

Write a file to SFTP | **key: writeFile**

| Input      | Notes                                    | Example             |
| ---------- | ---------------------------------------- | ------------------- |
| 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

```json
{
  "data": "Uploaded data stream to /upload/path/to/file.txt"
}

```

***

## Changelog[​](#changelog "Direct link to Changelog")

### 2026-02-24[​](#2026-02-24 "Direct link to 2026-02-24")

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