All endpoints are prefixed with
/api/users. Responses use
Content-Type: application/json. Endpoints that return or modify private
data require an Authorization: Bearer <accessToken> header.GET /api/users/me
Return the full profile of the currently authenticated user, including their aura points, streak, completion count, and leaderboard rank.Auth required: Yes — include
Authorization: Bearer <accessToken>.Response — 200 OK
true on success.Error responses
| Status | Condition |
|---|---|
401 | Missing or invalid Bearer token |
404 | User record not found |
Example
PATCH /api/users/me
Update the display name and/or email address of the currently authenticated user. At least one updatable field must be provided.Auth required: Yes — include
Authorization: Bearer <accessToken>.Request body
New display name. 1–100 characters. Whitespace is trimmed.
New email address. Must be a valid email, maximum 255 characters.
Stored in lowercase.
Response — 200 OK
true on success."Profile updated successfully"The full updated user record from the database.
Error responses
| Status | Condition |
|---|---|
400 | No valid fields provided, or validation failure |
401 | Missing or invalid Bearer token |
404 | User record not found |
409 | The supplied email is already in use by another account |
Example
GET /api/users/:id
Return the public profile of any user by their numeric ID.Path parameters
The numeric ID of the user.
Response — 200 OK
true on success.Error responses
| Status | Condition |
|---|---|
400 | id is not a valid integer |
404 | No user found with that ID |
Example
GET /api/users/:id/completions
Return all challenge completions for the specified user, ordered by most recent first. Each completion includes the full challenge record.Path parameters
The numeric ID of the user.
Response — 200 OK
true on success.Completions sorted by
completedAt descending.Error responses
| Status | Condition |
|---|---|
400 | id is not a valid integer |
404 | No user found with that ID |
Example
GET /api/users/:id/stats
Return aggregated statistics for a user, including breakdowns by difficulty, streak history, and recent activity.Path parameters
The numeric ID of the user.
Response — 200 OK
true on success.Error responses
| Status | Condition |
|---|---|
400 | id is not a valid integer |
404 | No user found with that ID |