> ## Documentation Index
> Fetch the complete documentation index at: https://adyen-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Log in and Log Out

> Log in your terminal and begin processing payments. Log out of your terminal when changing operator, or at the end of a shift.

If you want to use Terminal API requests to retrieve transaction totals of a terminal or reconcile balance mismatches, you must first make a Terminal API request to log in to the terminal.

This login request can additionally mark events like a change of operator or the start of a new shift, so that you can get the totals by operator or shift.

The login request does not authenticate the operator.

## Requirements

Before you begin, take into account the following requirements.

| Requirement | Description |
| - | - |
| **Integration type** | A [Terminal API](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/terminal-api) integration with payment terminals. |

## Log in to the terminal

1. Make a [Terminal API](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/terminal-api) login request, specifying:

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

     | Parameter | Required | Description |
     | - | - | - |
     | `ProtocolVersion` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **3.0** |
     | `MessageClass` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Service** |
     | `MessageCategory` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Login** |
     | `MessageType` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Request** |
     | `ServiceID` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | 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-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | Your unique ID for the POS system component to send this request from. |
     | `POIID` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*. The [LoginRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/login) object, with: |

     | Parameter | Required | Description |
     | - | - | - |
     | `DateTime` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The date and time in UTC format. |
     | `SaleSoftware` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | An object with the manufacturer, application name, software version, and certification code of the sale system. |
     | `OperatorLanguage` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The language of the operator in two-character [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes) format. For example, **en** for English. |
     | `OperatorID` | | Your identification of the operator. |
     | `SaleTerminalData.TotalsGroupID` | | Your identification of a group of transactions, for reconciliation purposes. |
     | `ShiftNumber` | | Your identification of the shift. |

   #### JSON

   ```json theme={null}
   {  
      "SaleToPOIRequest":{  
         "MessageHeader":{  
            "ProtocolVersion":"3.0",
            "MessageClass":"Service",
            "MessageCategory":"Login",
            "MessageType":"Request",
            "ServiceID":"0403105031",
            "SaleID":"POSSystemID12345",
            "POIID":"P400Plus-275008565"
         },
         "LoginRequest":{  
            "DateTime":"2018-04-03T08:50:31+00:00",
            "SaleSoftware":{  
               "ManufacturerID":"Adyen",
               "ApplicationName":"TestScripts",
               "SoftwareVersion":"1.0",
               "CertificationCode":""
            },
            "SaleTerminalData":{  
               "TotalsGroupID":"GroupA"
            },
            "OperatorLanguage":"en",
            "OperatorID":"John"
         }
      }
   }
   ```

   #### Java

   ```java theme={null}
   String serviceID = "YOUR_UNIQUE_ATTEMPT_ID";
   String saleID = "YOUR_CASH_REGISTER_ID";
   String POIID = "YOUR_TERMINAL_ID";

   SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();
   MessageHeader messageHeader = new MessageHeader();
   messageHeader.setProtocolVersion("3.0");
   messageHeader.setMessageClass( MessageClassType.SERVICE );
   messageHeader.setMessageCategory( MessageCategoryType.LOGIN );
   messageHeader.setMessageType( MessageType.REQUEST );
   messageHeader.setServiceID(serviceID);
   messageHeader.setSaleID(saleID);
   messageHeader.setPOIID(POIID);
   saleToPOIRequest.setMessageHeader(messageHeader);

   LoginRequest loginRequest = new LoginRequest();
   loginRequest.setDateTime("2018-04-03T08:50:31+00:00");
   SaleSoftware saleSoftware = new SaleSoftware();
   saleSoftware.setManufacturerID("Adyen");
   saleSoftware.setApplicationName("TestScripts");
   saleSoftware.setSoftwareVersion("1.0");
   saleSoftware.setCertificationCode("");
   loginRequest.setSaleSoftware(saleSoftware);

   SaleTerminalData saleTerminalData = new SaleTerminalData();
   saleTerminalData.setTotalsGroupID("GroupA");
   loginRequest.setSaleTerminalData(saleTerminalData);
   loginRequest.setOperatorLanguage("en");
   loginRequest.setOperatorID("John");
   saleToPOIRequest.setLoginRequest(loginRequest);
   terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);
   ```

