> For the complete documentation index, see [llms.txt](https://docs.kavoon.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kavoon.io/onboarding/phone-number-verification.md).

# Phone Number Verification

The goal of this process is to verify User’s mobile number. If successful, Client acquires a first authentication factor allowing him to access onboarding APIs (including Get User State).&#x20;

{% hint style="info" %}
**Note:** User must have the UK number
{% endhint %}

The verification shall start before onboarding and consists of two stages:

**1. Request sending a one time password (OTP) via SMS to User's phone**

The request must include the full phone number and `channel: sms`

## Request OTP

<mark style="color:green;">`POST`</mark> `https://api.kavoon.io/otp`

#### Request Body

| Name                                      | Type   | Description                             |
| ----------------------------------------- | ------ | --------------------------------------- |
| phone<mark style="color:red;">\*</mark>   |        | Full mobile number e.g.  "447401101801" |
| channel<mark style="color:red;">\*</mark> | String | Sending channel. Use "sms"              |

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

```xquery
{ }
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
  "errCode": "GENERAL_ERROR",
  "errText": "invalid Device-Id"
}
```

{% endtab %}
{% endtabs %}

**2. Verify OTP and receive authentication token**

## Verify OTP

<mark style="color:green;">`POST`</mark> `https://api.kavoon.io/auth/token`

In case of successful verification, Client gets an `access_token`

#### Request Body

| Name                                          | Type   | Description                            |
| --------------------------------------------- | ------ | -------------------------------------- |
| grant\_type<mark style="color:red;">\*</mark> | String | Request type. Pass "password"          |
| username<mark style="color:red;">\*</mark>    | String | Full mobile number e.g. "447401101801" |
| password<mark style="color:red;">\*</mark>    | String | Received OTP e.g. "5757"               |
| channel<mark style="color:red;">\*</mark>     | String | Sending channel. Use "sms"             |

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

```javascript
{
  "access_token": "f7bf9bcb493d45cb99164ba7653b2e0a",
  "token_type": "Bearer",
  "expires_in": 300,
  "refresh_token": "7b7b75b866814bd3bf14409b796894f0",
  "new_client": true
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
{
  "errCode": "BAD_REQUEST",
  "errText":"Check OTP exception"
}
```

{% endtab %}
{% endtabs %}

If success, Client will retrieve the first authentication factor and will be able to call the User State to start onboarding to find out what is the first step. If the password does not match, Client will receive the respective error.
