Skip to main content

GET /api/users

Retrieves a list of all users in the system. This endpoint requires read privileges or admin role.

Authentication

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

Response

Returns an array of user objects.
[].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 - Users retrieved successfully
  • 401 - Unauthorized: Missing or invalid JWT token
  • 403 - Forbidden: Insufficient permissions

Example Request

curl -X GET https://api.example.com/api/users \
  -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": [],
        "status": "ACTIVO"
      }
    ],
    "status": "ACTIVO"
  },
  {
    "id": "660e8400-e29b-41d4-a716-446655440001",
    "names": "Jane Smith",
    "email": "jane.smith@example.com",
    "isEnabled": true,
    "accountNonExpired": true,
    "accountNonLocked": true,
    "credentialsNonExpired": true,
    "roles": [
      {
        "id": "770e8400-e29b-41d4-a716-446655440000",
        "name": "ADMIN",
        "description": "Administrator role",
        "permissions": [],
        "status": "ACTIVO"
      }
    ],
    "status": "ACTIVO"
  }
]

Build docs developers (and LLMs) love