# Authorization

## Initialize authorization

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

Starts authorization of user. Sends SMS token to the phone number binded to the user profile.

#### Headers

| Name                                           | Type   | Description                     |
| ---------------------------------------------- | ------ | ------------------------------- |
| X-AUTH-TOKEN<mark style="color:red;">\*</mark> | String | User auth token                 |
| Content-Type                                   | String | application/json; charset=utf-8 |
| User-Language                                  | String | Example: en                     |

{% tabs %}
{% tab title="200: OK Authorization started." %}
{% code title="Example response:" %}

```json
{
    "challengeId": "<id>"
}
```

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

## Authorization

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

Validates the SMS token (OTP).

#### Headers

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

#### Request Body

| Name                                              | Type   | Description                        |
| ------------------------------------------------- | ------ | ---------------------------------- |
| challengeId<mark style="color:red;">\*</mark>     | String | challengeId from initAuthorization |
| challengeResult<mark style="color:red;">\*</mark> | String | SMS token                          |

{% tabs %}
{% tab title="200: OK User authorized" %}
{% code title="Example response:" %}

```json
{
    "validated": <true_or_false>
}
```

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