Endpoint
Authentication
No authentication required. This is a public endpoint.
Request Body
User’s email address. Must be a valid email format and unique in the system.
User’s password. Must be at least 6 characters long.
User role in the church. Must be either “pastor” or “member”.
Email address of the user who invited this new user. Must be a valid email format.
Example Request
curl -X POST https://api.yourchurch.com/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"password": "securePassword123",
"role": "member",
"invitedBy": "[email protected]"
}'
Response
Indicates whether the registration was successful.
Human-readable message describing the result.
Additional information about the registration process.
Success Response (201 Created)
{
"success": true,
"message": "Registeration Successful",
"data": "A verification link has been sent to you. Kindly verify your email address"
}
Error Responses
400 Bad Request - Password Too Short
Returned when the password is less than 6 characters.
{
"success": false,
"message": "Password must be at least 6 characters"
}
409 Conflict - Email Already Exists
Returned when the email address is already registered in the system.
{
"success": false,
"message": "Email already exists"
}
500 Internal Server Error
Returned when an unexpected error occurs during registration.
{
"success": false,
"message": "Registeration not successful",
"data": "Error details"
}
Notes
- The password is automatically hashed using bcrypt before storage
- Email addresses are automatically converted to lowercase
- The role field is case-insensitive and will be stored in lowercase
- A verification link is sent to the user’s email after successful registration
- The
isProfileComplete field is automatically set to false for new users
- Timestamps (
createdAt and updatedAt) are automatically generated