curl -X PUT 'https://api.weir.ai/auth/resend/otp/otp_session_123456789' \
-H 'Content-Type: application/json'
{
"data": {
"otpSession": "otp_session_123456789",
"email": "[email protected]",
"expiresIn": 300
},
"message": "OTP resent successfully",
"status": "success"
}
Resend OTP for email verification
curl -X PUT 'https://api.weir.ai/auth/resend/otp/otp_session_123456789' \
-H 'Content-Type: application/json'
{
"data": {
"otpSession": "otp_session_123456789",
"email": "[email protected]",
"expiresIn": 300
},
"message": "OTP resent successfully",
"status": "success"
}
curl -X PUT 'https://api.weir.ai/auth/resend/otp/otp_session_123456789' \
-H 'Content-Type: application/json'
{
"data": {
"otpSession": "otp_session_123456789",
"email": "[email protected]",
"expiresIn": 300
},
"message": "OTP resent successfully",
"status": "success"
}
400 Bad Request
{
"error": {
"code": "INVALID_SESSION",
"message": "Invalid OTP session",
"details": "The provided OTP session is invalid or has been verified"
},
"status": "error"
}
429 Too Many Requests
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many OTP requests",
"details": "Please wait before requesting another OTP"
},
"status": "error"
}
const resendOTP = async (otpSession) => {
try {
const response = await fetch(`https://api.weir.ai/auth/resend/otp/${otpSession}`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' }
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.data;
} catch (error) {
console.error('Resend OTP error:', error);
throw error;
}
};
// Usage
const otpData = await resendOTP('otp_session_123456789');
console.log('OTP resent to:', otpData.email);
Was this page helpful?