Creates a new rental reservation for a vehicle. The system automatically checks vehicle availability for the requested date range before creating the rental.
The rental will be created with a status of RESERVED by default.
Request Body
The ID of the user making the rental reservation
The ID of the vehicle to be rented
Rental start date in ISO 8601 format (YYYY-MM-DD)
Rental end date in ISO 8601 format (YYYY-MM-DD)
Total rental price with up to 2 decimal places
Response
Unique identifier for the rental
The ID of the user who made the reservation
The ID of the rented vehicle
Current rental status. One of:
RESERVED - Rental has been reserved
ACTIVE - Rental is currently active
COMPLETED - Rental has been completed
CANCELLED - Rental has been cancelled
Timestamp when the rental was created (ISO 8601)
Timestamp when the rental was last updated (ISO 8601)
curl -X POST https://api.drivex.com/api/rentals \
-H "Content-Type: application/json" \
-d '{
"userId": 123,
"vehicleId": 456,
"startDate": "2026-03-15",
"endDate": "2026-03-20",
"price": 450.00
}'
201 Created
400 Bad Request
{
"id" : 789 ,
"userId" : 123 ,
"vehicleId" : 456 ,
"startDate" : "2026-03-15" ,
"endDate" : "2026-03-20" ,
"price" : 450.00 ,
"status" : "RESERVED" ,
"createdAt" : "2026-03-01T10:30:00Z" ,
"updatedAt" : "2026-03-01T10:30:00Z"
}