Overview
User management covers the current user’s profile, admin-facing user CRUD, and the role/group system used to control access throughout the API. Every authenticated user has aUserProfile linked one-to-one to their Django User record. The profile holds extended fields (phone, address, bio, province, etc.) and is created automatically if it does not yet exist when first accessed.
UserProfile model
| Field | Type | Description |
|---|---|---|
user | OneToOne → User | The linked Django user |
phone | string (max 20) | Contact phone number |
address | string (max 255) | Street address |
birth_date | date | Date of birth |
profile_picture | image | Uploaded to profile_pics/ |
bio | text | Short biography |
roles | ManyToMany → Group | Profile-level role assignments |
province | ForeignKey → Provinces | Associated province (nullable) |
created_at | datetime | Auto-set on creation |
updated_at | datetime | Auto-updated on save |
GET /api/auth/profile/
Returns the profile of the currently authenticated user. Creates the profile record automatically if it does not exist.Requires authentication. Include your access token in the
Authorization: Bearer <token> header.Response
The user’s username (read-only, sourced from the linked User).
The user’s email address (read-only, sourced from the linked User).
Contact phone number.
Street address.
Date of birth in
YYYY-MM-DD format.URL to the uploaded profile image.
Short biography.
Profile-level role objects.
Roles assigned directly on the User object (Django groups).
ID of the associated province.
ISO 8601 datetime when the profile was created.
ISO 8601 datetime of the last profile update.
PUT /api/auth/profile/
Updates the current user’s profile. Acceptsmultipart/form-data to support profile picture uploads. All fields are optional (partial update).
Requires authentication.
Request body
Contact phone number (max 20 characters).
Street address (max 255 characters).
Date of birth in
YYYY-MM-DD format.New profile image. Replaces any existing image. Stored under
profile_pics/.Short biography.
Province ID, or the province name as a string. If passed as a string, the API resolves it to the matching province record.
Response
Returns the full updated profile object. Same structure asGET /api/auth/profile/.
GET /api/auth/user_profile/
Returns a list of all user profiles.Requires authentication and the
IsAuthenticatedAndRole permission. Access is restricted to authenticated users; set required_role on the view to limit by group.Response
Returns an array of profile objects with the same structure asGET /api/auth/profile/.
GET /api/auth/user_profile/{id}/
Returns the profile for a specific user by their user ID (not profile ID).Requires authentication.
Path parameters
The Django User primary key.
Response
Returns a single profile object. Same structure asGET /api/auth/profile/.
PUT /api/auth/user_profile/{id}/update/
Updates the profile for a specific user by their user ID. Accepts partial data (all fields optional).Requires authentication and appropriate role access.
Path parameters
The Django User primary key.
Request body
Same fields asPUT /api/auth/profile/ — all optional.
GET /api/auth/users/
Returns a paginated list of all Django users. This is an admin-facing endpoint.Requires authentication via
IsAuthenticatedAndRole. Only accessible to users with the appropriate role (configured via required_role on the view).Response
Returns an array of user objects serialized byRegisterSerializer.
List of group IDs.
Nested profile data if present.
PUT /api/auth/users/{id}/update/
Updates a specific user by their user ID. Admin-facing.Requires authentication and appropriate role access.
Path parameters
The user’s primary key.
Request body
Username.
Email address.
Given name.
Family name.
List of group IDs to assign.
DELETE /api/auth/users/{id}/delete/
Permanently deletes a user account.Requires authentication and appropriate role access.
Path parameters
The user’s primary key.
Roles and permissions
The platform uses Django’s built-in Group model for role management. Every user can belong to one or more groups, which control access to role-restricted endpoints.GET /api/auth/roles/
Lists all available roles (Django groups).Group ID.
Group name.
List of permission IDs assigned to the group.
POST /api/auth/roles/create/
Creates a new role.Requires authentication.
The name for the new role.
PUT /api/auth/permissions/{id}/update/
Replaces the permission set for a role by group ID.Requires authentication and
IsAuthenticatedAndRole.The group ID whose permissions you are updating.
Full list of Django permission IDs to assign to this group. Replaces the existing set.
Password reset flow
The full password reset sequence involves two endpoints:Request a reset token
Call
POST /api/auth/forgot-password/ with the user’s email address. The response contains a uid and token.See forgot password for full details.Submit the new password
Call
POST /api/auth/reset-password-confirm/ with the uid, token, and the new_password.The token is single-use. On success the user’s password is updated and the token is invalidated.See reset password confirm for full details.