Overview
The Users API provides endpoints for managing user profiles and notifications. Users are automatically created when they first authenticate with a valid Firebase token.Get Authenticated User
GET /api/auth/me
Get the authenticated user directly from the Firebase token without a database query. This is faster than /api/users/me but returns less information.
Response
User ID
Firebase authentication UID
User’s email address
User’s display name
User role (default: “user”, can be “admin”)
Get Current User Profile
GET /api/users/me
Get the authenticated user’s profile. Requires authentication.
Response
User profile object
Update User Profile
PUT /api/users/me
Update the authenticated user’s profile. Requires authentication.
Request Body
All fields are optional. Only include fields to update.User’s display name
Profile photo URL
User biography
User preferences (structure is flexible)
Response
“Profile updated successfully”
Updated user object
Get Notifications
GET /api/users/me/notifications
Get user’s in-app notifications, sorted by most recent first. Requires authentication.
Response
Array of notification objects, sorted by
createdAt descendingManage Notifications
PUT /api/users/me/notifications
Mark notifications as read or delete them. Requires authentication.
Request Body
Action to perform:
markAllRead- Mark all notifications as readmarkRead- Mark specific notifications as read (requiresnotificationIds)delete- Delete specific notifications (requiresnotificationIds)
Array of notification IDs (required for
markRead and delete actions)Response
Success message:
- “All notifications marked as read”
- “Notifications marked as read”
- “Notifications deleted”
User Auto-Creation
Users are automatically created on first authentication:- User authenticates with Firebase
- API verifies Firebase token
- If user doesn’t exist in database:
- Creates user with Firebase UID, email, display name, photo
- Sets default role to “user”
- Initializes default notification settings
- Returns user object