Skip to main content
POST
https://api-dev.weir.ai/
/
auth
/
validate
/
registration
curl -X POST 'https://api.weir.ai/auth/validate/registration' \
  -H 'Content-Type: application/json' \
  -d '{
    "otpSession": "otp_session_123456789",
    "otp": "123456"
  }'
{
  "data": {
    "userId": "user_123456789",
    "email": "[email protected]",
    "verified": true
  },
  "message": "Email verified successfully. You can now login.",
  "status": "success"
}

Validate Registration

Verify user’s email address using OTP to activate the account after registration.
curl -X POST 'https://api.weir.ai/auth/validate/registration' \
  -H 'Content-Type: application/json' \
  -d '{
    "otpSession": "otp_session_123456789",
    "otp": "123456"
  }'
{
  "data": {
    "userId": "user_123456789",
    "email": "[email protected]",
    "verified": true
  },
  "message": "Email verified successfully. You can now login.",
  "status": "success"
}

Authentication

This endpoint does not require authentication.

Request Body

otpSession
string
required
OTP session identifier received from registration endpoint.
otp
string
required
6-digit OTP code received via email.

Response Fields

data
object
required
Verification data object.

Error Responses

{
  "error": {
    "code": "INVALID_OTP",
    "message": "Invalid OTP code",
    "details": "The provided OTP is incorrect"
  },
  "status": "error"
}
{
  "error": {
    "code": "OTP_EXPIRED",
    "message": "OTP has expired",
    "details": "Please request a new OTP"
  },
  "status": "error"
}

Usage Examples

const validateRegistration = async (otpSession, otp) => {
  try {
    const response = await fetch('https://api.weir.ai/auth/validate/registration', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ otpSession, otp })
    });
    
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    
    const data = await response.json();
    return data.data;
  } catch (error) {
    console.error('Validation error:', error);
    throw error;
  }
};

// Usage
const verificationData = await validateRegistration('otp_session_123456789', '123456');
console.log('User verified:', verificationData.userId);

Verification Flow

Registration

User registers and receives OTP session ID.

Email Check

User checks email for 6-digit OTP code.

OTP Submission

User enters OTP code with session ID.

Account Activated

Account is activated and user can now login.
Pro Tip: The OTP is valid for 5 minutes. If it expires, use the resend OTP endpoint to get a new code.