intermediate
validation
availability
rentals

Vehicle Validation

Understanding vehicle validation rules - how the system determines if a vehicle is available for rental and what conditions must be met

Levy Fleets TeamJanuary 15, 202512 min read

Vehicle Validation

Vehicle validation is the process that determines whether a vehicle can be rented by a customer. When a customer attempts to scan a vehicle or start a ride, the system performs multiple validation checks to ensure the vehicle is safe, available, and properly configured.

Validation Overview

When Validation Occurs

Vehicle validation happens at several points:

TriggerPurpose
QR Code scanCheck if vehicle can be unlocked
Map tapVerify vehicle is available to rent
Ride startFinal eligibility check before unlocking
During rideOngoing checks (battery, zones)
Ride endVerify ending location is valid

Validation Response

Each validation returns:

  • Success: Vehicle is available, ride can proceed
  • Failure: Vehicle cannot be rented, with reason

Validation Checks

The system performs multiple checks in sequence. All must pass for a vehicle to be available.

1. Vehicle Exists

Check: Does the vehicle exist in the system?

ResultMeaning
PassVehicle found by QR code or ID
FailUnknown vehicle, QR code invalid

Common failures:

  • Invalid or corrupted QR code
  • Vehicle deleted from system
  • Vehicle from different environment (staging vs production)

2. Status Check

Check: Is the vehicle in an available status?

StatusCan Rent?Notes
available✅ YesNormal rental status
available_hidden❌ NoHidden from customers
in_use❌ NoCurrently being rented
maintenance❌ NoUnder repair
offline❌ NoNo IoT connection
not_ready❌ NoNot configured for use
charging❌ NoBattery charging
transportation❌ NoBeing relocated
storage❌ NoIn long-term storage

Available Hidden

The "Available (Hidden)" status allows operators to hide vehicles from customers while keeping them technically rentable for staff testing or special cases.

3. Active Ride Check

Check: Does the vehicle already have an active ride?

ResultMeaning
PassNo active ride on vehicle
FailVehicle currently in use

This prevents double-booking even if status wasn't properly updated.

4. Battery Level Check

Check: Does the vehicle have sufficient battery?

ConfigurationDescription
Minimum batterySubaccount-defined threshold
Typical value15-25%
OverrideStaff rides may bypass

Example: If minimum is set to 20%, a vehicle at 18% battery fails validation.

5. IoT Device Check

Check: Is there a working IoT device attached?

ResultMeaning
PassIoT device linked and communicating
FailNo device or device offline

Vehicles without IoT devices cannot be rented because:

  • Cannot send unlock command
  • Cannot track location during ride
  • Cannot verify ride end

6. Location Validation

Check: Is the vehicle in an allowed zone?

Zone TypeEffect on Validation
Service areaMust be inside to rent
No-ride zoneCannot start ride here
Parking zoneNo effect on start
Slow zoneNo effect on validation

Zone Configuration

If no service area zones are configured, location validation may be skipped. Configure zones appropriately for your market.

7. Subaccount Check

Check: Does the customer have access to this subaccount?

ResultMeaning
PassCustomer can rent from this operator
FailCustomer not authorized for this fleet

This applies when:

  • Multiple operators share an app
  • Customer signed up with a different operator
  • Regional restrictions apply

8. Customer Eligibility

Check: Is the customer allowed to rent?

CheckDescription
Account statusNot suspended or banned
Payment methodValid payment on file
Age verificationMeets minimum age (if required)
Active ride limitNot exceeding concurrent ride limit
Outstanding balanceNo unpaid balances (if configured)

Validation Messages

Success Response

When validation passes:

{
  "valid": true,
  "vehicle": {
    "id": "vehicle-uuid",
    "vehicle_number": "VH-001",
    "battery_level": 85,
    "model": "Levy Max"
  },
  "pricing": {
    "unlock_fee": 1.00,
    "per_minute_rate": 0.35
  }
}

Failure Response

When validation fails:

{
  "valid": false,
  "error_code": "VEHICLE_LOW_BATTERY",
  "message": "This vehicle's battery is too low. Please try another vehicle.",
  "details": {
    "current_battery": 12,
    "minimum_required": 20
  }
}

Common Error Codes

