How to cancel a booking as a owner or a customer
Using the /bookings/:id/:action endpoint, you can cancel a booking and make sure that both owner and customer is notified.
Cancelling a booking
Cancelling a 1-on-1 booking (using the confirm_decline
or instant
graphs), is done by sending a PUT request to the /bookings/:id/:action endpoint. It looks something like this:
curl --request PUT \
--url https://api.timekit.io/v2/bookings/58190fc6-1ec0-4ebb-b627-7ce6aa9fc703/cancel \
--header 'Content-Type: application/json' \
--user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7 \
--data '{
"cancel": {
"message": "Sorry, gotta fix the DeLorean"
}
}'
After calling the cancel
action, the booking will enter a cancelled
state and a notification email will be sent to both the owner and customer.
Cancelling a group booking
Cancelling a group booking is very similar to cancelling a 1-on-1 booking. For the owner booking (using the group_owner
graph), it's the exact same process using the /bookings/:id/:action endpoint. After the owner booking has been cancelled, all the customers will receive a notification via email.
Cancelling a customer group booking (using the group_customer
graph) is done with the cancel_by_customer
action, instead of the usual cancel
action, and looks like this:
curl --request PUT \
--url https://api.timekit.io/v2/bookings/58190fc6-1ec0-4ebb-b627-7ce6aa9fc703/cancel_by_customer \
--header 'Content-Type: application/json' \
--user :live_api_key_7nzvc7wsBQQISLeFSVhROys9V1bUJ1z7 \
--data '{
"cancel_by_customer": {
"message": "Sorry, I'm not so (Mc)fly today"
}
}'
After the customer has cancelled the booking, a notification is sent to the owner via email.