Generate OTP

This page provides you with information on Generate OTP API.

Issues OTP to the customer’s mobile number/email ID using the sessionId generated through the token/generate API.

There is a limit to the number of OTPs a customer can generate in a day. Contact the Sustenance team to increase or decrease the limit.

Resource Information

URI for Mobile App/auth/v1/otp/generate
URI for Web App/auth/v1/web/otp/generate
Rate LimitedYes
AuthenticationNo
HTTP MethodPOST
Batch SupportYes

Request URL

For mobile application:

http://{ae-host}/auth/v1/otp/generate

For web application:

http://{ae-host}/auth/v1/web/otp/generate

Request Body Parameters

{
    "identifierType":"MOBILE",
    "identifierValue":"9940000000",
    "deviceId": "32rtsdered",
    "brand": "STANDARDAPP",
    "sessionId": "D-502259d3-d4d6-4458-bc5f-b89d3d8e4c7b"
}
ParameterDatatypeDescription
identifierType*enumIdentifier used for authentication. Values: MOBILE, EMAIL, USERNAME.
identifierValue*stringValue of the specified identifierType. For example, if identifierType is MOBILE, the identifierValue is mobile number. If you want to send the OTP to WhatsApp or Zalo, you need to raise a JIRA ticket to the sustenance team to define the related configurations.
deviceId**stringUnique ID of the device from which the customer has generated the token. Required for mobile app.
brand*stringName of the brand or org for which authentication needs to be verified.
sessionId*stringSession ID generated through the v1/token/generate API.
hashstringHash value generated by the mobile application to encrypt the payload. The server-side validation is performed by matching this hash value. For information, refer to Encrypting API payload.
Note: This parameter is mandatory if the API payload encryption configurations are enabled and is not applicable if the API payload encryption is not enabled.

Parameters marked with * are mandatory, and the parameter with ** is required for the mobile app.

Encrypting the API payload

To avoid unauthorised usage of this API, it is suggested to enable the below configuration to encrypt the payload.

Configurations

🚧

Note

There is no UI to enable these configurations. To enable these configurations, create a ticket to the sustenance team.

ConfigurationDescription
CONF_ENABLE_ENCRYPTIONTo enable the encryption. By default, this value is set as false.
CONF_ENCRYPTION_ENDPOINTSTo define the API endpoints for which the payload needs to be encrypted. You can encrypt the payload of the APIs otp/generate(OTP) and mfa/otp/generate(MFA_OTP) API
CONF_ENCRYPTION_PUBLIC_KEY & CONF_ENCRYPTION_PRIVATE_KEYTo store the org's public and private key. The keys are encoded in Base64 format and are constant and do not change.
CONF_ENCRYPTION_VALID_IN_SECONDSTo define the time window during which it considers requests as valid. By default, the time is set as 120 seconds.

Error

ErrorSolution
5004 - Response tamperedPayload encryption is enabled. and the defined time for the hash value is expired.
Language
Authorization
Basic
base64
:
URL
Click Try It! to start a request and see the response here!