# Log in by SMS

## Log in by SMS API Endpoint

1. `{{baseurl}}/api/v1/login-sms`

<figure><img src="https://3686328336-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fd1Iq7THDAagTQzeC9rTN%2Fuploads%2FcCwao4802n2ub1QHQLfc%2Fimage.png?alt=media&#x26;token=4a9c13be-e0b3-42c4-a018-e9dc7838ec9e" alt=""><figcaption></figcaption></figure>

### Description

This API endpoint is used to send an SMS with a verification code (OTP) to the user's phone number for authentication.

### Request Method

`POST`

### Request Body

| Parameter     | Type   | Description                                              |
| ------------- | ------ | -------------------------------------------------------- |
| phone\_number | string | The user's phone number for authentication.              |
| country\_id   | string | The country code where the user is located (e.g., "US"). |
| lang\_id      | string | The preferred language of the user (e.g., "en").         |

### **Example Request Body:**

```json
{
  "phone_number": "+1234567890",
  "country_id": "US",
  "lang_id": "en"
}
```

### Response

**Success (200)**

```json
{
  "message": "OTP Sent Successfully"
}
```

### SMS verify API Endpoint

2. `{{baseurl1}}/api/v1/login-sms-verify`

### Description

This API endpoint is used to verify the OTP sent via SMS to the user's phone number for authentication.

### Request Method

`POST`

### Request Body

| Parameter     | Type   | Description                                              |
| ------------- | ------ | -------------------------------------------------------- |
| OTP\_value    | string | The OTP (One-Time Password) sent to the user's phone.    |
| phone\_number | string | The user's phone number used for authentication.         |
| country\_id   | string | The country code where the user is located (e.g., "US"). |

### **Example Request Body:**

```json
jsonCopy code{
  "OTP_value": "540822",
  "phone_number": "+96878013526",
  "country_id": "2"
}
```

### Response

**Success (200)**

```json
jsonCopy code{
  "status": true,
  "message": "User details",
  "data": {
    "user": {
      "id": 648,
      "name": "nabeel",
      "phone": "+96878013526",
      "email": null,
      "avatar": null,
      "is_guest": null,
      "status": 1,
      "firebase_id": null,
      "default_shipping_address": null,
      "default_billing_address": null,
      "country_id": 2,
      "lang_id": 1,
      "remember_token": null,
      "created_at": "2024-05-05T06:22:27.000000Z",
      "updated_at": "2024-06-15T15:00:04.000000Z",
      "deleted_at": null,
      "email_verified": 0,
      "email_token": 832727,
      "email_token_expire_at": "2024-05-05 20:03:31",
      "email_verified_at": null,
      "sms_otp": 540822,
      "bearer_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIzIiwianRpIjoiM2Y4NDNkNDA4MzFhOGJmZWFlZGNmMjJhYzcxNmFjOTk3MmJiMTFkZThkYmE0NTBhOGZjZjIyNmM4YzIwYmJlODNhOWU5ZjExYmNkYjdkMWYiLCJpYXQiOjE3MTg0NjM4MDEuNzE2Njc1LCJuYmYiOjE3MTg0NjM4MDEuNzE2Njc4LCJleHAiOjE3NDk5OTk4MDEuNzEwODIsInN1YiI6IjY0OCIsInNjb3BlcyI6W119.f_C4x4K53g9rkaa1keYQjbTMOwe--a1Jonq_UUBG5-DqqcnuUpBXpiAK-2-s6wV_XoZVkoeXRgiudSDbXtpejHb1lpxt6Sz1Jl33d-RzUbOXqyHEwoAwb-FXf3CzVhe_2BZx9leBfA5LR5BnfldttCAfsMhMpZjfxIJq1PbR0309LZAV2yg-V1pR4D3a-KHxgT43R2GFn4xPEhzOm7Gcp-yLdUCfXFD-RU_913ZCMVfnunjqh3wpi_4rNndIRwWFMz6XtNt19Oas-s-mchX9RAyHcCKgZIw3HjWbaJMtr-UJTAMdDNy26qYn0Rdba31VVI0Y6pTUPjhtvzWhBxAlAs5F3jwm-F-nLy0AmZCXOQdeG7xCfhjxY9qposJ0ovEZi8a6ONTcqukcWoQvuucgSjhbfhXnToSL6F3Hfha3e1pY_Dcn5R9DeBzRbg9lOYbrun-8Dvtv6kjZD7_DDFzsGGKTjKBGpIU6Ywq1B2VXiHIg14ji8ufC9hjyTBgo0SndGX8fmj-JePLc9-CcJQNrbs2joLVFTfYvuP1PP8UevhQtfCOdFxce27LTtfV3h7St66qrhZLKgXg_jsa4439EW4lXTJLoiayKxrjh2r4HVCouW2D-f3J3Kar2ExMfP8maZ8MvO-uQqpXTlt073ZgLvc7wLURUteS2RGKg6QQeMUs"
        }
    }
}
```
