Authentication: All endpoints require Authorization: Bearer <access_token>.

Overview

The user row is created by the Auth module on first login. This module reads and writes the profile fields on top of it. The User Profile module does not create users — it only enriches them.

Updatable Fields

first_name · last_name · email · dob · gender · address · occupation · employer

Immutable Fields

phone — identity anchor, set by Auth and never changed. aadhaar_last4 — set via a separate KYC flow; returns 400 if attempted via PATCH.

Endpoints

MethodPathDescription
GET/user/profileFetch authenticated user’s full profile
PATCH/user/profilePartial update — send only fields you want to change

Profile Fields — Field by Field

FieldTypeDescriptionConstraints
user_idUUIDImmutable primary keySet at creation, never changes
phonestring10-digit mobile number, +91 prefix storedImmutable — identity anchor
first_namestringGiven nameMax 255 chars
last_namestringFamily nameMax 255 chars
emailstringEmail addressValid RFC 5322 email format
dobstringDate of birthYYYY-MM-DD; must be in the past; used for insurance age loading
genderstringGender identityMale | Female | Other (see enum below)
addressstringResidential addressFree text; max 500 chars
occupationstringType of gig workEnum — see OccupationType list below
employerstringPlatform / company nameFree text; max 255 chars; e.g. “Namma Yatri”, “Swiggy”
aadhaar_last4stringLast 4 digits of AadhaarSet via separate KYC; returned masked as XXXXXXXX{last4}
profile_completebooleanComputed flagtrue when both first_name and last_name are set

Occupation Types

The occupation field accepts values from the OccupationType enum. These represent the primary gig work segments that Aarokya serves:
ValueDescription
DriverCab / auto driver (Ola, Namma Yatri, Uber, etc.)
Delivery PartnerPackage / food delivery rider (Swiggy, Zomato, Blinkit, etc.)
Domestic WorkerHouse cleaner, cook, nanny, etc.
Construction WorkerDaily-wage construction labourer
Factory WorkerManufacturing / industrial floor worker
Healthcare WorkerNursing aide, health worker, ASHA worker
Retail WorkerKirana store, mall, or shop employee
Security GuardBuilding / premises security
OtherAny gig work not listed above
Occupation is used for analytics and product personalisation (e.g. surfacing plans relevant to outdoor workers vs indoor workers). It is not used for insurance underwriting — NH plans are not occupation-rated.

Gender Enum

ValueNotes
Male
Female
OtherInclusive catch-all for non-binary and prefer-not-to-say

profile_complete Flag — Semantics

The profile_complete boolean is a computed field — not a stored column. It is evaluated on every GET and returned in the response:
profile_complete = (first_name IS NOT NULL AND first_name != '')
               AND (last_name IS NOT NULL AND last_name != '')

What the app does with it

  • is_new_user: true (from /auth/otp/verify) + profile_complete: false → show full onboarding screen with all fields
  • is_new_user: false + profile_complete: false → user previously logged in but never completed their profile; show a lighter prompt
  • profile_complete: true → skip onboarding; go directly to the home screen

Why only name fields?

DOB and gender are required for insurance premium calculation, but they can be collected lazily — at the point when the user actually tries to buy insurance. Requiring all fields before entering the app creates unnecessary friction for users who just want to check their wallet balance or call a doctor.

Transition effect

When profile_complete transitions from false to true (a PATCH that sets both name fields), the app should:
  1. Dismiss the onboarding screen
  2. Persist profile_complete: true in local state to avoid re-checking on every launch
  3. (Optionally) trigger a “welcome” animation or confetti — the user has committed to the product

Onboarding Flow


PII Policy

Aadhaar Masking Logic

The Aadhaar masking is applied in two places:
  1. Client-side (app): The app’s UI collects the full 12-digit Aadhaar number for display purposes, but sends only the last 4 digits to the API. The full number never travels over the network.
  2. Server-side (response): The API always returns Aadhaar in masked format regardless of what is in the database.
FieldWhat client sendsWhat DB storesWhat API returns
AadhaarLast 4 digits onlyaadhaar_last4 = "9012""XXXXXXXX9012"
Phone9876543210 (10 digits)+919876543210+919876543210
EmailPlaintextPlaintextPlaintext
NamePlaintextPlaintextPlaintext
DOBYYYY-MM-DDDATE columnYYYY-MM-DD

Why last-4 only?

Storing the full 12-digit Aadhaar number would classify Aarokya’s database as a sensitive PII repository under DPDP Act 2023, requiring additional data protection compliance. The last 4 digits are sufficient for:
  • Identity confirmation (“does this look like your Aadhaar?”)
  • Basic KYC for insurance — the exact 4-digit suffix is confirmed at claim time by NH

Request / Response Examples

curl http://localhost:8080/user/profile \
  -H 'Authorization: Bearer eyJhbGci...'
curl -X PATCH http://localhost:8080/user/profile \
  -H 'Authorization: Bearer eyJhbGci...' \
  -H 'Content-Type: application/json' \
  -d '{
    "first_name": "Priya",
    "last_name": "Sharma",
    "dob": "1990-05-15",
    "gender": "Female",
    "occupation": "Driver",
    "employer": "Namma Yatri"
  }'

Field Reference

FieldTypeConstraints
first_namestringMax 255 chars
last_namestringMax 255 chars
emailstringValid email format (RFC 5322)
dobstringYYYY-MM-DD, must be a past date
genderstringMale | Female | Other
addressstringFree text, max 500 chars
occupationstringSee OccupationType enum above
employerstringMax 255 chars
Sending phone or aadhaar in the PATCH body will return 400 Bad Request. These are identity fields managed by dedicated flows.