---
title: "Activate scanning multiple barcodes using Terminal API"
description: "Create a batch scanning session to scan multiple barcodes."
url: "https://docs.adyen.com/point-of-sale/android-terminals/scan-barcode/batch-session"
source_url: "https://docs.adyen.com/point-of-sale/android-terminals/scan-barcode/batch-session.md"
canonical: "https://docs.adyen.com/point-of-sale/android-terminals/scan-barcode/batch-session"
last_modified: "2025-08-19T16:58:00+02:00"
language: "en"
---

# Activate scanning multiple barcodes using Terminal API

Create a batch scanning session to scan multiple barcodes.

[View source](/point-of-sale/android-terminals/scan-barcode/batch-session.md)

##### Single barcode

To scan only one barcode at a time, you can create a [single scanning session](/point-of-sale/android-terminals/scan-barcode/single-session).

On Android payment terminals [S1E Barcode](/point-of-sale/user-manuals/s1e-user-manual), [S1E2L](/point-of-sale/user-manuals/s1e2l-user-manual), [S1F2L](/point-of-sale/user-manuals/s1f2-user-manual), and [S1U2](/point-of-sale/user-manuals/s1u2-user-manual) you can use Terminal API to start a batch barcode scanning session. In the request, you specify how long the barcode scanner stays active. During this time, the scanner scans every barcode that it faces when the terminal operator holds the scan button pressed.

You do not need to [set up the scanning button](/point-of-sale/android-terminals/scan-barcode/button-scan) in the Customer Area to use this method.

## Requirements

Before you begin, take into account the following requirements, limitations, and preparations.

| Requirement          | Description                                                                                                                                                                                                                                                                                     |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Integration type** | A [Terminal API integration](/point-of-sale/design-your-integration/terminal-api/) with payment terminals.                                                                                                                                                                                      |
| **Hardware**         | Android payment terminal models [S1E Barcode](/point-of-sale/user-manuals/s1e-user-manual), [S1E2L](/point-of-sale/user-manuals/s1e2l-user-manual), [S1F2L](/point-of-sale/user-manuals/s1f2-user-manual), or [S1U2](/point-of-sale/user-manuals/s1u2-user-manual) that have a barcode scanner. |
| **Setup steps**      | Before you begin:- You need to implement a way to process the scanned content in your POS app.
- Set up [event notifications](/point-of-sale/design-your-integration/notifications/event-notifications/).                                                                                       |

## How it works

1. You send an Admin request to activate the barcode scanner.

2. The terminal operator presses and holds the barcode scanning button. The scanner scans every barcode that it faces.

3. You receive an event notification for each scanned barcode.

4. With the logic that you have created, you pass the content of the event notification to your POS app.

5. The barcode scanner stops being active:

   * After the specified timeout.
   * When you send an admin request to end the session before the timeout.

## Start a batch barcode scanning session

To start a batch barcode scanning session:

1. Create a JSON object with the following data elements:

   | Parameter   | Required                                                                                    | Description                                                                                                                                                                  |
   | ----------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | `Session`   | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `Id`: your unique reference of the scanning session.
   - `Type`: **Begin** activates the batch barcode scanning session.                                      |
   | `Operation` |                                                                                             | An object with:- `Type`: **ScanBarcode**.
   - `TimeoutMs`: how long the barcode scanner stays on, in milliseconds (from 0 to 300000). If not specified, the default is 300000. |

   **Activate barcode scanner**

   ```json
   {
       "Session": {
           "Id": 12345,
           "Type": "Begin"
       },
       "Operation": [
           {
               "Type": "ScanBarcode",
               "TimeoutMs": 5000
           }
       ]
   }
   ```

2. Encode the JSON object to Base64.

   **Base64 encoded message**

   ```raw
   ewogICAgIlNlc3Npb24iOiB7CiAgICAgICAgIklkIjogMTIzNDUsCiAgICAgICAgIlR5cGUiOiAiQmVnaW4iCiAgICB9LAogICAgIk9wZXJhdGlvbiI6IFsKICAgICAgICB7CiAgICAgICAgICAgICJUeXBlIjogIlNjYW5CYXJjb2RlIiwKICAgICAgICAgICAgIlRpbWVvdXRNcyI6IDUwMDAKICAgICAgICB9CiAgICBdCn0=
   ```

