User management in Ferred is restricted to the Administrator role. Admins can create new users, assign roles (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Carlos-Gnd/FERRED-Inventario-y-Ventas/llms.txt
Use this file to discover all available pages before exploring further.
ADMIN, CAJERO, BODEGA), assign a branch (sucursalId), and activate/deactivate accounts. An admin can only manage users who belong to the same branch — cross-branch operations return 403.
Base URL: https://server-production-3252.up.railway.app
Passwords are never returned in any response. The server stores a bcrypt hash (
contrasenaHash) internally and never exposes it through the API.GET /api/usuarios
Returns all users belonging to the authenticated admin’s branch. Supports optional filtering by role, active status, and name/email search. Required role:ADMIN
Query parameters
Free-text search against
nombre and email (case-insensitive).Filter by role. One of:
ADMIN, CAJERO, BODEGA.Filter by account status. Pass
true for active accounts, false for deactivated.Response
Array of user objects, ordered byid descending.
Internal user ID.
Display name.
Email address (normalized to lowercase).
Assigned role:
ADMIN, CAJERO, or BODEGA.ID of the branch this user belongs to.
Whether the account is active.
ISO 8601 timestamp when the account was created.
list users
GET /api/usuarios/:id
Returns a single user by ID. The user must belong to the authenticated admin’s branch. Required role:ADMIN
Path parameters
ID of the user to retrieve.
Response
Single user object (same shape as list response, withoutcreadoEn).
Error responses
| Status | Condition |
|---|---|
400 | id is not a finite number. |
403 | The user belongs to a different branch than the admin. |
404 | No user found with the given ID. |
POST /api/usuarios
Creates a new user account. The new user is automatically assigned to the authenticated admin’s branch — you cannot create a user in a different branch. Required role:ADMIN
Request body
Display name. Minimum 2 characters.
Email address. Must be a valid email format and unique across all users. Normalized to lowercase before storage.
Plain-text password. Minimum 6 characters. Hashed with bcrypt (12 rounds) before storage and never returned.
Role to assign. One of:
ADMIN, CAJERO, BODEGA.Branch ID to assign the user to. Must match the authenticated admin’s own
sucursalId.Whether the account is active immediately upon creation.
Response
Confirmation:
"Usuario creado".The newly created user profile (password hash is never included).
Error responses
| Status | Condition |
|---|---|
400 | Validation failed, or the email is already registered. |
403 | sucursalId does not match the admin’s own branch. |
create user
PUT /api/usuarios/:id
Updates an existing user’s profile. All fields are optional (partial update). The user’ssucursalId cannot be changed through this endpoint — branch membership is fixed at creation time.
Required role: ADMIN
Path parameters
ID of the user to update. Must belong to the admin’s branch.
Request body
New display name. Minimum 2 characters.
New email address. Must be valid and unique.
New plain-text password. Minimum 6 characters. Re-hashed before storage. Omit to leave the existing password unchanged.
New role:
ADMIN, CAJERO, or BODEGA.Account active status.
Response
Confirmation:
"Usuario actualizado".The updated user profile (same shape as create response, no password).
Error responses
| Status | Condition |
|---|---|
400 | Validation failed. |
403 | The target user belongs to a different branch. |
404 | No user found with the given ID. |
DELETE /api/usuarios/:id
Soft-deactivates a user account by settingactivo = false. The user can no longer log in, but their historical data (sales, sync logs) is preserved.
Required role: ADMIN
Path parameters
ID of the user to deactivate. Must belong to the admin’s branch.
Response
Confirmation:
"Usuario desactivado correctamente".Error responses
| Status | Condition |
|---|---|
400 | id is not a finite number. |
403 | The target user belongs to a different branch. |
404 | No user found with the given ID. |