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

# OTP

**One Time Password** (**OTP )** is a special type of Transactional SMS (Text Message). OTP's are used to send one time codes intended for Login or Two-Factor Authentication (2FA) or other high value transactions.&#x20;

OTP SMS has a template that allows you to customise fields like App Name, OTP Size, and OTP Expiry Time.

{% embed url="<https://iframe.mediadelivery.net/play/274833/6a4a9939-06b9-420c-a245-5c0493642680>" %}

The OTP SMS has two parts, ***Send API*** and ***Verify API***.

{% tabs %}
{% tab title="Send API" %}
Send API is used to trigger the SMS containing one time code to the end user.

```
URL: https://api.sendune.com/send-otp
```

**Request:**

{% code lineNumbers="true" %}

```
{
      "method": "POST",
      "url": "https://api.sendune.com/send-otp",
      "headers": {"template-key": "****************************elA2"},
      "body": {
          "sender_id": "ABCDEF"
          "origination_number": "+449876543212"
          "mobile": "+449876543210",
       }
}
```

{% endcode %}

**Success Response:**

```
{
      "success": true,
      "message": "OTP Sent"
}
```

**Failed Response:**

{% code lineNumbers="true" %}

```
{
      "success": false,
      "message": "message details",
      "error": "error details"
}
```

{% endcode %}

**IMPORTANT:**

* All API calls MUST include the **Template Key**. Template Key is unique to OTP SMS.
* 'Origination Number' is required only when sending to USA mobile numbers.&#x20;
* All mobile numbers MUST STRICTLY be in E.164 format.
  {% endtab %}

{% tab title="Verify API" %}
Verify API is used to match the one time code received from end user with the code generated during the Send API call.&#x20;

```
URL: https://api.sendune.com/verify-otp
```

**Request:**

{% code lineNumbers="true" %}

```
{
      "method": "POST",
      "url": "https://api.sendune.com/verify-otp",
      "headers": {"template-key": "***********************elA2"},
      "body": {
          "mobile": "+449876543210"
          "otp": "123456",
       }
}
```

{% endcode %}

**Success Response:**

{% code lineNumbers="true" %}

```
{
      "success": true,
      "message": "OTP Verified"
}
```

{% endcode %}

**Failed Response:**

{% code lineNumbers="true" %}

```
{
      "success": false,
      "message": "message details",
      "error": "error details"
}
```

{% endcode %}

**IMPORTANT:**

* All API calls MUST include the **Template Key**. Template Key is unique to OTP SMS.
* 'Origination Number' is required only when sending to USA mobile numbers.&#x20;
* All mobile numbers MUST STRICTLY be in E.164 format.
  {% endtab %}
  {% endtabs %}
