Skip to main content
PUT
https://api-dev.weir.ai/
/
auth
/
resend
/
otp
/
:session
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

Resend OTP code for email verification if the previous code expired or wasn’t received.
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"
}

Authentication

This endpoint does not require authentication.

Path Parameters

session
string
required
OTP session identifier from the registration endpoint.

Response Fields

data
object
required
OTP resend data object.

Error Responses

{
  "error": {
    "code": "INVALID_SESSION",
    "message": "Invalid OTP session",
    "details": "The provided OTP session is invalid or has been verified"
  },
  "status": "error"
}
{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many OTP requests",
    "details": "Please wait before requesting another OTP"
  },
  "status": "error"
}

Usage Examples

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);
Pro Tip: Implement a countdown timer to prevent users from requesting OTP too frequently. Wait at least 60 seconds between requests.