The Users API lets authenticated users manage their own profiles, change passwords, and control their account lifecycle (suspend, reactivate, or soft-delete). Admin users gain additional endpoints to list all users, update any account, reset any password, change any user’s status, or permanently delete records. Base URL:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JaiderT/CoffeePrice/llms.txt
Use this file to discover all available pages before exploring further.
/api/usuario
Authentication: All endpoints require a valid session cookie (auth_token) obtained after login. Requests without a valid token receive 401 Unauthorized.
GET /api/usuario
Returns a list of all registered users. Sensitive fields (password, recovery codes, and verification tokens) are automatically stripped from every response.
Auth: Admin only
200 OK
PUT /api/usuario/perfil
Updates the authenticated user’s own profile. Onlynombre, apellido, and celular may be changed through this endpoint.
Auth: Own account
Validation rules
nombreandapellidomust contain only letters, including Spanish accented characters (á é í ó ú Á É Í Ó Ú ñ Ñ ü Ü) and spaces. Digits or special characters return400.celularis optional and has no format restriction.
Request body
First name. Must contain only letters and spaces (including Spanish accented characters).
Last name. Must contain only letters and spaces (including Spanish accented characters).
Mobile phone number. Optional — any format accepted.
200 OK — Returns the updated user object (without password or verification fields).
Response 400 Bad Request — If nombre or apellido contain non-letter characters.
PUT /api/usuario/password
Changes the authenticated user’s own password. Requires the current password for verification before the new password is saved. Auth: Own accountValidation rules
passwordnueva must satisfy:
400 before any database lookup is performed.
Request body
The user’s current password. Used for verification via bcrypt compare.
The new password. Minimum 10 characters, must include at least one uppercase letter, one lowercase letter, and one digit.
200 OK
400 Bad Request — If passwordnueva fails the regex, or if passwordactual does not match the stored hash.
DELETE /api/usuario/perfil
Soft-deletes the authenticated user’s own account by settingestado to "eliminado". The record is retained in the database. Authentication cookies (auth_token and connect.sid) are cleared on success.
Auth: Own account
200 OK
PUT /api/usuario/suspender
Self-suspends the authenticated user’s own account by settingestado to "suspendido". The account can be reactivated later via PUT /api/usuario/reactivar.
Auth: Own account
200 OK
PUT /api/usuario/reactivar
Reactivates a previously self-suspended account by settingestado back to "activo".
Auth: Own account
200 OK
Admin-only endpoints
All endpoints in this section require the authenticated user to haverol: "admin".
PUT /api/usuario/:id/estado
Changes theestado of any user. When the target user has rol: "comprador", this endpoint also syncs the linked buyer record’s estadoRevision and sends an email notification.
Accepted estado values: activo · pendiente · rechazado · eliminado · suspendido
The new account status. Must be one of:
activo, pendiente, rechazado, eliminado, suspendido.Reason for rejection. Only relevant when
estado is "rechazado" and the user is a buyer. Included in the decision email.200 OK — Returns the updated user object.
PUT /api/usuario/:id/actualizar
Updates any user’snombre, apellido, celular, estado, and rol fields. Admin-only fields (estado, rol) are only applied when the request comes from an admin.
Updated first name.
Updated last name.
Updated phone number.
Updated account status (admin-only field).
Updated role:
productor, comprador, or admin (admin-only field).200 OK — Returns the updated user object (sensitive fields stripped).
PUT /api/usuario/:id/password
Resets any user’s password directly. No current-password verification is required — admin privileges are sufficient.The new plaintext password to set. Will be hashed with bcrypt (10 salt rounds) before storage.
200 OK
DELETE /api/usuario/:id
Performs a soft-delete on any user by setting theirestado to "eliminado". The record remains in the database.
200 OK
404 Not Found — If no user exists with the given :id.