CodeUser MessageCause
VEHICLE_NOT_FOUND"Vehicle not found"Invalid QR/ID
VEHICLE_UNAVAILABLE"Vehicle is not available"Wrong status
VEHICLE_IN_USE"Vehicle is currently in use"Active ride exists
VEHICLE_LOW_BATTERY"Battery too low"Below minimum
VEHICLE_OFFLINE"Vehicle is offline"No IoT connection
OUTSIDE_SERVICE_AREA"Outside service area"Location invalid
CUSTOMER_SUSPENDED"Account suspended"Customer issue
PAYMENT_REQUIRED"Add payment method"No valid payment
RIDE_LIMIT_REACHED"Maximum rides reached"Too many active rides

Configuration Options

Subaccount Settings

Each subaccount can configure validation rules:

SettingDescriptionDefault
Minimum batteryLowest battery % for rentals20%
Require IoTMust have working IoT deviceYes
Check zonesValidate location against zonesYes
Max active ridesConcurrent rides per customer1
Allow hidden vehiclesStaff can rent hidden vehiclesYes

Override Capabilities

Certain roles can bypass validation:

RoleCan Override
Super AdminAll checks
AdminBattery, status
Fleet ManagerBattery, status
Service TechBattery (for testing)
CustomerNone

Real-Time Availability

Map Display

On the customer app map:

  • Only validated-available vehicles appear
  • Vehicles failing any check are hidden
  • Updates in real-time as conditions change

Availability Calculation

The system continuously evaluates:

Available = Status is 'available'
          AND Battery >= Minimum
          AND No active ride
          AND IoT connected
          AND In service area

Troubleshooting Validation

"Vehicle Not Available"

Steps to diagnose:

  1. Check vehicle status in dashboard
  2. Review battery level - is it above minimum?
  3. Check for active rides on the vehicle
  4. Verify IoT device is linked and communicating
  5. Check location - is vehicle in service area?

"Vehicle Not Found"

Possible causes:

  1. QR code damaged - regenerate and replace
  2. Wrong environment - staging vs production
  3. Vehicle deleted - check deleted vehicles
  4. Subaccount mismatch - vehicle in different subaccount

Customer Can't Rent Any Vehicle

Check customer-side issues:

  1. Account status - suspended or banned?
  2. Payment method - valid card on file?
  3. Outstanding balance - unpaid charges?
  4. Verification - age/ID verification needed?
  5. Active rides - at maximum limit?

Validation Passes But Unlock Fails

Validation and unlock are separate:

  1. Validation checks eligibility (database)
  2. Unlock sends command to IoT device

If validation passes but unlock fails:

  • IoT device may be offline (stale status)
  • Command may have timed out
  • Device may have hardware issue

API Reference

Validate Vehicle

POST /api/vehicles/{id}/validate

Request:

{
  "customer_id": "customer-uuid",
  "location": {
    "latitude": 40.7128,
    "longitude": -74.0060
  }
}

Response (success):

{
  "valid": true,
  "vehicle_id": "vehicle-uuid",
  "checks_passed": [
    "status",
    "battery",
    "iot_device",
    "no_active_ride",
    "service_area",
    "customer_eligible"
  ]
}

Response (failure):

{
  "valid": false,
  "error_code": "VEHICLE_LOW_BATTERY",
  "message": "Battery level is below minimum requirement",
  "failed_check": "battery",
  "details": {
    "current": 15,
    "required": 20
  }
}

Check Vehicle Availability (Lightweight)

GET /api/vehicles/{id}/available

Returns simple boolean for map display:

{
  "available": true
}

Best Practices

For Operators

  1. Set appropriate minimums: Balance availability with safety
  2. Monitor failed validations: Track patterns in failures
  3. Keep zones updated: Ensure service areas are accurate
  4. Regular status audits: Verify statuses match reality

For Integration

  1. Handle all error codes: Provide helpful user messages
  2. Cache appropriately: Availability changes frequently
  3. Implement retries: Transient failures may resolve
  4. Log validation results: Useful for debugging

For Customer Experience

  1. Clear error messages: Help customers understand issues
  2. Suggest alternatives: "Try another nearby vehicle"
  3. Real-time updates: Remove unavailable vehicles promptly
  4. Explain requirements: Battery minimums, service areas

Need Help?

For validation configuration or troubleshooting assistance, contact support@levyelectric.com.