TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/TheSerchCp/SEAM-API/llms.txt
Use this file to discover all available pages before exploring further.
PUT /api/v1/users/:id endpoint updates an existing user account. All request body fields are optional — only the fields included in the request body are modified; omitted fields remain unchanged. If a new password is provided it is re-hashed with bcrypt (12 salt rounds) before being stored. The response returns the full updated user record fetched after the update.
This endpoint requires a valid JWT token and that the caller’s role has the PUT /api/v1/users/:id permission registered in the database.
Endpoint
http://localhost:{PORT}/api/v1
Authentication: JWT Bearer token + role permission PUT /api/v1/users/:id
Path Parameters
The numeric ID of the user to update. Must match the pattern
^\d+$. Validated by validate.middleware against getByIdSchema before the controller runs.Request Body
All fields are optional. At least one field should be provided to make a meaningful update.New full display name for the user. Must be between 2 and 100 characters if provided.
New email address. Must match the pattern
user@domain.tld. If the address is already used by another user account the API returns 409.ID of the new role to assign to the user. Must reference a valid row in the
roles table.New plain-text password for the user. Must be between 6 and 100 characters if provided. The value is re-hashed with bcrypt (12 salt rounds) before being written to the database; the plain-text value is never stored or returned.
Example Request
Responses
200 OK
Returned when the user exists and the update is applied successfully. The response contains the full refreshed user record retrieved after the update.Always
true for successful responses.Human-readable confirmation:
"Usuario actualizado exitosamente".The full user record as it exists after the update. Fields mirror those returned by
GET /api/v1/users/:id.400 Bad Request — Validation Error
Returned when the:id path parameter is not numeric, or when a provided body field fails its type, length, or pattern constraint from editUserSchema.
401 Unauthorized
Returned when theAuthorization header is missing, the token is malformed, or the token has expired.
403 Forbidden
Returned when the JWT is valid but the caller’s role does not havePUT /api/v1/users/:id in the permissionXRole table.
404 Not Found
Returned when no user with the given ID is found. The service fetches the user before updating and throwsNotFoundError if the record does not exist.
409 Conflict — Email Already In Use
Returned when the suppliedemail is already registered to a different user account.
Permission Setup
For a role to access this endpoint, a record must exist in thepermissions table with nameUri = "PUT /api/v1/users/:id" and be linked to the role in permissionXRole. The roles.middleware derives this URI automatically from the Express route pattern: