> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/local-governance/v2.7/platform/configure-digit/configuring-digit-services/user-otp-service.md).

# User OTP Service

## Overview <a href="#overview" id="overview"></a>

User-OTP service handles the OTP for user registration, user login and password reset for a particular user.

## Pre-requisites <a href="#pre-requisites" id="pre-requisites"></a>

Before you proceed with the documentation, make sure the following pre-requisites are met -

* *Java 8*
* egov-user service is running
* egov-localization service is running
* egov-otp service is running

## Key Functionalities <a href="#key-functionalities" id="key-functionalities"></a>

The user-otp service sends the OTP to the user on login requests, on password change requests and during new user registration.

## Deployment Details <a href="#deployment-details" id="deployment-details"></a>

1. Deploy the latest version of user-otp.
2. Make sure egov-otp is running.
3. Add Role-Action mapping for APIs.

## Integration <a href="#integration" id="integration"></a>

### Integration Scope <a href="#integration-scope" id="integration-scope"></a>

User-OTP service handles the OTP for user registration, user log in and password reset for a particular user.

### Integration Benefits <a href="#integration-benefits" id="integration-benefits"></a>

* Can perform user registration, login, password reset.
* In the future, if we want to expose the application to citizens then it can be done easily.

### Steps to Integration <a href="#steps-to-integration" id="steps-to-integration"></a>

1. To integrate, a host of user-otp modules should be overwritten in the helm chart.
2. `/user-otp/v1/_send` should be added as the endpoint for sending OTP to the user via sms or email

## Reference Docs <a href="#reference-docs" id="reference-docs"></a>

### Doc Links <a href="#doc-links" id="doc-links"></a>

| **Title**              | **Link**                                                                          |
| ---------------------- | --------------------------------------------------------------------------------- |
| API Postman Collection | [Postman Collection](https://www.getpostman.com/collections/5a7475c3ec5ad9b06927) |

### API Details <a href="#api-details" id="api-details"></a>

`BasePath` /user-otp/v1/\[API endpoint]

#### **Method**

a) `POST /_send`

This method sends the OTP to the user via SMS or email based on the below parameters:

| Input Field | Description | Mandatory | Data Type |
| ----------- | ----------- | --------- | --------- |

| Input Field    | Description                                | Mandatory | Data Type |
| -------------- | ------------------------------------------ | --------- | --------- |
| `tenantId`     | Unique id for a tenant.                    | Yes       | String    |
| `mobileNumber` | Mobile number of the user                  | Yes       | String    |
| `type`         | OTP type ex: login/register/password reset | Yes       | String    |
| `userType`     | Type of user ex: Citizen/Employee          | No        | String    |

#### Producers <a href="#producers" id="producers"></a>

* Following are the Producer topic.

  * `egov.core.notification.sms.otp` :- This topic is used to send OTP to the user mobile number.
  * `org.egov.core.notification.email` :- This topic is used to send OTP to the user email id.

> [![Creative Commons License](https://i.creativecommons.org/l/by/4.0/80x15.png)*​*](http://creativecommons.org/licenses/by/4.0/)*All content on this page by* [*eGov Foundation*](https://egov.org.in/) *is licensed under a* [*Creative Commons Attribution 4.0 International License*](http://creativecommons.org/licenses/by/4.0/)*.*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.digit.org/local-governance/v2.7/platform/configure-digit/configuring-digit-services/user-otp-service.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
