Skip to main content
POST
/
api
/
auth
/
register
Register User
curl --request POST \
  --url https://api.example.com/api/auth/register \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "<string>",
  "password": "<string>",
  "role": "<string>",
  "invitedBy": "<string>"
}
'
{
  "success": true,
  "message": "<string>",
  "data": "<string>"
}

Endpoint

POST /api/auth/register

Authentication

No authentication required. This is a public endpoint.

Request Body

email
string
required
User’s email address. Must be a valid email format and unique in the system.
password
string
required
User’s password. Must be at least 6 characters long.
role
string
required
User role in the church. Must be either “pastor” or “member”.
invitedBy
string
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

success
boolean
Indicates whether the registration was successful.
message
string
Human-readable message describing the result.
data
string
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

Build docs developers (and LLMs) love