Exchange documents via SFTP: From SFTP (pull), To SFTP (push), directory structure and configuration.
Not every integration runs through a direct API connection. For systems that work with file exchange, the PSB offers SFTP integration. The PSB periodically retrieves files from your SFTP server (From SFTP) or places received documents on your SFTP server (To SFTP). Both flows are configured via SFTP hooks.
You can create an SFTP connection in the platform under Connections > New General connection > SFTP Connector. The connection keys you generate here are needed later for the hook configuration.
With From SFTP the PSB periodically retrieves files from your SFTP server and processes them as documents. This is useful when your source system exports files to a directory on an SFTP server, for example invoices in UBL or XML format.
From SFTP works with five directories on your SFTP server:
By default the PSB checks every 15 minutes for new files in the readDirectory. This interval is configurable.
A From SFTP hook has the following action:
sftp://gebruiker:wachtwoord@host:poort?readDirectory=/upload&pendingDirectory=/pending&duplicateDirectory=/duplicate&successDirectory=/success&errorDirectory=/error#md5-fingerprint
The hook must also contain a publishTopic indicating how the retrieved files should be processed, for example SendInvoice for sending invoices.
{
"action": "sftp://user:[email protected]:22?readDirectory=/out&pendingDirectory=/out/pending&duplicateDirectory=/out/duplicate&successDirectory=/out/success&errorDirectory=/out/error#aa:bb:cc:dd:ee:ff",
"topics": [],
"publishTopics": ["SendInvoice"]
}
With each poll the PSB checks the readDirectory, moves files to pending, processes them and then places them in success or error. Files that have already been processed are moved to the duplicateDirectory.
With To SFTP the PSB automatically places received documents on your SFTP server. This is ideal when your system processes files from a directory rather than via an API webhook.
For To SFTP you only need an inboxDirectory:
{
"action": "sftp://user:[email protected]:22?dirs=/inbox#aa:bb:cc:dd:ee:ff",
"topics": ["InvoiceReceived"]
}
Each received document is placed as a file in the inboxDirectory. You can optionally specify a targetDocumentTypeId to have documents automatically transformed to a specific format before they are placed on the SFTP server.
Both SFTP flows use an MD5 fingerprint for server verification. The fingerprint follows the # sign in the hook action and ensures the PSB only connects to the correct SFTP server. This prevents man-in-the-middle attacks.
You can find the MD5 fingerprint of your SFTP server in the server configuration or by connecting via an SFTP client. The format is a series of hexadecimal pairs separated by colons, for example aa:bb:cc:dd:ee:ff:00:11:22:33:44:55:66:77:88:99.
An organisation that sends invoices from their ERP system and wants to import received invoices:
/sftp/outbox. The PSB picks them up every 15 minutes and sends them via Peppol./sftp/inbox. The ERP system reads the directory periodically and imports the documents.Both flows run independently of each other and can be configured separately.
SFTP integration is widely used in practice for connections with Unit4 ERP CR and ERP7, where file exchange via an SFTP directory is the standard method for exchanging invoice documents.
Make sure the SFTP user has write permissions on all configured directories. The PSB needs to be able to move files between directories. Also check that your SFTP server's firewall allows incoming connections from the eConnect IP addresses.
The 15-minute pull interval is the default. If you need a shorter or longer interval, contact TechSupport.
The fingerprint belongs to your SFTP server host and ensures the PSB only connects to the intended server. This limits the risk of man-in-the-middle attacks. The format is hexadecimal pairs separated by colons, as described in the documentation.
With From SFTP the PSB periodically retrieves files from your directories and processes them as documents (for example exporting invoices to readDirectory). With To SFTP the PSB places received documents in your inboxDirectory so your system can read them from a folder instead of via a webhook.
The user must be able to write to all configured directories and move files, because the PSB moves files between read, pending, success and error among others. Also check that your firewall allows incoming connections from the eConnect IP addresses.
Want to learn more about document exchange via the PSB? See the overview of multi-channel delivery or read how to configure webhooks for real-time notifications.
View the API documentation