# Session Management

The Session Endpoint handles all Operations, needed to initiate, maintain, modify and finish a Session.

## Session Lifecycle

## /init

<mark style="color:green;">`POST`</mark> `https://api.nexx.cloud/v3.1/session/init`

This Call does not need a Session Authorization Object.

#### Query Parameters

| Name             | Type    | Description                                |
| ---------------- | ------- | ------------------------------------------ |
| addDomainData    | boolean | include Domain Public Details              |
| addAdModel       | boolean | include Ad Configuration                   |
| addPriceModel    | boolean | include Pay / Price Configuration          |
| addTextTemplates | boolean | include nexxPLAY Text Templates            |
| addChannels      | boolean | include publically visible Channel Details |
| addFormats       | boolean | include publically visible Format Details  |
| addCampaigns     | boolean | include all active Domain Campaigns        |

#### Request Body

| Name                   | Type    | Description                                                                       |
| ---------------------- | ------- | --------------------------------------------------------------------------------- |
| explicitLanguage       | string  | the 2-Letter Code of the Session Language                                         |
| gateway                | string  | a 3Q nexx defined Code for the Gateway/Platform for this Session                  |
| nxp\_devh              | string  | a consistent Device ID                                                            |
| nxp\_userh             | string  | a valid User Hash, if User Login is active                                        |
| currentSession         | number  | a previously used Session ID (for Re-use if still valid)                          |
| deliveryPartner        | integer | the ID of a Domain Delivery Partner                                               |
| nxp\_afpc              | string  | a valid Code of an exisiting Affiliate Partner                                    |
| deviceName             | string  | the Device Name, if known (for statistical Purposes)                              |
| adGateway              | string  | a 3Q nexx defined Call for the Ad Capabilities Platform for this Session          |
| portal                 | string  | a 3Q nexx defined Call for a Sub Gateway (for Example a specific App Store)       |
| linkOrigin             | string  | the Origin for this Session (not Referrer)                                        |
| forcePersistantSession | boolean | only needed, if a nexxPLAY only Domain needs a persistent Session for some Reason |
| externalUserReference  | string  | an externally managed User Reference                                              |
| lat                    | float   | if available, the current Device Geo Latitude                                     |
| lng                    | flat    | if available, the current Device Geo Longitude                                    |
| affiliatePartner       | integer | the ID of a Domain Affiliate Partner                                              |
| campaign               | integer | the ID of a Domain Campaign                                                       |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## /generateentraidloginurl

<mark style="color:green;">`POST`</mark> `https://api.nexx.cloud/v3.1/session/generateentraidloginurl`

#### Query Parameters

| Name | Type   | Description                                                           |
| ---- | ------ | --------------------------------------------------------------------- |
| host | String | if sent, the given Hostname will be used as Callback URL for Entra ID |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## /login

<mark style="color:green;">`POST`</mark> `https://api.nexx.cloud/v3.1/session/login`

#### Request Body

| Name        | Type   | Description                                                                                                                  |
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| provider    | string | One of the following Ways to handle a Login: \[facebook, twitter, google, aad, apple, hash, broadcast, secondscreen, manual] |
| token       | string | the Identification Token, given by the Provider, if not used manual Login                                                    |
| username    | string | if manual Login is used, the given Username                                                                                  |
| password    | string | if manual Login is used, the given Password                                                                                  |
| vouchercode | string | a valid Voucher Code, the User used during Login                                                                             |
| host        | string | necessary, if the Domain is using a 2-Factor Login via U2F, optional in all other Cases                                      |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## /keepalive

<mark style="color:green;">`POST`</mark> `https://api.nexx.cloud/v3.1/session/keepalive`

should be called every 10-15 Minutes in order to keep the Session alive and protect it from being invalidated.

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## /logout

<mark style="color:green;">`POST`</mark> `https://api.nexx.cloud/v3.1/session/logout`

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## Session Helpers

## /staticdetails

<mark style="color:blue;">`GET`</mark> `https://api.nexx.cloud/v3.1/session/staticdetails`

in Case of a static Session (by nexxPLAY only), some Aspects for statistical Purposes must still be computed by the Session API, even if not inited.

#### Query Parameters

| Name             | Type   | Description                                                                  |
| ---------------- | ------ | ---------------------------------------------------------------------------- |
| gateway          | string | the Platform/Gateway, as computed by the Frontend Controller                 |
| nxp\_devh        | string | the Device ID, computed by the Frontend Controller                           |
| deliveryPartner  | number | the ID of a valid Delivery Partner, the Frontend Controller was inited with  |
| lng              | float  | if available, the current Device Geo Longitude                               |
| lat              | float  | if available, the current Device Geo Latitude                                |
| affiliatePartner | number | the ID of a valid Affiliate Partner, the Frontend Controller was inited with |
| nxp\_afpc        | String | a valid Code of an exisiting Affiliate Partner                               |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## /reporttoken

<mark style="color:blue;">`GET`</mark> `https://api.nexx.cloud/v3.1/session/reporttoken`

returns the current Reporting Authorization Token (for **Samaritan** Reporting)

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}

## /currentweather

<mark style="color:blue;">`GET`</mark> `https://api.nexx.cloud/v3.1/session/currentweather`

#### Query Parameters

| Name | Type   | Description                                                                   |
| ---- | ------ | ----------------------------------------------------------------------------- |
| lat  | number | the Latitude of a Geo Position (the Session Value will be used, if omitted)   |
| lng  | number | the Longitude of a Geo Position (the Sesson Value wilkll be used, if omitted) |

{% tabs %}
{% tab title="200 " %}

```
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.docs.nexx.cloud/frontend-api/endpoints/session-endpoint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
