Skip to main content

Create Driver Trip

Creates a new trip listing by a driver. The trip includes origin, destination, departure time, pricing, and available seats.
curl -X POST "https://api.masareagles.com/api/trips" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "from": "Riyadh",
    "fromLatitude": 24.7136,
    "fromLongitude": 46.6753,
    "fromAddress": "King Fahd Road",
    "fromDescription": "Near Faisaliah Tower",
    "to": "Jeddah",
    "toLatitude": 21.5433,
    "toLongitude": 39.1728,
    "toAddress": "Tahlia Street",
    "toDescription": "Near Red Sea Mall",
    "departureTimeUtc": "2026-03-15T08:00:00Z",
    "arrivalTimeUtc": "2026-03-15T16:00:00Z",
    "availableSeatCount": 3,
    "price": 150.00,
    "currency": "SAR",
    "vehicleId": "veh_abc123",
    "driverId": "drv_xyz789",
    "description": "Comfortable highway trip with AC",
    "stops": [
      {
        "location": "Buraydah",
        "latitude": 26.3260,
        "longitude": 43.9751,
        "address": "Buraydah Central",
        "stopTimeUtc": "2026-03-15T10:00:00Z",
        "stopOrder": 1,
        "description": "Rest stop - 15 minutes"
      }
    ]
  }'

Endpoint

method
string
required
POST
url
string
required
/api/trips

Request Body

from
string
required
Departure city/location name (max 200 characters)
fromLatitude
decimal
Latitude coordinate of departure location
fromLongitude
decimal
Longitude coordinate of departure location
fromAddress
string
Detailed address of departure point (max 500 characters)
fromDescription
string
Additional description or landmark for departure (max 500 characters)
to
string
required
Destination city/location name (max 200 characters)
toLatitude
decimal
Latitude coordinate of destination
toLongitude
decimal
Longitude coordinate of destination
toAddress
string
Detailed address of destination (max 500 characters)
toDescription
string
Additional description or landmark for destination (max 500 characters)
departureTimeUtc
string
required
Trip departure date and time in UTC (ISO 8601 format)
arrivalTimeUtc
string
Expected arrival date and time in UTC (ISO 8601 format)
availableSeatCount
integer
required
Number of available seats (1-1000)
price
decimal
required
Price per seat (must be greater than 0)
currency
string
Currency code (e.g., “SAR”, “USD”) - max 20 characters
vehicleId
string
required
ID of the vehicle to be used for the trip
driverId
string
required
ID of the driver offering the trip
description
string
Trip description and additional notes (max 1000 characters)
stops
array
Array of intermediate stops along the route

Response

success
boolean
Indicates if the trip was created successfully
message
string
Success or error message in Arabic
data
object
Trip details object
{
  "success": true,
  "message": "تم إنشاء الرحلة بنجاح",
  "data": {
    "id": "trip_abc123xyz",
    "from": "Riyadh",
    "fromLatitude": 24.7136,
    "fromLongitude": 46.6753,
    "fromAddress": "King Fahd Road",
    "to": "Jeddah",
    "toLatitude": 21.5433,
    "toLongitude": 39.1728,
    "toAddress": "Tahlia Street",
    "departureTimeUtc": "2026-03-15T08:00:00Z",
    "arrivalTimeUtc": "2026-03-15T16:00:00Z",
    "availableSeatCount": 3,
    "reservedSeatCount": 0,
    "totalSeats": 3,
    "price": 150.00,
    "currency": "SAR",
    "currencyCode": "SAR",
    "vehicleId": "veh_abc123",
    "driverId": "drv_xyz789",
    "description": "Comfortable highway trip with AC",
    "status": "Scheduled",
    "stops": [
      {
        "id": "stop_123",
        "location": "Buraydah",
        "latitude": 26.3260,
        "longitude": 43.9751,
        "address": "Buraydah Central",
        "stopTimeUtc": "2026-03-15T10:00:00Z",
        "stopOrder": 1,
        "description": "Rest stop - 15 minutes"
      }
    ],
    "createdAtUtc": "2026-03-10T10:30:00Z"
  }
}

Create Company Trip Route

Creates a new trip route for a transportation company. This creates a template route that can be booked multiple times. Each booking creates an independent trip instance.
curl -X POST "https://api.masareagles.com/api/companies/{companyId}/trips" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "fromCityId": "city_riyadh",
    "fromCity": "Riyadh",
    "fromLatitude": 24.7136,
    "fromLongitude": 46.6753,
    "fromAddress": "King Khalid International Airport",
    "toCityId": "city_dammam",
    "toCity": "Dammam",
    "toLatitude": 26.4207,
    "toLongitude": 50.0888,
    "toAddress": "King Fahd International Airport",
    "availabilityCount": 10,
    "price": 200.00,
    "currency": "SAR",
    "vehicleTypeId": "vtype_luxury",
    "assignedDriverId": "drv_comp123",
    "availabilityDate": "2026-03-15T00:00:00Z"
  }'

