Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Ishaq74/concordia/llms.txt
Use this file to discover all available pages before exploring further.
Profile API
The Profile API allows authenticated users to view and update their profile information. Profiles are automatically created on first access.Authentication
All endpoints require:- Valid user session
- Session cookie or Bearer token
Get user profile
Retrieve the authenticated user’s profile. If no profile exists, one is created automatically. Endpoint:GET /api/profile
Profile UUID
User ID (references auth user table)
User’s full name
User biography/description
Profile picture URL
User location (city, region)
User website URL
Preferred language code:
"fr", "en", "ar", or "es"Profile creation timestamp
Last update timestamp
Update user profile
Update the authenticated user’s profile. Only specified fields are updated. Endpoint:PATCH /api/profile
User’s full name
Biography or description
Profile picture URL
Location (city, region, country)
Personal website URL
Language preference:
"fr", "en", "ar", or "es"Auto-creation behavior
When a user first accesses their profile viaGET /api/profile:
- Profile exists: Returns existing profile
- No profile: Automatically creates one with:
fullNamepopulated from auth user’s namepreferredLanguageset to"fr"(default)- Other fields set to
null
Validation rules
The API validates update requests:- Allowed fields only: Only the 6 editable fields can be updated
- No userId changes: The
userIdfield is immutable - Type checking: Fields must match expected types
- SQL injection prevention: All inputs are parameterized
Response codes
Profile retrieved or updated successfully
Invalid request body (malformed JSON)
Unauthorized - valid session required
Database error or internal server error
Error responses
Implementation reference
Source:/src/pages/api/profile/index.ts
The profile endpoint:
- Uses Better Auth session validation
- Queries the
profiletable with Drizzle ORM - Auto-creates profiles on first GET request
- Validates updates against a whitelist of allowed fields
- Sets security headers (
X-Content-Type-Options: nosniff)
Database schema
The profile table structure:The
preferredLanguage field integrates with the i18n system. When set, the application UI will display in the user’s preferred language across all routes.