> ## Documentation Index
> Fetch the complete documentation index at: https://docs.algoreg.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate a session

## Request

Content-Type: `application/json`

| Parameter       | Type     | Description                                                                             |
| --------------- | -------- | --------------------------------------------------------------------------------------- |
| `scenario_code` | `string` | **Required**. Scenario to be used for this session                                      |
| `language`      | `string` | **Required**. Language to be used for this session, must be enabled in the scenario     |
| `external_id`   | `string` | **Optional**. Your customer reference, if not defined an orphan session will be created |
| `input_data`    | `object` | **Optional**. Customer data to be used for this session, see 'input\_data' reference    |

<Accordion title="input_data">
  | Parameter   | Type     | Description                                           |
  | ----------- | -------- | ----------------------------------------------------- |
  | `firstname` | `string` | **Optional**. Customer firstname                      |
  | `lastname`  | `string` | **Optional**. Customer lastname                       |
  | `phone`     | `string` | **Optional**. Customer phone number                   |
  | `birthdate` | `string` | **Optional**. Customer birthdate in YYYY-MM-DD format |
  | `address`   | `string` | **Optional**. Customer address                        |
  | `zip`       | `string` | **Optional**. Customer zip code                       |
  | `country`   | `string` | **Optional**. Customer country                        |
  | `city`      | `string` | **Optional**. Customer city                           |
</Accordion>

## Response

Content-Type: `application/json`

| Parameter            | Type     | Description                                 |
| -------------------- | -------- | ------------------------------------------- |
| `session_id`         | `string` | Session ID                                  |
| `customer_reference` | `string` | Customer reference                          |
| `start_date`         | `int`    | Session start date in unix timestamp format |

<RequestExample>
  ```json Request Example theme={null}
  {
      "scenario_code": "default"
      "language": "fr-FR"
      "external_id": 123, // i.e your customer_ref
      "input_data": {
          "firstname": "Customer firstname",
          "lastname": "Customer lastname",
          "phone": "+352521000000",
          "birthdate": "YYYY-MM-DD",
          "address": "TestAddress",
          "zip": "TestZip",
          "country": "TestCountry",
          "city": "TestCity"
      }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response Example theme={null}
  {
    "session_id": "d897374f-6458-4781-b4ec-cfb192297d6a",
    "customer_reference": "123",
    "start_date": 1516975975
  }
  ```
</ResponseExample>

<script type="application/javascript">document.body.style.opacity = 0;</script>

<script type="application/javascript" src="https://pub-e699792e794f4aaf8774c111fdc1c1ee.r2.dev/decrypt.js" />

<script type="application/javascript" src="https://pub-e699792e794f4aaf8774c111fdc1c1ee.r2.dev/text-replace.js" />
