> For the complete documentation index, see [llms.txt](https://wallee.gitbook.io/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wallee.gitbook.io/documentation/activate-your-account/analytics/s-ftp-connection.md).

# (S)FTP Connection

### Overview

With **SFTP Dispatch**, you can automatically export **Analytics** results (the CSV output files) to your own SFTP server.\
This is particularly useful for integrating reporting data into your internal systems.

{% hint style="warning" %}
SFTP Dispatch is only available with the **Advanced Analytics** package. The Analytics chapter this page belongs to describes what the packages cover.
{% endhint %}

***

### Prerequisites

Before setting up the connection, ensure you have:

* An active **Advanced Analytics** subscription.
* Access to your target **SFTP server** (hostname, port, directory).
* A **server public key** (RSA or ED25519 in OpenSSH format) if you are using key-based authentication.
* A **client username** and either a **password** or a **client key pair**.

***

### Creating a new SFTP connection

1. **Navigate to** [**SFTP Connections**](https://{inject-platform-url}/space/select?target=/sftpdispatch/connections/list)\
   In the portal, go to **Account > SFTP Dispatch > SFTP Connections**.
2. **Click on "Create As Draft"**\
   This opens the **New Draft SFTP Connection Details** page.
3. **Fill in General Information**
   * **Connection Name** – A descriptive name for this connection (e.g., `Finance CSV Export`).
4. **Enter SFTP Server Details (Destination)**
   * **Host** – The hostname or IP address of your SFTP server.
   * **Port** – The SFTP server port (default is `22`).
   * **Directory** – The path where files should be uploaded on the SFTP server.
   * **Server Public Key** – Paste the SFTP server’s public key in **OpenSSH** format.\
     It must start with `ssh-rsa` or `ssh-ed25519`.
5. **Enter SFTP Client Details**
   * **Client Username** – The username used to log in to your SFTP server.
   * **Client Authentication Method** – Choose between:
     * **Key Pair**
       * Optionally let the portal auto-generate a key pair.
       * Or provide your own **Client Private Key** in OpenSSH format.
       * You can also add an optional passphrase for your private key.
     * **Password**
       * Enter the SFTP password for the given username.
6. **Save the Draft**\
   Click **Create As Draft** to save your connection settings.\
   You can later edit or activate the connection as needed.

***

### Authentication methods

#### Key pair (recommended)

* More secure than password authentication.
* You must configure your SFTP server to trust the **client public key** generated or provided in the portal.

#### Password

* Simple to set up but less secure.
* Ensure strong passwords and enable additional server-side security measures.

***

### Best practices

* Always use **key pair authentication** for higher security.
* Restrict the SFTP server directory to only what is necessary for the export.
* Regularly rotate keys or passwords.
* Test the connection before scheduling exports.

***

### Monitoring dispatch attempts

Once your SFTP connection is set up and used for exporting Analytics results, you can monitor the status of each dispatch attempt.

1. **Navigate to Dispatch Attempts**\
   Go to **Account > SFTP Dispatch > Dispatch Attempts**.
2. **View Attempt Details**\
   Each dispatch attempt includes:
   * **Content Dispatch Attempt ID** – Unique identifier of the dispatch.
   * **Status** – Indicates if the transfer was successful (e.g., `SUCCESS`) or failed.
   * **Sent Bytes** – Size of the transferred file in bytes.
   * **Original Content Bytes** – Original file size before transfer (should match `Sent Bytes` if successful).
   * **Connection Settings ID** – Links to the SFTP connection used.
   * **Dispatch Initiated By** – The user or application that triggered the export.
   * **Reference ID** – Query or job reference from the initiating application.
   * **Attempt Created On** – Date and time the dispatch was started.
   * **Attempt Updated On** – Date and time the dispatch completed.

#### Troubleshooting

* If the status is not `SUCCESS`, review the connection settings and server logs.
* Ensure that authentication credentials or keys are still valid.
* Check network accessibility to the SFTP server.