3. Make a [Terminal API](/point-of-sale/design-your-integration/terminal-api) admin request, specifying:

   * The standard [`SaleToPOIRequest.MessageHeader` ](/point-of-sale/design-your-integration/terminal-api#request-message-header)object, with `MessageClass` set to **Service** and `MessageCategory` set to **Admin**.

     | Parameter         | Required                                                                                    | Description                                                                                                                                                 |
     | ----------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
     | `ProtocolVersion` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **3.0**                                                                                                                                                     |
     | `MessageClass`    | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Service**                                                                                                                                                 |
     | `MessageCategory` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Admin**                                                                                                                                                   |
     | `MessageType`     | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Request**                                                                                                                                                 |
     | `ServiceID`       | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (`POIID`) being used. |
     | `SaleID`          | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for the POS system component to send this request from.                                                                                      |
     | `POIID`           | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*.                                                          |

   - The [AdminRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/admin) object, including:
     * `ServiceIdentification`: The Base64-encoded JSON object.

   **Activate barcode scanner request**

   ```json
   {
      "SaleToPOIRequest": {
         "MessageHeader": {
            "ProtocolVersion": "3.0",
            "MessageClass": "Service",
            "MessageCategory": "Admin",
            "MessageType": "Request",
            "ServiceID": "POSSystemID12345",
            "SaleID": "S00101",
            "POIID": "S1EL-324688179"
         },
         "AdminRequest": {
            "ServiceIdentification": "2ICAgIGBgYGpzb24KICAgIHsKICAgICAgICAiU2Vzc2lvbiI6IHsKICAgICAgICAgICAgIklkIjogMTIzNDUsCiAgICAgICAgICAgICJUeXBlIjogIkJlZ2luIgogICAgICAgIH0sCiAgICAgICAgIk9wZXJhdGlvbiI6IFsKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgIlR5cGUiOiAiU2NhbkJhcmNvZGUiLAogICAgICAgICAgICAgICAgIlRpbWVvdXRNcyI6IDUwMDAKICAgICAgICAgICAgfQogICAgICAgIF0KICAgIH0="
          }
      }
   }
   ```

   The terminal operator can now start scanning barcodes.

4. In the [AdminResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/admin#responses-200-Response), note:

   * If successful, the following fields are returned:

     * `Response.Result`: **Success**
     * `AdditionalResponse`: contains `"message": "ScanBarcodeSession request was successfully started"`.

   * If unsuccessful, the following fields are returned:

     * `Response.Result`: **Failure**
     * `AdditionalResponse`: contains the reason for failure, for example `"message": "Admin ScanBarcode request canceled due to Timeout"`.

   The format of the `AdditionalResponse` can be a Base64-encoded or URL-encoded. To always receive the `AdditionalResponse` in one of those formats, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other).

   ### Tab: Response for starting a scanning session

   ```json
   {
       "SaleToPOIResponse": {
           "AdminResponse": {
               "Response": {
                   "Result": "Success",
                    "AdditionalResponse": "ScanBarcodeSession request was successfully started"
               }
           },
           "MessageHeader": {
               "MessageCategory": "Admin",
               "MessageClass": "Service",
               "MessageType": "Response",
               "POIID": "S1EL-324688179",
               "ProtocolVersion": "3.0",
               "SaleID": "POSSystemID12345",
               "ServiceID": "S00101"
           }
       }
   }
   ```

   ### Tab: Response for failed a batch scanning session

   ```json
   {
       "SaleToPOIResponse": {
           "AdminResponse": {
               "Response": {
                   "Result": "Failure",
                   AdditionalResponse": "message=Admin ScanBarcodeSession request was successfully started."
               }
           },
           "MessageHeader": {
               "ProtocolVersion": "3.0",
               "MessageClass": "Service",
               "MessageCategory": "Admin",
               "MessageType": "Request",
               "ServiceID": "POSSystemID12345",
               "SaleID": "S00101",
               "POIID": "S1EL-324688179"
           }
       }
   }
   ```

5. For each scan that you perform during a batch barcode scanning session, you will receive an [event notification](/point-of-sale/design-your-integration/notifications/event-notifications/) that contains the scanned content or a failure message. With the logic that you have created, you pass the content of the event notification of a successful scan to your POS app.

   ### Tab: Event notification of a successful scan

   The body of the event notification for a successful barcode scan contains:

   | Parameter       | Description                                                                                                                                                                                                                                              |
   | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | `EventDetails`  | An object with:- `status`: **Success** indicates a successful scan.
   - `data`: contains the barcode data.
   - `symbology`: the format of the scanned barcode. See [barcode symbologies](/point-of-sale/android-terminals/scan-barcode#barcode-symbologies). |
   | `EventToNotify` | **ScanBarcodeResult**                                                                                                                                                                                                                                    |

   Here is an example event notification for a successful barcode scan:

   **Successful barcode scan event notification**

   ```json
   {
      "SaleToPOIRequest": {
         "EventNotification": {
            "EventToNotify": "ScanBarcodeResult",
            "EventDetails": "status=Success&symbology=PDF417&data=YOUR_BARCODE_DATA",
            "TimeStamp": "2025-03-31T10:28:39.515Z"
         },
         "MessageHeader": {
              "MessageCategory": "Event",
              "MessageClass": "Event",
              "MessageType": "Notification",
              "POIID": "S1EL-324688179",
              "ProtocolVersion": "3.0",
              "SaleID": "POSSystemID12345",
              "DeviceID": "1517998565"
         }
      }
   }
   ```

   ### Tab: Event notification of a failed scan

   The body of the event notification for a failed barcode scan contains:

   | Parameter       | Description                                                                                             |
   | --------------- | ------------------------------------------------------------------------------------------------------- |
   | `EventDetails`  | An object with:- `status`: **Failure** indicates a failed scan.
   - `reason`: contains the error message. |
   | `EventToNotify` | **ScanBarcodeResult**                                                                                   |

   Here is an example event notification for a failed barcode scan:

   **Failed barcode scan event notification**

   ```json
   {
      "SaleToPOIRequest": {
         "EventNotification": {
            "EventToNotify": "ScanBarcodeResult",
            "EventDetails": "status=Failure&reason=Timeout",
            "TimeStamp": "2025-03-31T10:28:39.515Z"
         },
         "MessageHeader": {
              "MessageCategory": "Event",
              "MessageClass": "Event",
              "MessageType": "Notification",
              "POIID": "S1EL-324688179",
              "ProtocolVersion": "3.0",
              "SaleID": "POSSystemID12345",
              "DeviceID": "1517998565"
         }
      }
   }
   ```

6. When the barcode batch scanning session reaches it specified timeout, you receive an event notification with the failure reason `Timeout`.

   **Timeout reached event notification**

   ```json
   {
      "SaleToPOIRequest": {
         "EventNotification": {
            "EventToNotify": "ScanBarcodeResult",
            "EventDetails": "status=Failure&reason=Timeout",
            "TimeStamp": "2025-03-31T10:28:39.515Z"
         },
         "MessageHeader": {
              "MessageCategory": "Event",
              "MessageClass": "Event",
              "MessageType": "Notification",
              "POIID": "S1EL-324688179",
              "ProtocolVersion": "3.0",
              "SaleID": "POSSystemID12345",
              "DeviceID": "1517998565"
         }
      }
   }
   ```

If you want to turn off the barcode scanner before the timeout, you need to send a request to [cancel the scanning session](#cancel-session).

## Cancel a batch barcode scanning session

If you want to cancel the barcode scanning batch session before the specified timeout, you need to send an `AdminRequest` with the `Session.Type` **End**.

1. Create a JSON object with the following data elements:

   | Parameter                       | Required                                                                                    | Description                                                                                                 |
   | ------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
   | `ServiceIdentification.Session` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | An object with:- `Id`: the unique reference of the session.
   - `Type`: **End** cancels the scanning session. |

   **Data elements in JSON format**

   ```json
   	{
   	   "Session": {
   		  "Id": 12345,
   		  "Type": "End"
   	   }
   	}
   ```

2. Encode the JSON object to Base64.

   **Base64 encoded message**

   ```raw
   	ewogICAiU2Vzc2lvbiI6ewogICAgICAiSWQiOjEyMzQ1LAogICAgICAiVHlwZSI6IkVuZCIKICAgfQp9
   ```

3. Make a [Terminal API](/point-of-sale/design-your-integration/terminal-api) admin request, specifying:

   * The standard [`SaleToPOIRequest.MessageHeader` ](/point-of-sale/design-your-integration/terminal-api#request-message-header)object, with `MessageClass` set to **Service** and `MessageCategory` set to **Admin**.

     | Parameter         | Required                                                                                    | Description                                                                                                                                                 |
     | ----------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
     | `ProtocolVersion` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **3.0**                                                                                                                                                     |
     | `MessageClass`    | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Service**                                                                                                                                                 |
     | `MessageCategory` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Admin**                                                                                                                                                   |
     | `MessageType`     | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | **Request**                                                                                                                                                 |
     | `ServiceID`       | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for this request, consisting of 1-10 alphanumeric characters. Must be unique within the last 48 hours for the terminal (`POIID`) being used. |
     | `SaleID`          | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your unique ID for the POS system component to send this request from.                                                                                      |
     | `POIID`           | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*.                                                          |

   - The [AdminRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/admin) object, including:

     * `ServiceIdentification`: The Base64-encoded JSON object.

   **End batch scanning session**

   ```json
   	{
   	   "SaleToPOIRequest":{
   		  "MessageHeader":{
   			 "ProtocolVersion":"3.0",
   			 "MessageClass":"Service",
   			 "MessageCategory":"Admin",
   			 "MessageType":"Request",
   			 "ServiceID":"S00101",
   			 "SaleID":"POSSystemID12345",
   			 "POIID":"S1EL-324688179"
   		  },
   		  "AdminRequest":{
   			 "ServiceIdentification": "ewogICAiU2Vzc2lvbiI6ewogICAgICAiSWQiOjEyMzQ1LAogICAgICAiVHlwZSI6IkVuZCIKICAgfQp9"
   		   }
   	   }
   	}
   ```

4. If the cancel request succeeds, in the [AdminResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/admin#responses-200-Response) note:

   * `Response.Result`: **Success**
   * `AdditionalResponse`: contains the Base64-encoded message. Decoding the string results in a message of the following format: `{ "message": "Admin ScanBarcode request was successfully canceled" }`

   The format of the `AdditionalResponse` can be a Base64-encoded or URL-encoded. To always receive the `AdditionalResponse` in one of those formats, contact our [Support Team](https://ca-test.adyen.com/ca/ca/contactUs/support.shtml?form=other).

   **End scanning session response - success**

   ```json
   {
      "SaleToPOIResponse": {
         "MessageHeader": {
            "ProtocolVersion": "3.0",
            "MessageClass": "Service",
            "MessageCategory": "Admin",
            "MessageType": "Request",
            "ServiceID": "POSSystemID12345",
            "SaleID": "S00101",
            "POIID": "V400m-324688179"
         },
         "AdminResponse": {
            "Response": {
            "Result": "Success",
               "AdditionalResponse": "eyAibWVzc2FnZSI6ICJBZG1pbiBTY2FuQmFyY29kZSByZXF1ZXN0IHdhcyBzdWNjZXNzZnVsbHkgY2FuY2VsZWQiIH0="
            }
         }
      }
   }
   ```

## See also

* [Create a session](/point-of-sale/shopper-engagement/create-session)
* [Use terminal button to scan barcodes](/point-of-sale/android-terminals/scan-barcode/button-scan)
* [Event notifications](/point-of-sale/design-your-integration/notifications/event-notifications)
