One Time Password (OTP)
On this page, we'll explore the powerful OTP (One-Time Password) messaging service that allows you to send secure and convenient authentication codes to users' devices. With our easy-to-use API endpoints, you can seamlessly integrate OTP message sending into your applications, ensuring a smooth and secure user experience.
Generate OTP code
This endpoint generates a one-time password (OTP) code for secure user authentication. This endpoint accepts user parameters and returns a unique OTP code, which can be used for verifying user identity in various applications.
Required attributes
- Name
email
- Type
- string
- Description
The user email address to send the OTP message. (email or phone are requied)
- Name
phone
- Type
- string
- Description
The user phone number to send the OTP message. (email or phone are requied)
Optional attributes
- Name
type
- Type
- string
- Description
The OTP code type will send to the user. must to be numeric, alphanumeric or alphabet. default is numeric
- Name
length
- Type
- number
- Description
The OTP code length will send to the user. must to be 5, 6 or 7. default is 6.
- Name
organization
- Type
- string
- Description
The sendser name of OTP code message will send to the user. default is Hoppah
Request
curl -X POST "https://api.hoppah.io/v1/otp/generate"
-H "x-api-key: {ApiKey}"
-H "Content-Type: application/json" -d '{
"email": "customername@customeremail.com",
"organization": "Your Company Name"
}'
Response
{
"data": {
"transaction_id": "4d71b53e-7b53-42f8-92f9-1bcd4a327dde",
"sent_to": {
"email": "customername@customeremail.com"
}
},
"status": true
}
Validate OTP Code
Thid endpoint verifies the one-time password (OTP) code entered by the user. This endpoint accepts the user's OTP code and a 'transaction_id' parameter, and validates the code for user authentication purposes. It returns a success message if the OTP code is valid, allowing the user to proceed with the requested action.
Request
curl -X POST "https://api.hoppah.io/v1/otp/verify"
-H "x-api-key: {ApiKey}"
-H "Content-Type: application/json" -d '{
"transaction_id": "4d71b53e-7b53-42f8-92f9-1bcd4a327dde",
"otp": "280577",
}'
Response
{
"data": {
"message": "The OTP has been successfully verified.",
"verified": true
},
"status": true
}