POST
5 min read
Create Booking
POST
/api/v1/bookings
Create a new booking appointment
Create Booking
Create a new booking appointment for a customer.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
company_id |
integer | Yes | The company to create booking for |
customer_name |
string | Yes | Customer name (max 255 chars) |
customer_email |
string | No | Customer email |
customer_phone |
string | No | Customer phone (max 50 chars) |
vehicle_make |
string | No | Vehicle make (max 100 chars) |
vehicle_model |
string | No | Vehicle model (max 100 chars) |
vehicle_year |
integer | No | Vehicle year (1900-2100) |
vehicle_plate |
string | No | Vehicle plate number (max 20 chars) |
service_type |
string | No | Type of service (max 100 chars) |
scheduled_date |
date | Yes | Appointment date (YYYY-MM-DD, must be today or future) |
scheduled_time |
time | Yes | Appointment time (HH:mm) |
duration_minutes |
integer | No | Duration in minutes (15-480, default: 60) |
notes |
string | No | Additional notes |
Example Request
curl -X POST "https://hydra.marketdragon.ph/api/v1/bookings" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"company_id": 1,
"customer_name": "Jane Doe",
"customer_email": "[email protected]",
"customer_phone": "+1987654321",
"vehicle_make": "Honda",
"vehicle_model": "Civic",
"vehicle_year": 2023,
"vehicle_plate": "XYZ 789",
"service_type": "Full Service",
"scheduled_date": "2024-01-25",
"scheduled_time": "14:30",
"duration_minutes": 120,
"notes": "First time customer, referred by John Smith"
}'
Example Response
{
"data": {
"id": 42,
"company_id": 1,
"customer_name": "Jane Doe",
"customer_email": "[email protected]",
"customer_phone": "+1987654321",
"vehicle_make": "Honda",
"vehicle_model": "Civic",
"vehicle_year": 2023,
"vehicle_plate": "XYZ 789",
"service_type": "Full Service",
"scheduled_date": "2024-01-25",
"scheduled_time": "14:30",
"duration_minutes": 120,
"status": "pending",
"notes": "First time customer, referred by John Smith",
"reference_number": "BK8B2D5F1A",
"qr_code_url": "https://hydra.marketdragon.ph/p/acme-auto/booking/660e8400-e29b-41d4-a716-446655440042",
"confirmed_at": null,
"cancelled_at": null,
"created_at": "2024-01-20T10:15:00+00:00",
"updated_at": "2024-01-20T10:15:00+00:00"
}
}
Error Responses
403 Forbidden
{
"message": "You do not have access to this company."
}
422 Validation Error
{
"message": "The scheduled date must be a date after or equal to today.",
"errors": {
"scheduled_date": ["The scheduled date must be a date after or equal to today."],
"customer_name": ["The customer name field is required."]
}
}
Back to Bookings
Was this helpful?