sftp icon


Version: latest

SFTP Folder Structure

The SFTP integration in AS2Gateway relies on a certain folder structure to identify AS2 Stations and Partners when sending files through SFTP and when storing received file to the SFTP folder. In this section we will try to understand what this folder structure is.

Let’s start with the following sample SFTP folder structure.

Example SFTP folder structure

As you can see in the above image, there are two directories in the top level. If you login to the SFTP server, you will see the same structure in the top level.

  • .ssh

  • as2gateway

The .ssh folder includes configuration files related to your SFTP login and users will not need to do any changes on that path. The folder as2gateway on the other hand is the one we should look into.


Inside the as2gateway folder, you will see zero to multiple folders depending on your AS2 Station configuration. If you have AS2 Stations created, you will see a folder for each AS2 station with the AS2 identifier used as the name of the folder. In the example above there are two folders for my two AS2 Stations with AS2 identifiers RJ_ONE and PT.

As another example, if you have stations alice, bob and partners AMZN, WLMRT, you will have the following subpaths inside as2gateway:


Now let’s look into the next level in the folder structure. What you see in this level are folders for each of your AS2 partners (using the partners' AS2 identifiers as the folder names). Under each AS2 Station directory, a folder is there for each of your partners. If you look at the example structure shown above, in this case I have only one AS2 partner with the identifier DemoAS2 and you will notice that there is a folder by the name DemoAS2 under both of my Station folders PT and RJ_ONE.

Moving on to the next level, you will notice that under each AS2 partner folder, there are three folders as follows.

  • failed

  • inbox

  • outbox


Out of these the most important two are the inbox folder and the outbox folder. If you want to send a file to a trading partner from a certain AS2 Station, then you should copy the file you want to sent to that relevant outbox folder. For an instance taking the above folder structure as a sample, say we want to send a file to DemoAS2 trading partner from the RJ_ONE AS2 station, then the path to which we should copy the file would be as2gateway/RJ_ONE/DemoAS2/outbox. So the general path to which you want to copy a file when you want to send a file via AS2 would be as follows.



Now let’s talk about the inbox folder. The outbox folder was all about sending messages out and as the name suggests the inbox folder is all about the incoming AS2 messages. As per the same sample folder structure which we have been looking at before, if we receive a file from DemoAS2 partner to RJ_ONE partner, the path which that file will be stored would be as2gateway/RJ_ONE/DemoAS2/inbox. So if we generalize that path, it would be something as follows.



failed folder will contain attachments that have been picked from outbox, but for some reason could not be enqueued for sending. If you find any files here and do not have a proper explanation regarding why the file failed, contact AS2 Gateway Team and ask for an explanation.

Special Case: Test-type Partners

If your trading partner is of type test (selectable at partner creation), the message folders (inbox etc.) will be nested inside another folder level test.

So if you have a test partner ALIBB, its folders under station alice would be


If you also have defined a production partner with the same ID, ALIBB subfolder will contain the usual inbox etc. (for holding usual production data), in addition to the test subpath:

In this topic
In this topic