Skip to main content
PUT /api/usuario/:id Updates the fields of an existing user. The core text fields (strNombreUsuario, idPerfil, strCorreo, strNumeroCelular, idEstadoUsuario) are always overwritten. imagenUrl is only updated when a new imagenBase64 value is provided — omitting it leaves the existing photo URL unchanged. strPwd is only re-hashed and updated when a non-empty string is provided.

Path parameters

number
required
Primary key of the user to update.

Request body

string
required
Updated username.
number
required
Updated profile (role) ID.
string
required
Updated email address.
string
Updated phone number.
boolean
required
Updated active status. true = active, false = inactive.
string
New plain-text password. If this field is present and non-empty, it is hashed with bcrypt (10 rounds) and replaces the stored hash. Omit or send an empty string to leave the password unchanged.
string
Base64-encoded replacement image (must start with data:image). When provided, a new image is uploaded to the usuarios_corp Cloudinary folder and imagenUrl is updated to the new secure URL. If omitted, the existing imagenUrl is not modified.

Response

boolean
required
true when the update completes without error.
object
required
The updated user record as returned by the database.

Error responses

The handler does not return a 404 if the id does not match any record — it will return success: true with data set to undefined. Validate the response data field on the client if you need to confirm the record existed.

Examples

Success response

200