2. In the [LoginResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/login#responses-200-Response), check the following:

   * `Response.Result`: **Success** indicates that you logged in to the terminal.
   * `POIStatus`: Indicates if the terminal is ready for use.

   ```json theme={null}
   {
     "SaleToPOIResponse":{
        "LoginResponse":{
           "POISystemData":{
              "POISoftware":{
                 "CertificationCode":"",
                 "SoftwareVersion":"adyen_423314",
                 "ManufacturerID":"Adyen",
                 "ApplicationName":"Nexo"
              },
              "DateTime":"2018-04-03T08:50:23.000Z",
              "POIStatus":{
                 "CommunicationOKFlag":true,
                 "GlobalStatus":"OK"
              }
           },
           "Response":{
              "Result":"Success"
           }
        },
        "MessageHeader":{
           "ProtocolVersion":"3.0",
           "SaleID":"POSSystemID12345",
           "MessageClass":"Service",
           "MessageCategory":"Login",
           "ServiceID":"0403105031",
           "POIID":"P400Plus-275008565",
           "MessageType":"Response"
        }
     }
   }
   ```

After logging in, the terminal saves the provided values. The values remain in effect until a new login request is processed for the same terminal, or until you log out from this terminal.

## Log out from the terminal

1. Make a [Terminal API](https://adyen-preview.mintlify.site/point-of-sale/design-your-integration/terminal-api) logout request, specifying:

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

     | Parameter | Required | Description |
     | - | - | - |
     | `ProtocolVersion` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **3.0** |
     | `MessageClass` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Service** |
     | `MessageCategory` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Logout** |
     | `MessageType` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | **Request** |
     | `ServiceID` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | 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-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | Your unique ID for the POS system component to send this request from. |
     | `POIID` | ![-white\_check\_mark-](https://docs.adyen.com/user/data/smileys/emoji/white_check_mark.png) | The unique ID of the terminal to send this request to. Format: *\[device model]-\[serial number]*. An empty [LogoutRequest](https://docs.adyen.com/api-explorer/terminal-api/latest/post/logout) object. |

   #### JSON

   ```json theme={null}
   {
      "SaleToPOIRequest":{
         "MessageHeader":{
            "ProtocolVersion":"3.0",
            "MessageClass":"Service",
            "MessageCategory":"Logout",
            "MessageType":"Request",
            "ServiceID":"0403105613",
            "SaleID":"POSSystemID12345",
            "POIID":"P400Plus-275008565"
         },
         "LogoutRequest":{

         }
      }
   }
   ```

   #### Java

   ```java theme={null}
   String serviceID = "YOUR_UNIQUE_ATTEMPT_ID";
   String saleID = "YOUR_CASH_REGISTER_ID";
   String POIID = "YOUR_TERMINAL_ID";

   SaleToPOIRequest saleToPOIRequest = new SaleToPOIRequest();
   MessageHeader messageHeader = new MessageHeader();
   messageHeader.setProtocolVersion("3.0");
   messageHeader.setMessageClass( MessageClassType.SERVICE );
   messageHeader.setMessageCategory( MessageCategoryType.LOGOUT );
   messageHeader.setMessageType( MessageType.REQUEST );
   messageHeader.setServiceID(serviceID);
   messageHeader.setSaleID(saleID);
   messageHeader.setPOIID(POIID);
   saleToPOIRequest.setMessageHeader(messageHeader);

   LogoutRequest logoutRequest = new LogoutRequest();
   saleToPOIRequest.setLogoutRequest(logoutRequest);
   terminalAPIRequest.setSaleToPOIRequest(saleToPOIRequest);
   ```

2. In the [LogoutResponse](https://docs.adyen.com/api-explorer/terminal-api/latest/post/logout#responses-200-Response), check the following:

   * `Response.Result`: **Success** indicates that you logged out from the terminal.

   ```json theme={null}
   {
     "SaleToPOIResponse":{
        "LogoutResponse":{
           "Response":{
              "Result":"Success"
           }
        },
        "MessageHeader":{
           "ProtocolVersion":"3.0",
           "SaleID":"POSSystemID12345",
           "MessageClass":"Service",
           "MessageCategory":"Logout",
           "ServiceID":"0403105613",
           "POIID":"P400Plus-275008565",
           "MessageType":"Response"
        }
     }
   }
   ```

## See also

* [Retrieve totals from a terminal](https://adyen-preview.mintlify.site/point-of-sale/reconciling-totals/retrieve-totals-from-the-terminal.md)
* [Reconcile a balance mismatch](https://adyen-preview.mintlify.site/point-of-sale/reconciling-totals/reconcile-a-balance-mismatch.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.