Skip to main content
POST
/
api
/
rentals
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
  }'
{
  "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"
}
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

userId
long
required
The ID of the user making the rental reservation
vehicleId
long
required
The ID of the vehicle to be rented
startDate
string
required
Rental start date in ISO 8601 format (YYYY-MM-DD)
endDate
string
required
Rental end date in ISO 8601 format (YYYY-MM-DD)
price
decimal
required
Total rental price with up to 2 decimal places

Response

id
long
Unique identifier for the rental
userId
long
The ID of the user who made the reservation
vehicleId
long
The ID of the rented vehicle
startDate
string
Rental start date
endDate
string
Rental end date
price
decimal
Total rental price
status
string
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
createdAt
string
Timestamp when the rental was created (ISO 8601)
updatedAt
string
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
  }'
{
  "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"
}

Build docs developers (and LLMs) love