curl -X POST 'https://api.weir.ai/auth/m/register' \
-H 'Content-Type: application/json' \
-d '{
"fullname": "Jane Smith",
"email": "jane.smith@example.com",
"password": "SecurePassword123!"
}'
{
"data": {
"otpSession": "otp_session_987654321",
"email": "jane.smith@example.com",
"expiresIn": 300
},
"message": "Registration successful. Please verify your email with the OTP sent.",
"status": "success"
}
Simplified registration endpoint for mobile applications
curl -X POST 'https://api.weir.ai/auth/m/register' \
-H 'Content-Type: application/json' \
-d '{
"fullname": "Jane Smith",
"email": "jane.smith@example.com",
"password": "SecurePassword123!"
}'
{
"data": {
"otpSession": "otp_session_987654321",
"email": "jane.smith@example.com",
"expiresIn": 300
},
"message": "Registration successful. Please verify your email with the OTP sent.",
"status": "success"
}
curl -X POST 'https://api.weir.ai/auth/m/register' \
-H 'Content-Type: application/json' \
-d '{
"fullname": "Jane Smith",
"email": "jane.smith@example.com",
"password": "SecurePassword123!"
}'
{
"data": {
"otpSession": "otp_session_987654321",
"email": "jane.smith@example.com",
"expiresIn": 300
},
"message": "Registration successful. Please verify your email with the OTP sent.",
"status": "success"
}
400 Bad Request
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request parameters",
"details": {
"email": "Invalid email format",
"password": "Password must be at least 8 characters"
}
},
"status": "error"
}
409 Conflict
{
"error": {
"code": "EMAIL_EXISTS",
"message": "Email already registered",
"details": "An account with this email already exists"
},
"status": "error"
}
const mobileRegister = async (fullname, email, password) => {
try {
const response = await fetch('https://api.weir.ai/auth/m/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ fullname, email, password })
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.data;
} catch (error) {
console.error('Mobile registration error:', error);
throw error;
}
};
// Usage
const registrationData = await mobileRegister(
'Jane Smith',
'jane.smith@example.com',
'SecurePassword123!'
);
console.log('OTP Session:', registrationData.otpSession);
No Organization Creation
Simplified Flow
Same Verification
Input Validation
Error Handling
Security
User Experience
Was this page helpful?