Overview
The Users API provides endpoints for creating, updating, searching, and deleting user accounts. All endpoints require authentication via session. Password hashing uses PHP’spassword_hash() function with PASSWORD_DEFAULT.
Create User
User’s first name (up to 20 characters)
User’s last name (up to 20 characters)
Username (2-64 alphanumeric characters, must be unique)
User’s email address (up to 64 characters, must be unique and valid format)
New password (minimum 6 characters)
Password confirmation (must match
user_password_new)Returns HTML alert with message: “La cuenta ha sido creada con éxito.”
Returns HTML alert with error message if:
- Any required field is empty
- Password is less than 6 characters
- Passwords don’t match
- Username is not 2-64 alphanumeric characters
- Email format is invalid
- Username or email already exists in the system
Requires PHP 5.5.0+ or uses password compatibility library for older PHP versions. Passwords are hashed using
password_hash() before storage.Update User
User ID to update
Updated first name
Updated last name
Updated username (2-64 alphanumeric characters)
Updated email address (valid email format, up to 64 characters)
Returns HTML alert with message: “La cuenta ha sido modificada con éxito.”
Returns HTML alert with error message if validation fails
This endpoint does NOT update the password. Use the “Update Password” endpoint to change passwords.
Update Password
User ID whose password will be updated
New password
Password confirmation (must match
user_password_new3)Returns HTML alert with message: “contraseña ha sido modificada con éxito.”
Returns HTML alert with error message if:
- User ID is empty
- Password fields are empty
- Passwords don’t match
The password is hashed using
password_hash() with PASSWORD_DEFAULT before being stored in the database.Update Profile Settings
Company name (up to 150 characters)
Company phone number (up to 20 characters)
Company email address (up to 64 characters)
Tax/IVA percentage (e.g., 13 for 13%)
Currency symbol (up to 6 characters, e.g., ”$”, ”€”)
Company address (up to 255 characters)
City (up to 100 characters)
State/province (up to 100 characters)
Postal/ZIP code (up to 100 characters)
Returns HTML alert with message: “Datos han sido actualizados satisfactoriamente.”
Returns HTML alert with error message if any required field is empty
This endpoint updates the company profile settings (stored in the
perfil table with id_perfil=1). These settings are used system-wide for invoice generation and display.Search Users
Must be set to
"ajax" to trigger searchSearch term to filter users by first name or last name. Leave empty to return all users.
Page number for pagination (default: 1, 10 results per page)
Returns HTML table with user data including:
user_id- User IDfirstname+lastname- Full nameuser_name- Usernameuser_email- Email addressdate_added- Date added (formatted as d/m/Y)- Action buttons for edit, change password, and delete
Delete User
User ID to delete
Returns success alert if user is deleted successfully
Returns error alert if:
- Attempting to delete user ID 1 (admin user)
- Database error occurs
