> For the complete documentation index, see [llms.txt](https://docs.signius.eu/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.signius.eu/api/harmony-api-1/login.md).

# Login

## Login

<mark style="color:green;">`POST`</mark> `https://professional.signius.eu:8200/api/auth/login`

This request providers you with the user's token, which is needed to futher requests.

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Content-Type  | String | application/json |
| User-Language | String | Example: en      |

#### Request Body

| Name                                       | Type   | Description   |
| ------------------------------------------ | ------ | ------------- |
| login<mark style="color:red;">\*</mark>    | String | User email    |
| password<mark style="color:red;">\*</mark> | String | User password |

{% tabs %}
{% tab title="400: Bad Request Bad request" %}
{% code title="Example response:" %}

```json
{
    "massage": "<message>"
}
```

{% endcode %}
{% endtab %}

{% tab title="200: OK Login succeded" %}
{% code title="Example response:" %}

```json
{
    "token": "<token>",
    "userId": "<user_id>",
    "identifier": "<email>",
    "status": "ACTIVATED",
    "locale": "pl"
}
```

{% endcode %}
{% endtab %}

{% tab title="200: OK Wrong password" %}
{% code title="Example response:" %}

```json
{
    "exception": "LoginFailedException",
    "code": "400",
    "timestamp": "2023-08-28T06:34:02.569Z",
    "message": "Incorrect login or password"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Session

<mark style="color:blue;">`GET`</mark> `https://professional.signius.eu:8200/api/auth/session`

Checks if user is logged in.

#### Headers

| Name                                           | Type   | Description        |
| ---------------------------------------------- | ------ | ------------------ |
| X-AUTH-TOKEN<mark style="color:red;">\*</mark> | String | User access token. |

{% tabs %}
{% tab title="401: Unauthorized Unauthorized acces" %}
{% code title="Example response:" %}

```json
{
    "exception": "UnauthorizedAccessException",
    "code": 401,
    "message": "error.no.access",
    "timestamp": "2023-08-28T08:38:20.622Z",
    "status": "UNAUTHORIZED",
    "details": {
        "objectName": "authorization",
        "error": {
            "objectName": "authorization",
            "codes": [
                "error.no.access"
            ],
            "arguments": null,
            "defaultMessage": "error.no.access",
            "code": "error.no.access"
        }
    }
}
```

{% endcode %}
{% endtab %}

{% tab title="200: OK Operation succeded" %}
{% code title="Example response:" %}

```json
{
    "connected": true,
    "api": "signius",
    "locale": "en"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
