Update Profile
Update the current user's profile information.
Endpoint
PUT /api/v1/auth/me/profile
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Content-Type | Yes | application/json |
Request Body
{
"display_name": "Jane Smith",
"profile_image_url": "data:image/png;base64,...",
"profile": {
"bio": "Software developer",
"location": "San Francisco"
}
}
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
display_name | string | No | User's display name |
profile_image_url | string | No | Profile image URL or base64 data URI |
profile | object | No | Additional profile properties (merged into profile JSON) |
Validations
- Display name length validation
- Profile image URL format validation
- Profile JSON schema validation
- Authentication required
Response
Success (200)
{
"success": true,
"data": {
"user_id": 123,
"display_name": "Jane Smith",
"profile_image_url": "https://...",
"profile": {
"bio": "Software developer",
"location": "San Francisco"
},
"updated_at": "2024-01-01T13:00:00Z"
},
"message": "Profile updated successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | PROFILE_UPDATE_FAILED | Profile update failed |
| 401 | UNAUTHORIZED | Invalid or missing token |
| 422 | VALIDATION_ERROR | Request validation failed |
Data Flow
-
Authentication
- Verify access token
- Get current user
-
Validation
- Validate display_name (if provided)
- Validate profile_image_url format (URL or data URI)
- Validate profile JSON structure
-
Profile Update
- Update display_name in User table
- Update profile_image_url
- Merge profile JSON (deep merge with existing)
-
Audit Logging
- Log profile update event
- Record changes made
-
Response
- Return updated profile data
- Include timestamp
Features
- Update display_name
- Update profile_image_url (accepts base64 data URI or URL)
- Merge additional properties into profile JSON column
- Only allows updating display_name, profile_image_url, and profile JSON
- Preserves existing profile data (merge operation)
Example
curl -X PUT https://api.rivergen.com/api/v1/auth/me/profile \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"display_name": "Jane Smith",
"profile_image_url": "https://example.com/avatar.jpg",
"profile": {
"bio": "Software developer"
}
}'
Related Endpoints
- Get Current User - View current profile
- Request Email Update - Change email address