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


---

# 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://docs.sendune.com/otp.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.