Endpoint

method
string
required
POST
url
string
required
/api/companies/{companyId}/trips
companyId
string
required
Company identifier

Request Body

fromCityId
string
Origin city identifier
fromCity
string
required
Origin city name (max 255 characters)
fromLatitude
decimal
Latitude of origin
fromLongitude
decimal
Longitude of origin
fromAddress
string
Detailed origin address (max 500 characters)
toCityId
string
Destination city identifier
toCity
string
required
Destination city name (max 255 characters)
toLatitude
decimal
Latitude of destination
toLongitude
decimal
Longitude of destination
toAddress
string
Detailed destination address (max 500 characters)
availabilityCount
integer
required
Number of times this route can be booked (1-1000). Each booking decrements this count.
price
decimal
required
Trip price (0.01 - 999999.99)
currency
string
Currency code (default: “SAR”, max 10 characters)
vehicleTypeId
string
Vehicle type identifier for this route
assignedDriverId
string
Driver assigned to this route
availabilityDate
string
Date when this route becomes available for booking

Response

success
boolean
Indicates if trip route was created successfully
message
string
Success or error message
data
object
Company trip route details
{
  "success": true,
  "message": "تم إنشاء مسار الرحلة بنجاح",
  "data": {
    "tripId": "comptrip_abc123",
    "message": "تم إنشاء مسار الرحلة بنجاح",
    "trip": {
      "id": "comptrip_abc123",
      "companyId": "comp_xyz789",
      "fromCityId": "city_riyadh",
      "fromCity": "Riyadh",
      "fromLatitude": 24.7136,
      "fromLongitude": 46.6753,
      "fromAddress": "King Khalid International Airport",
      "toCityId": "city_dammam",
      "toCity": "Dammam",
      "toLatitude": 26.4207,
      "toLongitude": 50.0888,
      "toAddress": "King Fahd International Airport",
      "availabilityCount": 10,
      "currentBookings": 0,
      "remainingAvailability": 10,
      "isAvailableForBooking": true,
      "price": 200.00,
      "currency": "SAR",
      "vehicleTypeId": "vtype_luxury",
      "assignedDriverId": "drv_comp123",
      "status": "Active",
      "isActive": true,
      "availabilityDate": "2026-03-15T00:00:00Z",
      "createdAtUtc": "2026-03-10T10:30:00Z",
      "updatedAtUtc": "2026-03-10T10:30:00Z"
    }
  }
}

Create Company Public Trip

Creates a scheduled public trip where passengers book individual seats. Driver and vehicle are assigned at creation time.
curl -X POST "https://api.masareagles.com/api/companies/{companyId}/public-trips" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "driverId": "drv_comp456",
    "vehicleId": "veh_bus789",
    "fromCityId": "city_makkah",
    "fromCity": "Makkah",
    "fromLatitude": 21.4225,
    "fromLongitude": 39.8262,
    "fromAddress": "Makkah Central Station",
    "toCityId": "city_madinah",
    "toCity": "Madinah",
    "toLatitude": 24.5247,
    "toLongitude": 39.5692,
    "toAddress": "Madinah Bus Terminal",
    "seatCount": 45,
    "pricePerSeat": 80.00,
    "currency": "SAR",
    "departureTimeUtc": "2026-03-20T06:00:00Z",
    "arrivalTimeUtc": "2026-03-20T10:30:00Z",
    "description": "Direct express service with rest stop",
    "stops": [
      {
        "location": "Bahra",
        "latitude": 22.8167,
        "longitude": 39.5833,
        "stopTimeUtc": "2026-03-20T08:00:00Z",
        "stopOrder": 1,
        "description": "15-minute break"
      }
    ]
  }'

Endpoint

method
string
required
POST
url
string
required
/api/companies/{companyId}/public-trips
companyId
string
required
Company identifier

Request Body

driverId
string
required
Assigned driver identifier
vehicleId
string
required
Assigned vehicle identifier
seatCount
integer
required
Total number of available seats
pricePerSeat
decimal
required
Price per individual seat
departureTimeUtc
string
required
Scheduled departure time in UTC
arrivalTimeUtc
string
Expected arrival time in UTC
Includes all the same location parameters as company trip routes (fromCity, toCity, coordinates, addresses).

Response

success
boolean
Indicates if public trip was created successfully
tripId
string
Unique public trip identifier
message
string
Success or error message
{
  "success": true,
  "message": "تم إنشاء الرحلة العامة بنجاح",
  "data": {
    "tripId": "pubtrip_xyz789",
    "message": "تم إنشاء الرحلة العامة بنجاح",
    "departureTimeUtc": "2026-03-20T06:00:00Z",
    "availableSeats": 45,
    "pricePerSeat": 80.00,
    "currency": "SAR"
  }
}

Build docs developers (and LLMs) love