This API allows you to generate and send one-time passwords (OTP) to a specified phone number using Twilio. The OTP is then returned to be verified in your own way.
- Authentication 🔐
- Endpoint 🌐
- Request 🚀
- Response 📬
- Example 💡
- Contributing 💡
To use this API, you need to have a Twilio account and obtain your Account SID, Auth Token, and a Twilio phone number. Make sure to keep your credentials secure.
-
Endpoint:
/sendOTP
📤 -
Method:
POST
-
Request Body:
{ "phonenumber": "1234567890" }
-
Body should be a JSON object with the following parameter:
phonenumber
: The destination phone number to receive the OTP.
Example:
{ "phonenumber": "1234567890" }
-
The response will be a JSON object containing the OTP in a string format.
Example:
{ "otp": "123456" }
-
The OTP will be a 6-digit string.
-
In case of an error, appropriate error messages will be returned.
curl -X POST -H "Content-Type: application/json" -d '{"phonenumber": "1234567890"}' https://otpapi-uufh.onrender.com/sendOTP
{
"otp": "654321"
}
Feel free to contribute to the development of this API by submitting issues or pull requests.