> 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/egov-otp-service.md).

# eGov OTP Service

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

OTP Service is a core service that is available on the DIGIT platform. The service is used to authenticate the users on the platform. The functionality is exposed via REST API.

## 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*

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

egov-otp is called internally by the user-otp service which fetches the mobileNumber and feeds it to egov-otp to generate 'n' digit OTP.

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

1. Deploy the latest version of egov-otp service.
2. Add Role-Action mapping for APIs.

## Configuration Details <a href="#configuration" id="configuration"></a>

Below properties define the OTP configurations

a) `egov.otp.length` : Number of digits in the OTP

b) `egov.otp.ttl` : Controls the validity time frame of the OTP. The default value is 900 seconds. Another OTP generated within this time frame is also allowed.

c) `egov.otp.encrypt` : Controls if the OTP is encrypted and stored in the table.

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

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

The egov-otp service is used to authenticate the user in the platform.

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

* Can perform user authentication without impacting the other module.
* In the future, this application can be used in a standalone manner in any other platform that requires a user authentication system.

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

1. To integrate, a host of egov-otp modules should be overwritten in the helm chart.
2. `/otp/v1/_create` should be added as the create endpoint. Create OTP Configuration this API is an internal call from v1/\_send endpoint. This endpoint is present in the user-otp service and hence explicit calls are not needed.
3. `/otp/v1/_validate` should be added as the validate endpoint. OTP Configuration this endpoint validates the OTP with respect to the mobile number.
4. `/otp/v1/_search` should be added as the search endpoint. This API searches the mobile number and OTP using the uuid. The uuid nothing but the OTP reference number.

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

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

| **Title**                 | **Link**                                                                                                                                                              |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| API Swagger Documentation | [Swagger Documentation](https://editor.swagger.io/?url=https://raw.githubusercontent.com/egovernments/DIGIT-OSS/doc-patch/core-services/docs/egov-otp-contract.yml#!) |

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

`BasePath` /egov-otp/v1

Egov-otp service APIs - contains create, validate and search endpoint

a) `POST /otp/v1/_create` - create OTP Configuration this API is an internal call from v1/\_send endpoint. This endpoint is present in the user-otp service and hence there is no need for any explicit calls.

b) `POST /otp/v1/_validate` - validate OTP Configuration this endpoint is to validate the OTP with respect to the mobile number.

c) `POST /otp/v1/_search` - search the mobile number and OTP using uuid. The uuid is the OTP reference number.

> [![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/egov-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.
