Skip to main content

GET /api/auth/user

Retrieves the profile information for the currently authenticated user.

Authentication

Required. This endpoint requires authentication via the authenticate middleware. Include authentication token in the request headers.

Request Parameters

No parameters required.

Response

user
object
Authenticated user’s profile data.
id
number
User’s unique identifier.
username
string
User’s display name.
email
string
User’s email address.
points
string
User’s current points balance.
confirmed
boolean
Whether the user’s account is confirmed.

Success Response (200 OK)

{
  "id": 42,
  "username": "johndoe",
  "email": "john@example.com",
  "points": "1500",
  "confirmed": true
}

Error Responses

401 Unauthorized - No Authentication Token

{
  "error": "Unauthorized"
}

401 Unauthorized - Invalid Token

{
  "error": "Invalid token"
}

cURL Example

curl -X GET https://api.example.com/api/auth/user \
  -H "Authorization: Bearer YOUR_AUTH_TOKEN"

Notes

  • Requires valid authentication token in request headers
  • Returns the user object attached to the request by the authentication middleware
  • Rate limiting is applied to this endpoint
  • Useful for verifying authentication status and retrieving current user data

Build docs developers (and LLMs) love