Check Availability
Check vehicle availability for a specific time period.
Endpoint
INFO
POST /api/v1/dashboard/check-availability
Headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Accept | application/json | Yes |
Authorization | Bearer {token} | Yes |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date | string | Yes | Start datetime (ISO 8601) |
end_date | string | Yes | End datetime (ISO 8601) |
station_id | integer | No | Filter by station |
category | string | No | Filter by vehicle category |
Example Request
bash
curl -X POST https://api.daakey.com/api/v1/dashboard/check-availability \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer {token}" \
-d '{
"start_date": "2024-01-20T10:00:00Z",
"end_date": "2024-01-20T18:00:00Z",
"station_id": 1
}'Response
Success (200)
json
{
"success": true,
"message": "Availability checked",
"data": {
"period": {
"start": "2024-01-20T10:00:00Z",
"end": "2024-01-20T18:00:00Z",
"duration_hours": 8
},
"available_vehicles": [
{
"id": 1,
"plate_number": "ABC-123",
"brand": "Toyota",
"model": "Corolla",
"category": "sedan",
"station": {
"id": 1,
"name": "Downtown Station"
},
"pricing": {
"hourly_rate": 15.00,
"estimated_total": 120.00,
"currency": "USD"
}
},
{
"id": 3,
"plate_number": "DEF-456",
"brand": "Honda",
"model": "Civic",
"category": "sedan",
"station": {
"id": 1,
"name": "Downtown Station"
},
"pricing": {
"hourly_rate": 14.00,
"estimated_total": 112.00,
"currency": "USD"
}
}
],
"unavailable_vehicles": [
{
"id": 2,
"plate_number": "XYZ-789",
"brand": "Honda",
"model": "CR-V",
"reason": "Already booked",
"conflicting_booking": {
"id": 105,
"start": "2024-01-20T08:00:00Z",
"end": "2024-01-20T12:00:00Z"
}
}
],
"summary": {
"total_vehicles": 5,
"available": 3,
"unavailable": 2
}
},
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Notes
- Used to check availability before creating bookings
- Returns pricing estimates based on duration
- Shows conflict reasons for unavailable vehicles