Skip to main content

PUT /api/users/

Updates an existing user’s information. This endpoint requires write privileges or admin role.

Authentication

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

Path Parameters

id
UUID
required
The unique identifier of the user to update

Request Body

name
string
User’s first name (optional)
lastName
string
User’s last name (optional)
secondName
string
User’s middle name or second last name (optional)
email
string
User’s email address. Must be a valid email format if provided.
password
string
User’s new password. Must be at least 8 characters long if provided.

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 updated successfully
  • 400 - Bad Request: Invalid input data
  • 401 - Unauthorized: Missing or invalid JWT token
  • 403 - Forbidden: Insufficient permissions
  • 404 - Not Found: User does not exist

Example Request

curl -X PUT https://api.example.com/api/users/550e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane",
    "email": "[email protected]"
  }'

Example Response

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "names": "Jane Michael Doe",
  "email": "[email protected]",
  "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"
}

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