# API Login

Specification

* URL: \<API\_GATEWAY>/api/partner/login
* Method: POST
* Description: Initialize a new session for the user.
* Security Requirements: [Encrypt data and include a digital signature.](https://developer.gotadi.com/english/b2b2c-partner/webview-method/security-requirements)

#### Request <a href="#request" id="request"></a>

<details>

<summary>Model</summary>

* key (string, required),

  Key giải mã dữ liệu (đã được mã hóa). Cách thành lập tham khảo mục: [Mã hóa dữ liệu truyền và xác thực chữ ký điện tử](https://developer.gotadi.com/dev-guide/b2b2c-partner-webview/api-security/#ma-hoa-du-lieu-truyen-va-xac-thuc-chu-ky-ien-tu)
* data (string, required),

  Dữ liệu kèm theo chữ ký điện tử (đã được mã hóa). Cách giải mã tham khảo mục: [Mã hóa dữ liệu truyền và xác thực chữ ký điện tử](https://developer.gotadi.com/dev-guide/b2b2c-partner-webview/api-security/#ma-hoa-du-lieu-truyen-va-xac-thuc-chu-ky-ien-tu)

  *Signature data schema:*

  ```
  <access_code>|<user_id>|<layout>|<product>
  ```

  *Original data schema:*

  ```
  <access_code>|<user_id>|<layout>|<product>|<signature>
  ```

  * access\_code (String, required)

    Access code do Gotadi cung cấp cho Đối tác.
  * user\_id (String, required)

    Mã định danh người dùng trên hệ thống của Đối tác.
  * layout (String, optional)

    Có giá trị là `dual` hoặc `single` tương ứng với 2 loại layout Gotadi cung cấp cho đối tác.
  * product (String, required)

    Có giá trị là `flight` hoặc `hotel`. Tương ứng với 2 sản phẩm Gotadi cung cấp cho đối tác.

    Khi layout là `single`: Dùng để chọn dịch vụ hiển thị trên webview.

    Khi layout là `dual`: Dùng để focus dịch vụ hiển thị trên webview.

</details>

#### Example

{% code fullWidth="false" %}

```json
{
    "data": "...",
    "key": "..."
}
```

{% endcode %}

#### Response <a href="#response" id="response"></a>

<details>

<summary>Model</summary>

* **key (String, required)**

  Key giải mã dữ liệu (đã được mã hóa). Cách giải mã tham khảo mục: [Mã hóa dữ liệu truyền và xác thực chữ ký điện tử](https://developer.gotadi.com/dev-guide/b2b2c-partner-webview/api-security/#ma-hoa-du-lieu-truyen-va-xac-thuc-chu-ky-ien-tu)
* **data (String, required)**

  Dữ liệu kèm theo chữ ký điện tử (đã được mã hóa). Cách giải mã tham khảo mục: [Mã hóa dữ liệu truyền và xác thực chữ ký điện tử](https://developer.gotadi.com/dev-guide/b2b2c-partner-webview/api-security/#ma-hoa-du-lieu-truyen-va-xac-thuc-chu-ky-ien-tu)

  *Signature data schema:*

  ```
  <access_code>|<error_code>|<redirect_url>
  ```

  *Original data schema:*

  ```
  <access_code>|<error_code>|<redirect_url>|<signature>
  ```

  * access\_code (String, required)

    Access code do Gotadi cung cấp cho Đối tác.
  * error\_code (String, required) [Mã lỗi](https://gotadi.gitbook.io/technical-documentation/~/changes/hxSZJK0E5x4hAwJJ8axI/vietnamese/tich-hop-doi-tac-b2b2c/phuong-thuc-webview#ma-loi)
  * redirect\_url (String, optional)

    Đường dẫn tới Webview Gotadi có kèm theo jwtToken.

    ```
    https://<gotadi_webview_url>?access_token=<jwtToken>
    ```

</details>

#### Example

```json
{
    "data": "...",
    "key": "..."
}
```
