Skip to main content

GET /api/users/

Retrieves a single user by their unique identifier. This endpoint requires read privileges or admin role.

Authentication

This endpoint requires JWT authentication with one of the following:
  • READ_PRIVILEGES authority
  • ADMIN role

Path Parameters

id
UUID
required
The unique identifier of the user to retrieve

Response

id
UUID
Unique identifier for the user
names
string
User’s full name
email
string
User’s email address
isEnabled
boolean
Whether the user account is enabled
accountNonExpired
boolean
Whether the user account has not expired
accountNonLocked
boolean
Whether the user account is not locked
credentialsNonExpired
boolean
Whether the user’s credentials have not expired
roles
array
List of roles assigned to the user
status
string
User status (ACTIVO or INACTIVO)

Error Codes

  • 200 - User found and returned successfully
  • 401 - Unauthorized: Missing or invalid JWT token
  • 403 - Forbidden: Insufficient permissions
  • 404 - Not Found: User does not exist

Example Request

curl -X GET https://api.example.com/api/users/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Example Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "names": "John Michael Doe",
  "email": "john.doe@example.com",
  "isEnabled": true,
  "accountNonExpired": true,
  "accountNonLocked": true,
  "credentialsNonExpired": true,
  "roles": [
    {
      "id": "660e8400-e29b-41d4-a716-446655440000",
      "name": "USER",
      "description": "Standard user role",
      "permissions": [
        {
          "id": "770e8400-e29b-41d4-a716-446655440000",
          "name": "READ_PRIVILEGES",
          "description": "Can read resources"
        }
      ],
      "status": "ACTIVO"
    }
  ],
  "status": "ACTIVO"
}

Example Error Response

{
  "timestamp": "2026-03-04T10:30:00Z",
  "requestId": "abc123-def456",
  "message": "User not found",
  "detail": "Usuario con id 550e8400-e29b-41d4-a716-446655440000 no encontrado"
}

Build docs developers (and LLMs) love