Skip to main content

Overview

The Passengers API provides endpoints for managing passenger profiles, account information, and administrative operations. Passengers can view and update their profiles, while admins have access to list and manage all passenger accounts.

Authentication

All endpoints require authentication. Include the JWT token in the Authorization header:
Authorization: Bearer YOUR_JWT_TOKEN

Get Passenger Profile

Get the current authenticated passenger’s profile information.

Response

Id
string
Passenger unique identifier
PhoneNumber
string
Passenger’s phone number
FullName
string
Passenger’s full name
DateOfBirth
date
Date of birth (YYYY-MM-DD format)
Gender
string
Gender: NotSpecified, Male, Female
ProfilePictureUrl
string
URL to profile picture
IsPhoneVerified
boolean
Whether phone number is verified
IsProfileComplete
boolean
Whether profile is complete
IsActive
boolean
Whether account is active
LastLoginAt
datetime
Last login timestamp
OverallRating
decimal
Average rating from drivers
TotalReviewsCount
integer
Total number of reviews received

Example Request

curl -X GET "https://api.masareagles.com/api/passengers/profile" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Example Response

{
  "Id": "p_789012",
  "PhoneNumber": "+966501234567",
  "FullName": "فاطمة أحمد",
  "DateOfBirth": "1995-03-20",
  "Gender": "Female",
  "ProfilePictureUrl": "/uploads/passengers/p_789012/profile.jpg",
  "IsPhoneVerified": true,
  "IsProfileComplete": true,
  "IsActive": true,
  "LastLoginAt": "2024-03-10T14:30:00Z",
  "OverallRating": 4.8,
  "TotalReviewsCount": 45
}

Complete/Update Passenger Profile

Complete or update passenger profile information including name, date of birth, and gender.

Path Parameters

passengerId
string
required
Passenger unique identifier

Request Body

FullName
string
required
Passenger’s full name (2-100 characters)
DateOfBirth
date
Date of birth in YYYY-MM-DD format (passenger must be 13+ years old)
Gender
string
default:"NotSpecified"
Gender: NotSpecified, Male, Female

Response

Message
string
Success message
IsProfileComplete
boolean
Profile completion status

Example Request

curl -X PUT "https://api.masareagles.com/api/passengers/profile/complete-and-update/p_789012" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "FullName": "فاطمة أحمد محمد",
    "DateOfBirth": "1995-03-20",
    "Gender": "Female"
  }'

Example Response

{
  "Message": "تم تحديث الملف الشخصي بنجاح",
  "IsProfileComplete": true
}

List All Passengers (Admin)

Retrieve a paginated list of all passengers with filtering options. Admin only.

Query Parameters

Page
integer
default:"1"
Page number for pagination
PageSize
integer
default:"20"
Number of items per page (max 100)
SearchTerm
string
Search by phone number or full name
IsActive
boolean
Filter by active status
IsProfileComplete
boolean
Filter by profile completion status
IsPhoneVerified
boolean
Filter by phone verification status

Response

Passengers
array
List of passenger summaries
TotalCount
integer
Total number of passengers
Page
integer
Current page number
PageSize
integer
Items per page
TotalPages
integer
Total number of pages

Example Request

curl -X GET "https://api.masareagles.com/api/admin/passengers?Page=1&PageSize=20&IsActive=true" \
  -H "Authorization: Bearer YOUR_ADMIN_JWT_TOKEN"

Get Passenger by ID (Admin)

Retrieve detailed information about a specific passenger. Public endpoint (useful for viewing trip history with deleted passengers).

Path Parameters

passengerId
string
required
Passenger unique identifier

Query Parameters

includeDeleted
boolean
Include soft-deleted passenger data (useful for trip history)

Response

Id
string
Passenger unique identifier
PhoneNumber
string
Phone number
FullName
string
Full name
DateOfBirth
date
Date of birth
Gender
string
Gender
ProfilePictureUrl
string
Profile picture URL
IsPhoneVerified
boolean
Phone verification status
IsProfileComplete
boolean
Profile completion status
IsActive
boolean
Active status
OverallRating
decimal
Average rating
TotalReviewsCount
integer
Total reviews
CreatedAt
datetime
Account creation date
LastLoginAt
datetime
Last login timestamp
IsDeleted
boolean
Soft delete status

Example Request

curl -X GET "https://api.masareagles.com/api/admin/passengers/p_789012?includeDeleted=true" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Update Passenger Status

Update passenger active/inactive status.

Path Parameters

passengerId
string
required
Passenger unique identifier

Query Parameters

IsActive
boolean
required
Set passenger active status (true/false)

Example Request

curl -X PUT "https://api.masareagles.com/api/passengers/p_789012/status?IsActive=true" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Delete Passenger (Admin)

Soft delete a passenger account. Sets IsDeleted=true and IsActive=false. Admin only.

Path Parameters

passengerId
string
required
Passenger unique identifier

Response

Message
string
Success message confirming deletion

Example Request

curl -X DELETE "https://api.masareagles.com/api/admin/passengers/p_789012" \
  -H "Authorization: Bearer YOUR_ADMIN_JWT_TOKEN"

Example Response

{
  "Message": "تم حذف الراكب بنجاح"
}

Upload Profile Picture

Upload or update passenger profile picture.

Request Body (Form Data)

ProfilePicture
file
required
Image file (JPEG, PNG - max 5MB)

Example Request

curl -X POST "https://api.masareagles.com/api/passengers/profile-picture" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -F "[email protected]"

Delete Profile Picture

Delete passenger profile picture.

Example Request

curl -X DELETE "https://api.masareagles.com/api/passengers/profile-picture" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Error Responses

All endpoints may return the following error responses:
message
string
Error message in Arabic or English
errors
array
Detailed validation errors (when applicable)

Common Error Codes

  • 400 Bad Request - Invalid request parameters or validation errors
  • 401 Unauthorized - Missing or invalid authentication token
  • 403 Forbidden - Insufficient permissions
  • 404 Not Found - Passenger not found
  • 500 Internal Server Error - Server error

Example Error Response

{
  "message": "فشل التحقق من صحة البيانات",
  "errors": [
    {
      "field": "FullName",
      "message": "الاسم الكامل مطلوب"
    }
  ]
}

Build docs developers (and LLMs) love