Profile Management API
Manage user profiles for both clients and lawyers in upLegal.Create Profile
Profiles are automatically created during signup, but this endpoint can be used to ensure profile creation or update during edge cases.
POST /api/profiles
Authentication: Service role key required (server-side only)
Request Body
User ID from Supabase Auth
User email address (normalized to lowercase)
User role:
client or lawyerUser’s first name
User’s last name
Display name (defaults to firstName + lastName or email prefix)
Chilean RUT (for lawyers, must be verified)
Whether the lawyer is verified by Poder Judicial
Example Request
Response
Operation success status
Created or updated profile data
Profile ID (same as user_id)
Associated user ID
User email
First name
Last name
Display name
User role (client or lawyer)
Chilean RUT
Poder Judicial verification status
Whether user has used their free consultation
ISO 8601 timestamp
ISO 8601 timestamp
Error Responses
400 - Missing Fields
500 - Database Error
Verify RUT
Endpoint:POST /verify-rut
Authentication: Not required (public endpoint)
Validates Chilean RUT format and verifier digit.
Request Body
RUT to validate (format: 12345678-9 or 12.345.678-9)
Example Request
Response
Whether the RUT is valid
Validation result message in Spanish
Example Response
200 - Valid RUT
200 - Invalid RUT
Verify Lawyer (PJUD)
Endpoint:POST /verify-lawyer
Authentication: Not required (public endpoint)
Timeout: 15 seconds
Verifies a lawyer’s credentials against the Chilean Poder Judicial database and checks for duplicate registrations.
Request Body
Lawyer’s RUT (format: 12345678-9)
Lawyer’s full name (optional, for additional verification)
Example Request
Response - Verified
Verification status
Result message in Spanish
Example Responses
200 - Verified Lawyer
200 - Not Found
200 - Suspended Lawyer
200 - Duplicate RUT
400 - Invalid Format
408 - Timeout
Profile Fields
Client Profile Fields
user_id: User ID (UUID)email: Email addressfirst_name: First namelast_name: Last namedisplay_name: Display nameavatar_url: Profile picture URLphone: Phone numberhas_used_free_consultation: Free consultation usage flagcreated_at: Account creation timestampupdated_at: Last update timestamp
Lawyer Profile Fields
All client fields plus:rut: Chilean RUT (required for lawyers)pjud_verified: PJUD verification statusspecialties: Array of legal specialtiesbio: Professional bioexperience_years: Years of experiencehourly_rate_clp: Hourly rate in CLPcontact_fee_clp: Contact/consultation feebar_number: Bar association numberuniversity: Law schoolstudy_start_year: Year started law schoolstudy_end_year: Year completed law schooleducation: Education details (JSON)certifications: Certifications (JSON)languages: Spoken languages arraylocation: Practice locationrating: Average rating (0-5)review_count: Number of reviewsverified: Platform verification statusavailable_for_hire: Availability flag
RLS Policies
Profiles Table
- SELECT: Public read access for basic profile info
- INSERT: Service role only (handled during signup)
- UPDATE: Users can update their own profile
- DELETE: Admin only (via service role)