AllDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/gcapella0/agente-inteligente-expedientes/llms.txt
Use this file to discover all available pages before exploring further.
/usuarios endpoints are restricted to the admin role via the verify_admin dependency. Passwords are stored as bcrypt hashes (via passlib) and the password_hash field is explicitly excluded from every response using a MongoDB projection {"password_hash": 0}. Cleartext passwords are never logged or returned.
The
/usuarios router uses a different role set (admin, docente, viewer) from the core UsuarioModel used by the /auth router (admin, usuario, sistema). Accounts created via /usuarios/crear receive one of those three roles. See the role reference at the bottom of this page.GET /usuarios/
List all user accounts.| Property | Value |
|---|---|
| Method | GET |
| Path | /usuarios/ |
| Auth required | Yes — admin role |
Response 200 — Success
Returns an array of serialized user documents. Thepassword_hash field is never included.
_serializar_usuario, which maps MongoDB’s _id to id (string) and coerces creado_en / createdAt to an ISO 8601 string.
POST /usuarios/crear
Create a new user account.| Property | Value |
|---|---|
| Method | POST |
| Path | /usuarios/crear |
| Auth required | Yes — admin role |
| Content-Type | application/json |
| Status | 201 Created |
Request body
Valid email address for the account. Must contain
@ and be unique in the usuarios collection.Plaintext password. Minimum 6 characters. Stored as a bcrypt hash.
Role to assign. Must be one of
admin, docente, or viewer.Response 201 — Created
Error responses
| Status | Detail | Cause |
|---|---|---|
400 | Email inválido | Email string does not contain @ |
400 | Password debe tener mínimo 6 caracteres | Password length is fewer than 6 characters |
400 | Rol inválido. Valores permitidos: ['admin', 'docente', 'viewer'] | rol is not in _ROLES_VALIDOS |
400 | El email ya está registrado | A document with that email already exists |
cURL example
PUT /usuarios/{user_id}/rol
Update the role of an existing user.| Property | Value |
|---|---|
| Method | PUT |
| Path | /usuarios/{user_id}/rol |
| Auth required | Yes — admin role |
| Content-Type | application/json |
Path parameters
MongoDB
ObjectId of the target user (24-character hex string, e.g. 507f1f77bcf86cd799439011).Request body
New role to assign. Must be one of
admin, docente, or viewer.Response 200 — Success
Error responses
| Status | Detail | Cause |
|---|---|---|
400 | Rol inválido. Valores permitidos: ['admin', 'docente', 'viewer'] | rol is not in _ROLES_VALIDOS |
400 | ID de usuario inválido | user_id cannot be parsed as a bson.ObjectId |
404 | Usuario no encontrado | No document with that _id exists |
DELETE /usuarios/{user_id}
Permanently delete a user account.| Property | Value |
|---|---|
| Method | DELETE |
| Path | /usuarios/{user_id} |
| Auth required | Yes — admin role |
Path parameters
MongoDB
ObjectId of the user to delete (24-character hex string).Response 200 — Success
Error responses
| Status | Detail | Cause |
|---|---|---|
400 | ID de usuario inválido | user_id cannot be parsed as a bson.ObjectId |
404 | Usuario no encontrado | delete_one matched zero documents |
Roles
The/usuarios router enforces the following valid roles, defined in _ROLES_VALIDOS:
| Role | Access level |
|---|---|
admin | Full access — user management (/usuarios), audit endpoints (/admin/auditoria), and all other routes |
docente | Standard authenticated access. Equivalent to usuario in the core auth model |
viewer | Read-only access. Cannot create, modify, or delete records |
Role
docente in the /usuarios router corresponds to usuario in the core UsuarioModel. Accounts created via /auth/crear-usuario use the admin | usuario | sistema set, while accounts created via /usuarios/crear use the admin | docente | viewer set. Both account types share the same MongoDB usuarios collection and the same JWT machinery.