Create a Booking
This endpoint is designed to facilitate the booking process by enabling you to specify details such as the booking time, customer information, associated resources, and any special requirements or notes.
By using this endpoint, you can seamlessly integrate booking functionality into your application and make it easy for customers to reserve appointments, classes, or other scheduled services.
Authentication
This endpoint needs app token for authentication.
Method | POST |
---|---|
Endpoint | v1/bookings |
Headers | Accept: application/json |
Authorization: Bearer <base64_encoded_token> | |
Token type | App |
Query Parameters
This endpoint supports query parameters:
Field | Value | Description |
---|---|---|
include | meta,attributes,app,resources, customers | shows related meta, attributes, resources, customers |
search | start_at,end_at | search bookings with start or end or both |
Request Body:
This endpoint requires following parameters to be sent via post body:
Param Name | Required | Description |
---|---|---|
meta | false | list of additional booking meta in as object with key and value pair |
customer | true | customer object with keys email, last_name, first_name, seats etc... |
resources | true | array or resource uuids |
start | true | start date time of booking |
end | true | end date time of booking |
workflow_id | false | workflow uuid to attach with booking |
scheduler_id | true | scheduler uuid |
event | true | event object with keys color, what, description, location |
Example Request:
The following code shows how to send request to create a booking in Slotify API:
- PHP
- BASH
- JSON
$apiEndpoint = 'https://api.slotify.ca/v1/bookings';
$apiToken = base64_encode("app-token");
$data = array(
"end" => "2024-08-28T10:30:00-04:00",
"start" => "2024-08-28T10:00:00-04:00",
"customer" => array(
"first_name" => "John",
"last_name" => "Doe",
"email" => "[email protected]",
"seats" => 2
),
"scheduler_id" => "a981f0a1-3afa-4dca-8f35-c5a75bf95f28",
"resources" => array(
"52ecb239-0a76-486d-a72d-3d750b987d69"
),
"event" => array(
"what" => "Meeting with Sandip",
"location" => array(
"type" => "google_meet"
),
"description" => "Meeting with John Doe"
)
);
$ch = curl_init($apiEndpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer ' . $apiToken,
'Content-Type: application/json'
));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if(curl_errno($ch)){
echo 'Error: ' . curl_error($ch);
}
curl_close($ch);
echo $response;
curl -X POST \
-H "Authorization: Bearer <APP_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"end": "2024-08-28T10:30:00-04:00",
"start": "2024-08-28T10:00:00-04:00",
"customer": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"seats": 2
},
"scheduler_id": "a981f0a1-3afa-4dca-8f35-c5a75bf95f28",
"resources": [
"52ecb239-0a76-486d-a72d-3d750b987d69"
],
"event": {
"what": "Meeting with Sandip",
"location": {
"type": "google_meet"
},
"description": "Meeting with John Doe"
}
}' \
https://api.slotify.ca/v1/bookings
{
"end": "2024-08-28T10:30:00-04:00",
"start": "2024-08-28T10:00:00-04:00",
"customer": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"seats": 2
},
"scheduler_id": "a981f0a1-3afa-4dca-8f35-c5a75bf95f28",
"resources": [
"52ecb239-0a76-486d-a72d-3d750b987d69"
],
"event": {
"what": "Meeting with Sandip",
"location": {
"type": "google_meet"
},
"description": "Meeting with John Doe"
}
}
Example Response:
The following response will be provided by Slotify server when this endpoint is called:
- 201 Created
- 400 Bad Request
{
"success": true,
"data": {
"uuid": "803481f8-67bf-4046-b5e8-1b175ab211c8",
"graph": "instant",
"status": "confirmed",
"end_at": "2024-09-05T14:00:00+00:00",
"start_at": "2024-09-05T13:00:00+00:00",
"created_at": "2024-09-03T19:25:15+00:00",
"updated_at": "2024-09-03T19:25:15+00:00",
"slot_price": 0,
"is_paid": false,
"slot_capacity": 5,
"scheduler": {
"slug": "instant",
"mode": "round_robin",
"uuid": "28f0b45d-d14f-438f-b59a-833a57a31147",
"name": "Instant Scheduler",
"color": "#84cc16",
"event": {
"what": "Meeting with John Doe",
"location": {
"type": "google_meet"
},
"start_at": "2024-09-03",
"description": "Let's meet online and discuss details"
},
"graph": "instant",
"duration": "1 hours",
"timezone": "America/Toronto",
"unit_price": 0,
"min_notice": "1 days",
"created_at": "2024-09-03T15:51:25+00:00",
"updated_at": "2024-09-03T19:04:27+00:00",
"buffer_time": "0 minutes",
"time_format": null,
"service_flow": "auto",
"slot_capacity": 5,
"booking_window": "4 weeks",
"perday_capacity": 500,
"min_cancellation": "1 days"
}
}
}
{
"success": false,
"errors": {
"scheduler_id": "This field is required",
"transaction_id": "Payment amount does not match with no of booked seats",
"customer": {
"email": "This field is required",
"last_name": "This field is required",
"first_name": "This field is required"
},
"resources": "This field is required",
"end": "This field is required",
"start": "This field is required",
"event": {
"what": "This field is required",
"description": "This field is required",
"location": {
"type": "This field is required"
}
}
}
}