Overview
The Users API provides endpoints for managing user profiles and retrieving favorite properties. All endpoints require authentication. Base Path:/api/users
Authentication is handled via Better Auth. All requests must include valid session cookies.
Get User Profile
Authentication
Requires valid session cookie. Returns 401 if not authenticated.Response
Indicates if the request was successful
User profile object
Example Response
Update User Profile
Request Body
User’s full name (max 255 characters)
URL to user’s profile photo
Email and role cannot be changed through this endpoint. Contact an administrator to modify these fields.
Response
Indicates if the update was successful
Updated user profile object
Example Request
Example Response
Get User Favorites
Authentication
Requires valid session cookie. Returns 401 if not authenticated.Response
Indicates if the request was successful
Array of property IDs that the user has favorited
Example Response
Usage Example
Fromsrc/contexts/AuthContext.tsx:66:
Usage with Property Details
Fromsrc/pages/FavoritesPage.tsx:28:
The favorites endpoint returns only property IDs. To display property details, you need to fetch each property using the Properties API.
Error Responses
All endpoints may return the following error responses:Common Status Codes
200- Success400- Bad Request (invalid parameters)401- Unauthorized (not logged in or session expired)403- Forbidden (insufficient permissions)404- Not Found500- Internal Server Error
Common Error Codes
Related Documentation
- Properties API - Manage favorites with add/remove endpoints
- Authentication - Login and session management
- Admin API - Administrative user management