---
title: "Batch file naming and structure"
url: "https://docs.adyen.com/development-resources/batch-processing/advanced-sftp-batch-files/batch-file-naming-and-structure"
source_url: "https://docs.adyen.com/development-resources/batch-processing/advanced-sftp-batch-files/batch-file-naming-and-structure.md"
canonical: "https://docs.adyen.com/development-resources/batch-processing/advanced-sftp-batch-files/batch-file-naming-and-structure"
last_modified: "2020-04-09T12:29:00+02:00"
language: "en"
---

# Batch file naming and structure

[View source](/development-resources/batch-processing/advanced-sftp-batch-files/batch-file-naming-and-structure.md)

## Naming

### Batch request file

The file name for each batch request file must be unique. To be accepted for further processing, a batch request file name must comply with the following format: 

```text
[Submission Platform]_[File Sequence Number]_[FileType].csv
```

* **Submission Platform** is the unique identifier for the server you use to submit batch files to Adyen.\
  This is especially important if you have multiple servers submitting files, and find it difficult to keep track of the sequence number across the servers.

* **File Sequence Number** is the file submission number. It must always increment by exactly one unit after each successful file submission.\
  File sequence numbers correlate with the submission platform, i.e. the server from where the files originate.\
  The Adyen payments platform rejects batch files when:

  * The batch file submission number, i.e. the file sequence number, has already been used;
  * The system detects a gap in the number sequence because adjacent numbers are not consecutive. For example: 201 followed by 203.

* **FileType** defines the type of transactions/requests that the file contains.\
  Allowed values:

  * [`Authorisation`](/development-resources/batch-processing/advanced-sftp-batch-files/batch-request-file/authorisation-request-file)
  * [`Payout`](/development-resources/batch-processing/advanced-sftp-batch-files/batch-request-file/payout-request-file)
  * [`StoreToken`](/development-resources/batch-processing/advanced-sftp-batch-files/batch-request-file/storetoken-request-file)
  * [`RefundWithData`](/development-resources/batch-processing/advanced-sftp-batch-files/batch-request-file/refundwithdata-request-file)
  * [`Modification`](/development-resources/batch-processing/advanced-sftp-batch-files/batch-request-file/modification-request-file)
  * [`PayoutModification`](/development-resources/batch-processing/advanced-sftp-batch-files/batch-request-file/payoutmodification-request-file)
  * [`AccountUpdater`](/development-resources/batch-processing/advanced-sftp-batch-files/batch-request-file/accountupdater-request-file)

### Batch result file

The file name for each batch result file will be original filename, with `_result` (if the file is not encrypted) or `_result_enc` (if the file is encrypted) appended to the end.

|                                         |                                                                                |
| --------------------------------------- | ------------------------------------------------------------------------------ |
| *Non-encrypted* batch result file       | ```
[Submission Platform]_[File Sequence Number]_[FileType].csv_result
```     |
| *Encrypted&#x20;*&#x62;atch result file | ```
[Submission Platform]_[File Sequence Number]_[FileType].csv_result_enc
``` |

The batch request file undergoes a series of validation checks at line item level, and then the batch result file is posted to the *result* folder on the SFTP.

### Batch acknowledgment file

The file name for each batch acknowledgment file will be original filename, with `_ack` appended to the end.

```text
[Submission Platform]_[File Sequence Number]_[FileType].csv_ack
```

The batch request file undergoes a series of validation checks at line item level. If any error occurs during the process, the batch acknowledgment file is posted to the *ack* folder on the SFTP.

## Structure

The batch file should be delivered in CSV (Comma Separated Values) format, as per [RFC 4180](https://tools.ietf.org/html/rfc4180), with the following exceptions:

* Multi-line fields are not allowed;
* It is allowed to have a variable number of fields per line. 

The file needs to have a file header and a file trailer to allow parsing.\
If either file header or file trailer is missing, it is not possible to top parse the file, and the process returns one or more errors.

The batch file has the following structure:

![](/user/pages/docs/13.development-resources/14.batch-processing/03.advanced-sftp-batch-files/02.batch-file-naming-and-structure/batch-file-structure.png)

The file must conform to the following parameters:

* **File sequence number**: the file header (\[FH]) contains a file sequence number that *must match* the file sequence number in the [file name](/development-resources/batch-processing/advanced-sftp-batch-files/batch-file-naming-and-structure).

* **File types**: the batch file can contain *only one* of the allowed file types identifying the type of transaction that processes.\
  It is not allowed to mix file types/transaction types in the same file. i.e. it is not possible to specify more than one file type/transaction type per batch file.

* **File encoding**: the batch file should be encoded using [UTF-8](https://en.wikipedia.org/wiki/UTF-8).

* **Column counts**: Some lines in the file contain optional fields.\
  While the number of fields per line may vary depending on the specified transaction type, the column count per transaction type is fixed.\
  For example, [File Header field 9](/development-resources/batch-processing/advanced-sftp-batch-files/batch-request-file) is an optional field. However, if you do not use it, you need in any case to insert a delimiter as a placeholder.

* **Character set**: the character set used to represent text data needs to be [Unicode](http://www.unicode.org/).
