TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Renzo717/Aula-Virtual-Universidad-Radiolocucion/llms.txt
Use this file to discover all available pages before exploring further.
/api/users router provides full lifecycle management for platform user accounts. All routes (except the preceptor-accessible /search endpoint) require the authenticated user to hold the admin role — requests from any other role are rejected with 403 Forbidden. Deleting a user is a soft-delete that sets status: inactivo on the profiles table rather than destroying the underlying Supabase Auth record.
GET /api/users
Returns a paginated list of all user profiles. Supports full-text search acrossnombre, apellido, email, and dni, and can be filtered by role.
Auth: requireAuth + requireRole('admin').
Query parameters
Case-insensitive substring to match against
nombre, apellido, email, or dni.Filter by role. One of
admin, docente, estudiante, or preceptor.Page number (1-based). Defaults to
1.Number of records per page. Defaults to
20.Response — 200 OK
Array of
Profile objects ordered by created_at descending.Total number of matching records (for pagination).
Current page number.
Page size used for this response.
Example
GET /api/users/search
Quick search for users by name or DNI, returning a lightweight subset of profile fields. Useful for autocomplete widgets and assignment pickers. Returns up to 30 results. Auth:requireAuth + requireRole('admin', 'preceptor').
Query parameters
Search term matched case-insensitively against
nombre, apellido, and dni.Response — 200 OK
Example
GET /api/users/stats
Returns aggregate counts for dashboard widgets. Auth:requireAuth + requireRole('admin').
Response — 200 OK
Example
POST /api/users
Creates a new platform user. This is the admin path to provision accounts; it bypasses the self-registration flow and always creates the account withstatus: activo. A Supabase Auth user is created first; if the subsequent profiles insert fails the Auth user is automatically deleted to keep the systems in sync.
Auth: requireAuth + requireRole('admin').
Request body
First name. Minimum 2 characters.
Last name. Minimum 2 characters.
Email address. Must be unique across the platform.
Initial password. Minimum 6 characters.
Role to assign. One of
admin, docente, estudiante, or preceptor.National ID number. Must be unique if provided.
Phone / mobile number.
Response — 201 Created
The newly created
Profile record.Error responses
| Status | Meaning |
|---|---|
400 | Validation error, duplicate email, or duplicate DNI. |
403 | Caller is not an admin. |
Example
PATCH /api/users/:id
Updates any subset of fields on an existing user profile. Ifpassword is included it is applied to the Supabase Auth record. If email is included the Supabase Auth identity email is also updated after the profile row is saved. Empty strings for dni and celular are normalised to null.
Auth: requireAuth + requireRole('admin').
Path parameters
UUID of the profile to update.
Request body
All fields are optional. Send only the fields you wish to change.Updated first name. Minimum 2 characters.
Updated last name. Minimum 2 characters.
Updated email. Must be a valid, unique email address.
New password for the account. Minimum 6 characters.
Updated national ID. Must be unique. Pass an empty string to clear.
Updated phone number. Pass an empty string to clear.
Updated role:
admin, docente, estudiante, or preceptor.Updated account status:
activo, pendiente, or inactivo. Use this to approve a pending docente account.Response — 200 OK
The updated
Profile record.Error responses
| Status | Meaning |
|---|---|
400 | Validation error or duplicate DNI. |
403 | Caller is not an admin. |
Example
DELETE /api/users/:id
Soft-deletes a user by setting theirstatus to inactivo. The underlying Supabase Auth account is not deleted. The user will be blocked from logging in until reactivated via PATCH /api/users/:id.
Auth: requireAuth + requireRole('admin').
Path parameters
UUID of the profile to deactivate.
Response — 200 OK
Error responses
| Status | Meaning |
|---|---|
400 | Database error. |
403 | Caller is not an admin. |