Skip to main content
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

success
boolean
true on success.
data
object

Error responses

StatusCondition
401Missing or invalid Bearer token
404User record not found

Example

curl http://localhost:3000/api/users/me \
  -H "Authorization: Bearer <accessToken>"

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

name
string
New display name. 1–100 characters. Whitespace is trimmed.
email
string
New email address. Must be a valid email, maximum 255 characters. Stored in lowercase.

Response — 200 OK

success
boolean
true on success.
message
string
"Profile updated successfully"
data
object
The full updated user record from the database.

Error responses

StatusCondition
400No valid fields provided, or validation failure
401Missing or invalid Bearer token
404User record not found
409The supplied email is already in use by another account

Example

curl -X PATCH http://localhost:3000/api/users/me \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <accessToken>" \
  -d '{"name": "Mustang Mike"}'

GET /api/users/:id

Return the public profile of any user by their numeric ID.

Path parameters

id
integer
required
The numeric ID of the user.

Response — 200 OK

success
boolean
true on success.
data
object

Error responses

StatusCondition
400id is not a valid integer
404No user found with that ID

Example

curl "http://localhost:3000/api/users/7"

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

id
integer
required
The numeric ID of the user.

Response — 200 OK

success
boolean
true on success.
data
array
Completions sorted by completedAt descending.

Error responses

StatusCondition
400id is not a valid integer
404No user found with that ID

Example

curl "http://localhost:3000/api/users/7/completions"

GET /api/users/:id/stats

Return aggregated statistics for a user, including breakdowns by difficulty, streak history, and recent activity.

Path parameters

id
integer
required
The numeric ID of the user.

Response — 200 OK

success
boolean
true on success.
data
object

Error responses

StatusCondition
400id is not a valid integer
404No user found with that ID

Example

curl "http://localhost:3000/api/users/7/stats"

Build docs developers (and LLMs) love