GenerateOTP

A simple service that allows you to generate and validate OTP code for your applications

This is a simple service that allows you to generate and validate OTP code for your applications. All OTP code generated expire in ten (10) minutes. Once an OTP code has been validated, it can no longer be used.

post
Generate OTP

https://api.generateotp.com/generate
This endpoint allows you to generate the OTP code.
Request
Response
Query Parameters
initiator_id
required
string
An identifier for the user requesting for the OTP code.
200: OK
OTP was generated successfully
{
"status": true,
"initiator_id": "123456",
"code": 117678,
"expires_in": "2019-06-06T19:31:11.000000Z"
}

post
Validate OTP

https://api.generateotp.com/validate/{code}/{initiator}
This is the endpoint used to validate the OTP code that has been generated.
Request
Response
Path Parameters
initiator
required
string
The identifier of the user that initiated the OTP request.
code
required
integer
This is the OTP code that we want to validate
200: OK
OTP has been verified
{
"status": true,
"message": "Otp has been verified"
}

Validated OTP

This is an example of the response received when the OTP code you're trying to validate has already been validated.

{
"status": false,
"message": "Otp has been used already"
}

Invalid OTP

An example of the response received when you try to validate an OTP code that does not exist.

{
"status": false,
"message": "Invalid Otp"
}

Expired OTP

An example of the response received when the OTP code you're trying to validate has already expired.

{
"status": false,
"message": "Otp has expired"
}

Unauthorized Initiator

An example of the response received when the OTP code under validation does not belong to the user that initiated the OTP request.

{
"status": false,
"message": "Not Authorized to use this otp"
}