v1

latestOpenAPI 3.0.02026-07-26592893.0 KB

Send OTP

Send an OTP to a mobile number using a predefined OTP template. You can customize the OTP length, expiry, and provide values for variables in your DLT template.

post/dev/otp/send

Headers

Authorizationstring required

Provide "YOUR_API_KEY".

Request body

mobilestring required

10-digit Indian mobile number.

otp_idstring required

Your unique OTP Template ID.

otp_expiryinteger

OTP expiry time in minutes (Min: 1, Max: 10080, Default: 15).

otp_lengthinteger

OTP length (Min: 4, Max: 10, Default: 6).

otpstring

Optional: Pass your own OTP value if you don't want Fast2SMS to generate otp. (max 10)

variables_valuesstring

Values of {#var#} variables used in the DLT template (if any), separated by pipe (|).

udf1string

User Defined Field 1 – Optional custom value passed via API and returned in the webhook for your internal reference or tracking.

udf2string

User Defined Field 2 – Optional custom value passed via API and returned in the webhook for your internal reference or tracking.

udf3string

User Defined Field 3 – Optional custom value passed via API and returned in the webhook for your internal reference or tracking.

Example request

{
  "mobile": "9999999999",
  "otp_id": "your_otp_id_here",
  "otp": "123456",
  "variables_values": "value1|value2"
}

Response

OTP sent successfully

returnboolean
status_codeinteger
request_idstring
messagestring

Example response

{
  "return": true,
  "status_code": 200,
  "request_id": "lwdtp7cjyqxvfe9",
  "message": "OTP sent successfully"
}