Auth guards vary by endpoint — JWT users can only access their own record. Admin key has full access.
Overview
User rows are created by the Auth module on firstPOST /auth/token. This module owns everything after creation: profile reads and writes, the onboarding transition, and soft-deletion. Phone number and user ID are immutable once set.
Onboarding Flow
New users start withstatus = ONBOARDING. Calling POST /users/{user_id}/complete_onboarding transitions them to ACTIVE and returns a fresh JWT.
Required fields for complete_onboarding: salutation, first_name, last_name, dob, gender, address, and bank_details (ifsc_code + account_number). email is optional. Submitting these also seeds the user’s accounts and creates the system-managed SELF dependant.
PATCH /users/{user_id} is not part of the onboarding path — an app user can only PATCH once they are ACTIVE. While ONBOARDING, profile fields are submitted through complete_onboarding.Auth Guards by Endpoint
GET /users/{user_id} currently has no owner assertion at the handler or core layer — any authenticated caller who knows a user_id can read that profile. Treat ownership scoping as enforced only on the write and onboarding paths.Searching & Filtering Users
GET /users accepts optional, AND-combined query parameters. All three search
filters are case-insensitive prefix matches (starts-with), not substring.
Prefix means
?name=ravi matches “Ravi” and “Ravikumar” but not “Shravi”.
Search terms are sanitized to alphanumerics + spaces, and must contain at
least 3 alphanumeric characters — shorter or symbol-only terms (e.g. a blank
?name=) are ignored, not treated as match-everything.Endpoints
GET /users
Admin only. Paginated list of users. Filter by
statuses, creation
time_range, and search by name / phone / user_id.GET /users/{user_id}
Fetch a user profile. JWT users can only fetch their own record.
PATCH /users/{user_id}
Partial profile update. Send only changed fields (
first_name, last_name, email, dob, gender, address). App user must be ACTIVE.POST /users/{user_id}/complete_onboarding
Submit required fields and transition
status → ACTIVE. Returns fresh JWT.DELETE /users/{user_id}
Admin only. Soft-delete a user (
status → DEACTIVATED).