When using SMSGatewayCenter’s Integrated OTP SMS service, you have the flexibility to customize the OTP expiry time to suit your needs. The expiry time determines how long the one-time password (OTP) remains valid before it becomes unusable, ensuring both security and user convenience.
In our Generate OTP API, we’ve included an optional parameter called codeExpiry, which allows you to set the OTP expiry time in seconds. Here’s what you need to know:
- Default Expiry Time: If you don’t specify a value, the OTP expires in 300 seconds (5 minutes). This strikes a balance between giving users enough time to enter the code and maintaining security.
- Customizable Range: You can adjust the codeExpiry value based on your requirements. While there’s no strict maximum or minimum enforced by the API, we recommend setting a practical range:
- Minimum: As low as 30 seconds for high-security scenarios (e.g., financial transactions).
- Maximum: Up to 1800 seconds (30 minutes) or more for less time-sensitive use cases (e.g., account recovery).
How to Set OTP Expiry Time: #
Simply include the codeExpiry parameter in your Generate OTP API request and specify the duration in seconds. For example:
- codeExpiry: 120 sets the OTP to expire in 2 minutes.
- codeExpiry: 600 extends it to 10 minutes.
Why It Matters: #
Customizing the OTP expiry time lets you tailor the authentication experience. A shorter expiry enhances security by reducing the window for misuse, while a longer expiry improves usability for users who might need extra time. With SMSGatewayCenter, you’re in control—set it as per your application’s unique needs!
Ready to optimize your OTP flow? Check out our API documentation and start integrating today!