Skip to content
Last updated

Lean - sendOtp

Use this method to send an otp.
if otpType = SMS an otp code is sent to phone number of the holder defined in theDisposableContacts object.
if otpType = EMAIL an otp code is sent to email of the holder defined in the DisposableContacts object.
if otpType = WHATSAPP an otp code is sent via WhatsApp to the phone number of the holder defined in the DisposableContacts object.

To use the templateId/language pair it is mandatory to define and config these value in the settings before using them.

For the full technical reference, see the OpenAPI specification.

Endpoint

POST /api/certificate/sendOtp

Headers

NameRequiredDescription
Content-TypeYesMust be application/json.
AuthorizationYesBasic Auth credentials.

Body parameters

ParameterTypeRequiredDescription
certIdOtpintegerYesThe identification of the OTP associated to the disposable.
deviceCodestringYesThe device code of the issued certificate.
smsOptionsobjectDependsRequired if otpType=SMS. Properties: textSMS, templateId (template identifier), language (ISO 639-1 alpha-2). templateId and language are required if textSMS is omitted or empty. Adding $OTP$ in textSMS inserts the OTP at that position; otherwise it is appended at the end.
emailOptionsobjectDependsRequired if otpType=EMAIL. Properties: templateId (required), language (required, ISO 639-1 alpha-2).
whatsappOptionsobjectDependsRequired if otpType=WHATSAPP. Properties: templateId (integer, required), language (ISO 3166-1 alpha-2, required), parameters (array, required — list of template parameters as key-value maps, use $OTP$ as placeholder for the OTP code).

Request example

{
    "certIdOtp": 2587763,
    "deviceCode": "RHIDP2412063503288",
    "smsOptions": {
        "textSMS": "Your OTP code: $OTP$"
    }
}

Response examples

200 — Success

Empty body

Error codes

The main errors that can be found within this function are (all return HTTP 500):

Error codeDescription
2Some required fields are missing
6Generic exception — internal exception
62The certIdOtp is not valid
66The device OTP is not active
71The device OTP is disabled
85The deviceCode is not valid
99OTP was not sent
100The mobile phone number is not valid
101SMS blocked by the watchlist
102The email address is not valid
103The OTP service has exceeded the timeout
138The device OTP is not an SMS OTP device
231OTP is blocked
241LRA not authorized to use this OTP type

For authentication errors, see Authentication.

For details on how to handle errors, see How to handle errors.