> 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/platform/build/core-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 log in 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 17*
* [egov-user](https://docs.digit.org/platform/build/core-services/user.md) service is running
* [egov-localization](https://docs.digit.org/platform/build/core-services/localization-service.md) service is running
* [egov-otp](https://docs.digit.org/platform/deep-dive/api-specifications/otp.md) 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 request, on password change request 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 Details <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 login and password reset for a particular user.

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

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

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

1. To integrate, the host of user-otp module 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>

## Play around with the API's : [DIGIT-Playground](https://digit-api.apidog.io/doc-507201)

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

<table><thead><tr><th width="256">Title</th><th>Link</th></tr></thead><tbody><tr><td>API Postman Collection</td><td><a href="https://www.getpostman.com/collections/5a7475c3ec5ad9b06927">Postman Collection</a></td></tr></tbody></table>

### API Details

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

**Method**

a) `POST /_send`

This method sends the OTP to a user via sms or email based on the below parameters -

<table><thead><tr><th width="172">Input Field</th><th width="184">Description</th><th width="158">Mandatory</th><th width="227">Data Type</th></tr></thead><tbody><tr><td><code>tenantId</code></td><td>Unique id for a tenant.</td><td>Yes</td><td>String</td></tr><tr><td><code>mobileNumber</code></td><td>Mobile number of the user</td><td>Yes</td><td>String</td></tr><tr><td><code>type</code></td><td>OTP type ex: login/register/password reset</td><td>Yes</td><td>String</td></tr><tr><td><code>userType</code></td><td>Type of user ex: Citizen/Employee</td><td>No</td><td>String</td></tr></tbody></table>

#### 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 user mobile number.
  * `org.egov.core.notification.email` :- This topic is used to send OTP to user email id.

\\


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/platform/build/core-services/user-otp-service.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
