> For the complete documentation index, see [llms.txt](https://bitel.gitbook.io/bitel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bitel.gitbook.io/bitel/master/sms/otp-sms.md).

# OTP SMS

The message that is sent to user has the following format:

```
به {appName} خوش آمدید
 کد یکبار مصرف  شما: {code}
```

The appName and the code is required and must be provided when calling the api.&#x20;

## Send OTP

<mark style="color:green;">`POST`</mark> `https://api.bitel.rest/api/v1/sms/otp`

#### Request Body

| Name        | Type   | Description                                                |
| ----------- | ------ | ---------------------------------------------------------- |
| PhoneNumber | string | The target phone number                                    |
| AppName     | string | The name of application, example: Bitel                    |
| Code        | string | The code that is displayed in the message, example: 1234Ma |

{% tabs %}
{% tab title="200 Result contain the request id" %}

```
{
    "result": "963551a72f794190ad4fc42fed01aabc",
    "error": null
}
```

{% endtab %}
{% endtabs %}

#### Sample Request

```javascript
{
	"code": "1234",
	"phoneNumber": "0912*******",
	"appName": "bitel"
}
```

#### Error Codes

| Code           | Description                                             |
| -------------- | ------------------------------------------------------- |
| InvalidRequest | Submitted data is invalid, most likely the phone number |

{% hint style="info" %}

## Getting SMS Detail

In order to get the detail of a request, including the delivery status, balance subtracted, delivery time and more please refer to [**SMS Detail**](/bitel/master/sms/sms-detail.md) API.
{% endhint %}
