Section 10 Official Documentation

Authentication & User Management

Registration, login, email verification, and profile management with Sanctum.

Authentication & User Management

HosteDay provides a built-in authentication and user management system ready to use as soon as you create your App, powered by Sanctum Bearer Tokens without writing manual auth boilerplate.


1. Authentication Endpoints

All authentication endpoints are protected by API Protection (X-Api-Token):

Action Method & Endpoint Rate Limit Required Fields
Register POST /api/auth/register 3 req/min name, email, password, password_confirmation
Login POST /api/auth/login 5 req/min email, password
Forgot Password POST /api/auth/forgot-password 3 req/min email

Password Rules on Registration

  • Length between 4 and 64 characters with password_confirmation.
  • Must include uppercase and lowercase letters, numbers, and symbols.

2. User & Profile Management Endpoints

The following endpoints require Authorization: Bearer YOUR_USER_TOKEN in addition to X-Api-Token:

Action Method & Endpoint Notes
Logout POST /api/logout Revokes the current user's access token.
Resend Verification Email POST /api/user/email/verification-notification Limited to 6 req/min.
Check Verification Status GET /api/user/email/verification-status Returns whether the user's email is verified.
Send Password Reset Email POST /api/user/password-reset-email Limited to 3 req/min.

Profile Endpoints (Require a verified account)

  • GET /api/user: Fetch the authenticated user's profile.
  • PUT /api/user: Update the user's name.
  • POST /api/user/avatar: Update user avatar (bytes Base64 string and extension: jpg, jpeg, png, or webp).
  • DELETE /api/user: Delete the user account.

3. Example: Logging In & Fetching Profile

curl -X POST "https://my-app.hosteday.com/api/auth/login" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -H "X-Api-Token: YOUR_API_TOKEN" \
  -d '{
    "email": "user@example.com",
    "password": "Password@123"
  }'

Next Step

Once user authentication is set up, learn how to search, filter, and paginate data through automatic CRUD APIs: