View Profile
This endpoint allows you to retrieve the user's profile information.
Request
Endpoint
- Method: GET
- URL:
/api/users/profile
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
| Authorization | Bearer YOUR_API_TOKEN | Yes |
Success Response
{
"success": true,
"message": "Data has been retrieved successfully",
"data": {
"id": 1,
"name": "John Doe",
"email": "john@example.com",
"avatar": "https://example.com/avatars/user.jpg",
"is_using_apple_private_relay_email": false,
"is_app_rated": true,
"is_app_rated_reminder": true,
"is_subscribed": true,
"profile": {
"phone": "+966500000000",
"gender": "MALE",
"marital_status": "SINGLE",
"date_of_birth": "1990-01-01",
"country_id": 1,
"nationality": 1,
"income_level_id": 2,
"education_level_id": 3,
"language_app": "ENGLISH",
"profile_progress": 80,
"reminders_per_day": 5,
"start_time": "09:00",
"end_time": "21:00",
"background_type": "AUTO"
},
"interests": [
{
"id": 1,
"name": "Technology"
}
],
"hobbies": [
{
"id": 1,
"name": "Reading"
}
]
},
"status_code": 200
}
Error Responses
Unauthorized (401)
{
"success": false,
"message": "Unauthenticated",
"data": null,
"status_code": 401
}
Invalid Token (401)
{
"success": false,
"message": "Invalid token",
"data": null,
"status_code": 401
}
Response Fields
| Field | Type | Description |
|---|---|---|
| id | integer | User's unique identifier |
| name | string | User's full name |
| string | User's email address | |
| avatar | string | URL to user's profile picture |
| is_using_apple_private_relay_email | boolean | Whether user is using Apple's private relay email |
| is_app_rated | boolean | Whether user has rated the app |
| is_app_rated_reminder | boolean | Whether to show app rating reminder |
| is_subscribed | boolean | User's subscription status |
| profile | object | User's detailed profile information |
| profile.phone | string | User's phone number in E.164 format |
| profile.gender | string | User's gender (MALE/FEMALE) |
| profile.marital_status | string | User's marital status (SINGLE/MARRIED/OTHER) |
| profile.date_of_birth | string | User's date of birth (YYYY-MM-DD) |
| profile.country_id | integer | ID of user's country |
| profile.nationality | integer | ID of user's nationality |
| profile.income_level_id | integer | ID of user's income level |
| profile.education_level_id | integer | ID of user's education level |
| profile.language_app | string | Preferred app language (ENGLISH/ARABIC) |
| profile.profile_progress | integer | Profile completion percentage (0-100) |
| profile.reminders_per_day | integer | Number of daily reminders |
| profile.start_time | string | Reminder start time (HH:mm) |
| profile.end_time | string | Reminder end time (HH:mm) |
| profile.background_type | string | Background preference (AUTO/FIXED) |
| interests | array | List of user's selected interests |
| hobbies | array | List of user's selected hobbies |
Example Implementation Flow
- Get the user's API token from storage
- Add token to request header as Bearer token
- Make GET request to
/api/users/profile - Upon success:
- Store user profile data in local state
- Update UI to reflect user information
- Calculate and display profile completion percentage
- Upon error:
- If unauthorized, redirect to login
- Display appropriate error message to user