Delete Booking
curl --request DELETE \
--url https://your-site.com/wp-json/latepoint-api/v1/bookings/{id} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"status": "error",
"error": {
"code": "booking_not_found",
"message": "Booking with ID 123 was not found"
}
}
{
"code": "force_required",
"message": "Force deletion is required for confirmed or completed bookings",
"data": {
"status": 400
}
}
{
"status": "error",
"error": {
"code": "insufficient_permissions",
"message": "You do not have permissions to delete bookings",
"details": {
"required_permission": "delete_bookings",
"current_permissions": ["read_bookings", "write_bookings"]
}
}
}
{
"code": "delete_error",
"message": "Error deleting booking",
"data": {
"status": 500
}
}
Bookings
Delete Booking
Delete an existing booking from the system
DELETE
/
wp-json
/
latepoint-api
/
v1
/
bookings
/
{id}
Delete Booking
curl --request DELETE \
--url https://your-site.com/wp-json/latepoint-api/v1/bookings/{id} \
--header 'X-API-Key: <x-api-key>'import requests
url = "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}"
headers = {"X-API-Key": "<x-api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'X-API-Key': '<x-api-key>'}};
fetch('https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"X-API-Key: <x-api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("X-API-Key", "<x-api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}")
.header("X-API-Key", "<x-api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["X-API-Key"] = '<x-api-key>'
response = http.request(request)
puts response.read_body{
"status": "error",
"error": {
"code": "booking_not_found",
"message": "Booking with ID 123 was not found"
}
}
{
"code": "force_required",
"message": "Force deletion is required for confirmed or completed bookings",
"data": {
"status": 400
}
}
{
"status": "error",
"error": {
"code": "insufficient_permissions",
"message": "You do not have permissions to delete bookings",
"details": {
"required_permission": "delete_bookings",
"current_permissions": ["read_bookings", "write_bookings"]
}
}
}
{
"code": "delete_error",
"message": "Error deleting booking",
"data": {
"status": 500
}
}
Description
This endpoint allows you to permanently delete a booking from the system. This action is irreversible and should be used with caution.Irreversible Action: Once deleted, the booking cannot be recovered. Consider using the
cancelled status instead if you need to maintain a historical record.Authentication
Path Parameters
Query Parameters
Response
Successful Response (200 OK)
Examples
Simple Deletion
curl -X DELETE "http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/22" \
-H "X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ"
const bookingId = 123;
const response = await fetch(`https://your-site.com/wp-json/latepoint-api/v1/bookings/${bookingId}`, {
method: 'DELETE',
headers: {
'X-API-Key': 'lp_live_1234567890abcdef'
}
});
const result = await response.json();
console.log(result);
import requests
booking_id = 123
response = requests.delete(
f'https://your-site.com/wp-json/latepoint-api/v1/bookings/{booking_id}',
headers={
'X-API-Key': 'lp_live_1234567890abcdef'
}
)
result = response.json()
print(result)
<?php
$booking_id = 123;
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/{$booking_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => [
'X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ'
]
]);
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
print_r($result);
?>
Forced Deletion
curl -X DELETE "http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/22?force=true" \
-H "X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ"
// Delete an approved or completed booking
const response = await fetch(`https://your-site.com/wp-json/latepoint-api/v1/bookings/123?force=true`, {
method: 'DELETE',
headers: {
'X-API-Key': 'lp_live_1234567890abcdef'
}
});
if (response.ok) {
const result = await response.json();
console.log('Booking deleted successfully');
} else {
const error = await response.json();
console.error('Error:', error.error.message);
}
Example Response
Successful Deletion
{
"success": true,
"message": "Booking deleted successfully"
}
Error Codes
{
"status": "error",
"error": {
"code": "booking_not_found",
"message": "Booking with ID 123 was not found"
}
}
{
"code": "force_required",
"message": "Force deletion is required for confirmed or completed bookings",
"data": {
"status": 400
}
}
{
"status": "error",
"error": {
"code": "insufficient_permissions",
"message": "You do not have permissions to delete bookings",
"details": {
"required_permission": "delete_bookings",
"current_permissions": ["read_bookings", "write_bookings"]
}
}
}
{
"code": "delete_error",
"message": "Error deleting booking",
"data": {
"status": 500
}
}
Deletion Rules
States that Allow Direct Deletion
pending- Pendingcancelled- Cancelled
States that Require force=true
approved- Approvedcompleted- Completed
The current implementation checks for
approved and completed statuses to require force deletion.Important Notes
Deletion vs Cancellation: In most cases, it’s better to cancel a booking (change status to
cancelled) than to delete it permanently.Irrecoverable Data: Once deleted, all booking information is permanently lost. Make sure you have backups if necessary.
Simple Implementation: This endpoint provides basic deletion functionality. Advanced features like customer notifications and audit logging are not currently implemented.
