This endpoint allows an authenticated user to update their own profile information. Currently, the only mutable field exposed through this endpoint isDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/tukit/llms.txt
Use this file to discover all available pages before exploring further.
userName. The user document is located by the userId path parameter, and as a safety check the controller also verifies that the resolved document’s _id matches the supplied userId — a mismatch returns a 403 error. Users can only modify their own account; updating another user’s profile requires no separate permission check beyond the ID match, so ensure the userId in the URL corresponds to the token owner’s ID.
POST /api/user/update-user/:userId
Authentication
A valid JWT obtained from the Login endpoint. The middleware verifies this token before the controller logic runs.
Path Parameters
The MongoDB ObjectId of the user account to update. Must match the
_id of the authenticated user’s account.Request Body
The new display name to set on the account. If omitted, the existing
userName is preserved unchanged.Response
200 — Success
Human-readable confirmation that the update was applied (
"Usuario actualizado correctamente").Always
true on success.The full updated user document as returned by Mongoose after
.save().Error Responses
| Status | Cause |
|---|---|
404 | No user document found for the provided userId. |
403 | The userId in the URL does not match the _id of the located user document. |
500 | Unexpected server or database error. |
To update other account properties such as
password or roles, use the dedicated Update Roles endpoint or the Recovery Password and Update Password sections below.Example
Recovery Password
Initiates a password-reset flow for an existing account. The controller generates a random 5-digit code, stores it ascode_newpass on the user document, and dispatches it to the account’s registered email address via Nodemailer. The code must then be submitted to the Update Password endpoint below to complete the reset.
POST /api/user/recovery-password
Authentication
A valid JWT obtained from the Login endpoint. The
Token middleware validates this header before the controller runs.Request Body
The registered email address of the account whose password should be reset. If no account is found for this address, the request is rejected with a
203 response.Response
200 — Success
Confirmation that the 5-digit reset code has been sent:
"Te hemos enviado un código de 5 dígitos a tu correo para verificar el cambio de contraseña".Always
true on success.The reset code is stored in the
code_newpass field on the user document. It is not returned in the response — it is delivered exclusively by email (via Nodemailer). Do not expose or cache this value client-side.Error Responses
| Status | Cause |
|---|---|
203 | No user document was found for the provided email address. |
500 | Unexpected server or database error. |
Example
Update Password
Completes the password-reset flow. The caller supplies the 5-digit code that was emailed by the Recovery Password endpoint along with the desired new password. If the code matches thecode_newpass stored on the user document, the password is hashed with bcrypt and saved, and both code fields are cleared from the document.
POST /api/user/update-password/:email
Authentication
A valid JWT obtained from the Login endpoint. The
Token middleware validates this header before the controller runs.Path Parameters
The registered email address of the account whose password is being reset.
Request Body
The 5-digit verification code that was sent to the user’s email by the Recovery Password endpoint. Must match the
code_newpass field stored on the user document.The new plain-text password to set on the account. It is hashed with bcrypt (cost factor 10) before storage.
Response
200 — Success
Confirmation that the password was changed:
"Contraseña actualizada correctamente".Always
true on success.On success the
code_newpass and code_confirm_pass fields on the user document are both cleared to an empty string, invalidating the one-time reset code immediately.Error Responses
| Status | Cause |
|---|---|
404 | No user document was found for the provided :email path parameter. |
203 | The supplied code_confirm_pass does not match the code_newpass stored on the user document. |
500 | Unexpected server or database error. |