Overview
The Users API allows you to manage all types of users in the system, including students (estudiantes), teachers (docentes), and administrators. Users are associated with institutions and have different roles.
Endpoints
Method Endpoint Description GET /api/usersList all users POST /api/usersCreate a new user GET /api/users/{id}Get a specific user PUT /api/users/{id}Update a user DELETE /api/users/{id}Delete a user
List All Users
curl -X GET "https://api.example.com/api/users" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"
Response
Indicates if the request was successful
Response message in Spanish
Array of user objects Unique identifier for the user
Foreign key referencing the institution this user belongs to
User role (e.g., “estudiante”, “docente”, “administrador”)
User’s email address (unique)
National identity document number (DNI, etc.)
Date of birth (YYYY-MM-DD)
Whether the user account is active (default: true)
Record creation timestamp
Record last update timestamp
{
"success" : true ,
"message" : "Usuarios listados con éxito" ,
"data" : [
{
"id" : 1 ,
"institutions_id" : 1 ,
"rol" : "estudiante" ,
"nombre" : "Juan" ,
"apellido" : "Pérez García" ,
"email" : "[email protected] " ,
"documento_identidad" : "72345678" ,
"fecha_nacimiento" : "2010-05-15" ,
"telefono" : "+51 987 654 321" ,
"activo" : true ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T10:30:00.000000Z"
},
{
"id" : 2 ,
"institutions_id" : 1 ,
"rol" : "docente" ,
"nombre" : "María" ,
"apellido" : "Rodriguez Santos" ,
"email" : "[email protected] " ,
"documento_identidad" : "45678901" ,
"fecha_nacimiento" : "1985-08-20" ,
"telefono" : "+51 987 123 456" ,
"activo" : true ,
"created_at" : "2026-03-05T11:00:00.000000Z" ,
"updated_at" : "2026-03-05T11:00:00.000000Z"
}
]
}
The password field is hidden in API responses for security purposes.
Create User
curl -X POST "https://api.example.com/api/users" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"institutions_id": 1,
"rol": "estudiante",
"nombre": "Carlos",
"apellido": "Mendoza Lima",
"email": "[email protected] ",
"password": "SecurePass123!",
"documento_identidad": "76543210",
"fecha_nacimiento": "2011-03-22",
"telefono": "+51 912 345 678",
"activo": true
}'
Request Parameters
ID of the institution this user belongs to. Must reference a valid institution.
User role in the system. Common values: “estudiante” (student), “docente” (teacher), “administrador” (administrator)
User’s email address. Must be unique across all users.
User’s password. Will be automatically hashed before storage.
National identity document number (DNI, passport, etc.). Can be null.
Date of birth in YYYY-MM-DD format. Can be null.
Contact phone number. Can be null.
Whether the user account is active. Defaults to true.
Response
{
"success" : true ,
"message" : "Usuario creado con éxito" ,
"data" : {
"id" : 3 ,
"institutions_id" : 1 ,
"rol" : "estudiante" ,
"nombre" : "Carlos" ,
"apellido" : "Mendoza Lima" ,
"email" : "[email protected] " ,
"documento_identidad" : "76543210" ,
"fecha_nacimiento" : "2011-03-22" ,
"telefono" : "+51 912 345 678" ,
"activo" : true ,
"created_at" : "2026-03-05T12:30:00.000000Z" ,
"updated_at" : "2026-03-05T12:30:00.000000Z"
}
}
Get User
curl -X GET "https://api.example.com/api/users/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"
Path Parameters
The unique identifier of the user
Response
{
"success" : true ,
"message" : "Usuario obtenido con éxito" ,
"data" : {
"id" : 1 ,
"institutions_id" : 1 ,
"rol" : "estudiante" ,
"nombre" : "Juan" ,
"apellido" : "Pérez García" ,
"email" : "[email protected] " ,
"documento_identidad" : "72345678" ,
"fecha_nacimiento" : "2010-05-15" ,
"telefono" : "+51 987 654 321" ,
"activo" : true ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T10:30:00.000000Z"
}
}
Update User
curl -X PUT "https://api.example.com/api/users/1" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"institutions_id": 1,
"rol": "estudiante",
"nombre": "Juan Carlos",
"apellido": "Pérez García",
"email": "[email protected] ",
"password": "NewSecurePass456!",
"documento_identidad": "72345678",
"fecha_nacimiento": "2010-05-15",
"telefono": "+51 987 654 322",
"activo": true
}'
Path Parameters
The unique identifier of the user to update
Request Parameters
All parameters from the Create endpoint apply. You can send partial updates.
ID of the institution this user belongs to
User’s email address (must be unique)
New password (only include if changing password)
National identity document number
Date of birth (YYYY-MM-DD)
Response
{
"success" : true ,
"message" : "Usuario actualizado con éxito" ,
"data" : {
"id" : 1 ,
"institutions_id" : 1 ,
"rol" : "estudiante" ,
"nombre" : "Juan Carlos" ,
"apellido" : "Pérez García" ,
"email" : "[email protected] " ,
"documento_identidad" : "72345678" ,
"fecha_nacimiento" : "2010-05-15" ,
"telefono" : "+51 987 654 322" ,
"activo" : true ,
"created_at" : "2026-03-05T10:30:00.000000Z" ,
"updated_at" : "2026-03-05T14:45:00.000000Z"
}
}
Delete User
curl -X DELETE "https://api.example.com/api/users/1" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_TOKEN"
Path Parameters
The unique identifier of the user to delete
Response
{
"success" : true ,
"message" : "Usuario eliminado con éxito" ,
"data" : null
}
Deleting a user will cascade delete all associated registrations where this user is either a student (estudiante_id) or teacher (docente_id).
User Roles
The system supports different user roles:
estudiante : Student users who can be enrolled in courses
docente : Teacher users who can teach sections and grade students
administrador : Administrative users with full system access
The rol field should contain one of these values when creating or updating users.