Bookings can be created with contacts, events and line items. When the key booking_package is provided in the request and with the required params, a booking package will be created on the booking. To associate a booking with a contact, read more here.
Without booking package
Create a booking with line items, events and events with line items.
{
"data": {
"type": "bookings",
"attributes": {
"name": "John Smith",
"status": "lead",
"events": [
{
"end_date": "2023-01-01",
"start_date": "2023-01-01",
"name": "Wedding",
"status": "lead",
"expected": 100,
"guaranteed": 75,
"line_items": [
{
"name": "Buffet",
"quantity": 75,
"price": 500,
"tax_ids": [1,2,3],
}
]
}
],
"line_items": [
{
"name": "Projector",
"price": 200,
"quantity": 1,
}
]
}
}
}
With booking package
When the request contains the key booking_package, all events and line items will be created as a booking package on the booking. Any required parameters that are expected by events and line items but are not provided will use expected, guaranteed, start_date, end_date, start_time and end_time from the request. If the attribute quantity_behaviour is not provided on line items, the default will be flat.
If the request contains the key booking_package, the following attributes will be required: expected, guaranteed, start_date, end_date, start_time, end_time.
{
"data": {
"type": "bookings",
"attributes": {
"booking_package": {
"expected": 99,
"guaranteed": 100,
"start_date": "2023-03-30",
"end_date": "2023-03-30",
"start_time": 3600,
"end_time": 7200,
},
"name": "John Smith",
"status": "lead",
"events": [
{
"end_date": "2023-01-01",
"start_date": "2023-01-01",
"name": "Wedding",
"status": "lead",
"expected": 100,
"guaranteed": 75,
"line_items": [
{
"name": "Buffet",
"quantity": 75,
"tax_ids": [1,2,3],
}
]
}
],
"line_items": [
{
"name": "Projector",
"price": 200,
"quantity": 1
"tax_ids": [1,2,3]
}
]
}
}
}