# 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bitel.gitbook.io/bitel/master/sms/otp-sms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
