Skip to main content
GET
/
api
/
users
/
{id}
Get public profile
curl --request GET \
  --url https://api.example.com/api/users/{id}
{
  "success": true,
  "timestamp": "<string>",
  "data": {
    "firstName": "<string>",
    "lastName": "<string>"
  }
}

Endpoint

GET /api/users/{id}

Authentication

Requires a valid JWT access token in the Authorization header.
Authorization: Bearer <access_token>

Path Parameters

id
number
required
The unique identifier of the user

Response

Returns the user’s public profile, which contains only their first and last name.
success
boolean
Indicates if the request was successful
timestamp
string
ISO 8601 timestamp of the response
data
object
User public profile data
Public profiles only expose the user’s name. Email, roles, and other sensitive information are not included.

Example Request

curl -X GET http://localhost:8080/api/users/5 \
  -H "Authorization: Bearer <access_token>"

Example Response

{
  "success": true,
  "timestamp": "2026-03-03T10:30:00Z",
  "data": {
    "firstName": "John",
    "lastName": "Doe"
  }
}

Error Responses

{
  "success": false,
  "timestamp": "2026-03-03T10:30:00Z",
  "error": "Unauthorized"
}
The access token is missing, invalid, or expired.
{
  "success": false,
  "timestamp": "2026-03-03T10:30:00Z",
  "error": "User not found"
}
No user exists with the specified ID.

Source Reference

This endpoint is implemented in:
  • UserController.java:31-34
  • Response DTO: UserPublicProfile.java:3-7

Build docs developers (and LLMs) love