Welcome to the MyOTPApp API! This API allows you to generate and verify One-Time Passwords (OTPs) for user authentication. This page will guide you through the two main endpoints of our API: generate_otp and verify_otp.
API Key
To use the MyOTPApp API, you’ll need an API key. This key should be included in the header of each request as X-API-Key.
Endpoints
1. Generate OTP (POST /generate_otp)
This endpoint generates an OTP and sends it to a specified phone number.
Features:
Generate OTPs of a specified length (between 3 and 8 digits).
Set the validity period for the OTP (between 30 and 1800 seconds).
Use a specific message template (ID) for the OTP. This is optional.
Limitations:
The phone number must be between 7 and 15 digits long and cannot start with a 0.
The user must have sufficient balance to cover the cost of sending the OTP.
2. Verify OTP (POST /verify_otp)
This endpoint verifies an OTP.
Features:
Verify OTPs using either the phone number or the message ID.
Receive detailed status messages indicating whether the OTP verification was successful, whether the OTP does not match, or whether the OTP has expired.
Limitations:
The OTP must be between 3 and 8 digits long.
Either the phone number or the message ID must be provided.
Error Codes
Our API uses standard HTTP status codes to indicate the success or failure of a request. Here are some of the most common codes you might encounter:
200: Success. The request was successful.
400: Bad request. The request could not be understood or was missing required parameters.
401: Unauthorized. Authentication failed or user does not have permissions for the requested operation.
402: Payment Required. User balance is insufficient.
500: Internal Server Error. An error occurred on the server.
Support
If you have any questions or run into any issues, please contact our support team at support@myotp.app.