Skip to main content

Overview

Admin trip management APIs allow administrators to oversee trip operations, manage bookings, handle cancellations, and assign replacement drivers. All endpoints require AdminPolicy authorization.

Get Cancelled Trips

Retrieve all cancelled trips with optional filtering.
curl -X GET "https://api.masareagle.com/api/admin/trips/cancellations?page=1&pageSize=50" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Query Parameters

driverId
string
Filter by driver ID
from
string
Filter by origin city
to
string
Filter by destination city
cancelledFrom
string
Filter by cancellation date (from)
cancelledTo
string
Filter by cancellation date (to)
departureFrom
string
Filter by departure date (from)
departureTo
string
Filter by departure date (to)
page
integer
default:"1"
Page number
pageSize
integer
default:"50"
Number of results per page

Response

success
boolean
Operation status
message
string
Status message
trips
array
Array of cancelled trip information
totalCount
integer
Total number of cancelled trips
page
integer
Current page number
pageSize
integer
Results per page
totalPages
integer
Total number of pages

Cancel Trip (Admin)

Administrators can cancel any trip with a reason.
curl -X POST "https://api.masareagle.com/api/admin/trips/{tripId}/cancel" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Driver unavailable due to emergency"
  }'

Path Parameters

tripId
string
required
Trip identifier

Body Parameters

reason
string
required
Reason for cancellation

Response

success
boolean
Operation status
message
string
Status message
tripId
string
Cancelled trip identifier

Get Trip Booking Requests

Retrieve all booking requests for a specific trip.
curl -X GET "https://api.masareagle.com/api/admin/trips/{tripId}/requests?status=pending" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Path Parameters

tripId
string
required
Trip identifier

Query Parameters

status
string
Filter by booking status (pending, confirmed, cancelled)

Accept Booking Request

Accept a pending booking request for a trip.
curl -X POST "https://api.masareagle.com/api/admin/trips/{tripId}/requests/{bookingId}/accept" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "notes": "Approved by admin - special case"
  }'

Path Parameters

tripId
string
required
Trip identifier
bookingId
string
required
Booking identifier

Body Parameters

notes
string
Admin notes about the acceptance

Reject Booking Request

Reject a pending booking request for a trip.
curl -X POST "https://api.masareagle.com/api/admin/trips/{tripId}/requests/{bookingId}/reject" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Trip is full"
  }'

Path Parameters

tripId
string
required
Trip identifier
bookingId
string
required
Booking identifier

Body Parameters

reason
string
Reason for rejection

Add Passenger to Trip

Directly add a passenger to a trip without going through the booking request flow.
curl -X POST "https://api.masareagle.com/api/admin/trips/{tripId}/passengers" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "passengerId": "pass123",
    "requestedSeatsCount": 2,
    "paymentMethod": "Cash",
    "notes": "VIP customer"
  }'

Path Parameters

tripId
string
required
Trip identifier

Body Parameters

passengerId
string
required
Passenger identifier
requestedSeatsCount
integer
required
Number of seats to book
paymentMethod
string
default:"Cash"
Payment method (Cash, Wallet, Moyasar, BankTransfer)
notes
string
Admin notes about the booking

Remove Passenger from Trip

Remove a passenger from a trip.
curl -X DELETE "https://api.masareagle.com/api/admin/trips/{tripId}/passengers/{passengerId}?reason=Passenger%20requested%20cancellation" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Path Parameters

tripId
string
required
Trip identifier
passengerId
string
required
Passenger identifier

Query Parameters

reason
string
Reason for removal

Replace Trip with New Driver

Create a new trip with a different driver to replace a cancelled trip. All confirmed bookings are transferred.
curl -X POST "https://api.masareagle.com/api/admin/trips/{tripId}/replace-with-driver" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "newDriverId": "drv456",
    "vehicleId": "veh789",
    "transferAllBookings": true,
    "notes": "Original driver unavailable"
  }'

Path Parameters

tripId
string
required
Cancelled trip identifier

Body Parameters

newDriverId
string
required
New driver identifier
vehicleId
string
required
Vehicle identifier for the new trip
transferAllBookings
boolean
default:"true"
Whether to transfer all confirmed bookings to the new trip
notes
string
Admin notes about the replacement

Replace Trip with Existing Trip

Transfer bookings from a cancelled trip to an existing scheduled trip.
curl -X POST "https://api.masareagle.com/api/admin/trips/{tripId}/replace-with-trip" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "replacementTripId": "trip999",
    "transferAllBookings": true,
    "notes": "Merged with another trip"
  }'

Path Parameters

tripId
string
required
Cancelled trip identifier

Body Parameters

replacementTripId
string
required
Existing trip identifier to receive the bookings
transferAllBookings
boolean
default:"true"
Whether to transfer all confirmed bookings
notes
string
Admin notes about the replacement

Get Replacement Options

Get matching trips and available drivers for replacing a cancelled trip.
curl -X GET "https://api.masareagle.com/api/admin/trips/{tripId}/replacement-options" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Path Parameters

tripId
string
required
Cancelled trip identifier

Response

Returns matching trips (same route) and available drivers (no overlapping trips) that can replace the cancelled trip.

Get Available Drivers

Get available drivers who can replace a cancelled trip, with optional search.
curl -X GET "https://api.masareagle.com/api/admin/trips/{tripId}/available-drivers?searchNameOrPhone=Ahmed" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Path Parameters

tripId
string
required
Cancelled trip identifier

Query Parameters

searchNameOrPhone
string
Search by driver name or phone number

Response

Returns available drivers (active, approved, no overlapping trips) with vehicles that have enough seats.

Delete Cancelled Trip

Permanently delete a cancelled trip (logical deletion).
curl -X DELETE "https://api.masareagle.com/api/admin/trips/{tripId}" \
  -H "Authorization: Bearer YOUR_ADMIN_TOKEN"

Path Parameters

tripId
string
required
Cancelled trip identifier
Only cancelled trips can be deleted. This performs a logical deletion, not a hard delete from the database.

Build docs developers (and LLMs) love