GET /api/user
Retrieves the profile information for the currently authenticated user.Authentication
This endpoint requires a valid session cookie. The user must be authenticated.Request
No request body or query parameters required.cURL
fetch
Response
Returns the user object ornull if the user is not authenticated.
The unique identifier for the user
The user’s display name
The user’s email address (unique)
The hashed password (should never be exposed to the client in production)
The user’s role in the system. Default value is “member”
ISO 8601 timestamp of when the user account was created
ISO 8601 timestamp of when the user account was last updated
ISO 8601 timestamp of when the user account was soft-deleted, or null if active
Response Examples
Error Handling
The endpoint returnsnull in the following cases:
- No session cookie is present
- Session cookie is invalid or malformed
- Session has expired
- User ID from session does not exist in the database
- User account has been soft-deleted
null response.
Security Notes
Implementation Details
The endpoint:- Reads the session cookie from the request
- Verifies the JWT token stored in the cookie
- Checks if the session has expired
- Queries the database for the user by ID
- Filters out soft-deleted users (where
deletedAtis not null) - Returns the user object or null