User Profile
Manage the authenticated user's account profile details and avatar image.
Authentication
All endpoints in the Profile module require a valid Bearer JWT access token passed in the Authorization header:
Profile Endpoints Overview
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/v1/profile |
Retrieve user profile information | Bearer JWT |
| PUT | /api/v1/profile |
Update user profile information | Bearer JWT |
| POST | /api/v1/profile/image-upload |
Upload profile image (multipart) | Bearer JWT |
Endpoint Details
1. Get User Profile
GET
/api/v1/profile
Bearer Token Required
Retrieves the currently authenticated user's complete profile record.
Headers
| Header | Value | Required | Description |
|---|---|---|---|
Authorization |
Bearer <access_token> |
Required | Valid user access token |
Accept |
application/json |
Optional | Expected response format |
Request Examples
Response
2. Update User Profile
PUT
/api/v1/profile
Bearer Token Required
Updates profile information for the authenticated account.
Query / Form Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
firstName |
string | Optional | User's given name |
lastName |
string | Optional | User's family name |
mobile |
string | Optional | User's mobile phone number |
faxNumber |
string | Optional | User's fax contact number |
streetAddress |
string | Optional | Street address line |
city |
string | Optional | City or municipality |
postCode |
string | Optional | Postal / ZIP code |
gender |
string | Optional | Gender identity (Male, Female, Other) |
Headers
| Header | Value | Required | Description |
|---|---|---|---|
Authorization |
Bearer <access_token> |
Required | Valid user access token |
Request Examples
val response = client.put("http://localhost:8080/api/v1/profile") {
header(HttpHeaders.Authorization, "Bearer $accessToken")
parameter("firstName", "Mehedi")
parameter("lastName", "Hassan")
parameter("mobile", "01812353930")
parameter("city", "Dhaka")
parameter("postCode", "1205")
parameter("gender", "Male")
}
val updatedProfile: UserProfile = response.body()
const params = new URLSearchParams({
firstName: "Mehedi",
lastName: "Hassan",
mobile: "01812353930",
city: "Dhaka",
postCode: "1205",
gender: "Male"
});
const response = await fetch(`http://localhost:8080/api/v1/profile?${params.toString()}`, {
method: "PUT",
headers: {
"Authorization": `Bearer ${accessToken}`,
"Accept": "application/json"
}
});
const updatedProfile = await response.json();
Response
3. Upload Profile Image
POST
/api/v1/profile/image-upload
Bearer Token Required
Uploads a new avatar image for the authenticated user.
Multipart Form Data
| Field | Type | Required | Description |
|---|---|---|---|
image |
binary file | Required | Supported formats: image/jpeg, image/png, image/webp (.jpg, .jpeg, .png, .webp). Maximum size: 5 MB. |
Headers
| Header | Value | Required | Description |
|---|---|---|---|
Authorization |
Bearer <access_token> |
Required | Valid user access token |
Content-Type |
multipart/form-data |
Required | Multipart boundary header |
Request Examples
val response = client.submitFormWithBinaryData(
url = "http://localhost:8080/api/v1/profile/image-upload",
formData = formData {
append("image", fileBytes, Headers.build {
append(HttpHeaders.ContentType, "image/jpeg")
append(HttpHeaders.ContentDisposition, "filename=\"profile.jpg\"")
})
}
) {
header(HttpHeaders.Authorization, "Bearer $accessToken")
}
val uploadedUrl: String = response.body()
Response
Error Handling
Centralized Error Handling Architecture
All profile endpoints return standardized error structures and HTTP status codes. For the complete reference of status codes (400, 401, 403, 404, 500), validation error formats, and retry guidelines, see the Error Handling & Status Codes Guide.