# Tutorial: Receive invoices in a SFTP directory

Hooks with the SFTP action are used to connect the PSB and a SFTP server. There are two main flows: the 'from SFTP' flow, which pulls documents from a SFTP server, and the 'to SFTP' flow, which uploads documents to a SFTP server. A tutorial on how to use the 'from flow' can be found here.


The 'to SFTP' flow uploads documents from the PSB to a SFTP server. It can be used with any *Received topic, like InvoiceReceived. When the InvoiceReceived hook is triggered, the document linked to the hook will be upload to your SFTP server. This flow requires one directory.

Directory Function
Inbox directory The directory where the PSB will upload documents to.

# Configuration

SFTP hooks are registered via the subscribe endpoint on the Hook controller, using the sftp:// action.

The SFTP action consists of three mandatory parts. The first part is the connection info. Here you specify your username and password, as well as the host address and the port of your server. The second part are the directories you use, and the third part is your server's md5 fingerprint. The 'to flow' also supports an optional fourth part, the target documentTypeId. If you only want to receive a specific type of document, you can add this after the Inbox directory. Make sure to escape special characters in the documentTypeId: sftp://username:password@host:port?inboxDirectory=directory1&targetDocumentTypeId=documentTypeId#fingerprint.

To flow example:

  "id": "2",
  "name": "sftp upload",
  "action": "sftp://tester:password@",
  "topics": [
  "isActive": true,
  "createdOn": "2020-11-25T14:42:50.9437103+01:00",
  "changedOn": "2020-11-27T16:05:33.9173033+01:00"
© 2022 eConnect International B.V.