Update Booking
curl --request PUT \
--url https://your-site.com/wp-json/latepoint-api/v1/bookings/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"service_id": 123,
"agent_id": 123,
"location_id": 123,
"start_date": "<string>",
"start_time": "<string>",
"duration": 123,
"status": "<string>",
"customer_id": 123,
"customer.first_name": "<string>",
"customer.last_name": "<string>",
"customer.email": "<string>",
"customer.phone": "<string>",
"price": "<string>",
"notes": "<string>",
"send_notification": true
}
'import requests
url = "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}"
payload = {
"service_id": 123,
"agent_id": 123,
"location_id": 123,
"start_date": "<string>",
"start_time": "<string>",
"duration": 123,
"status": "<string>",
"customer_id": 123,
"customer.first_name": "<string>",
"customer.last_name": "<string>",
"customer.email": "<string>",
"customer.phone": "<string>",
"price": "<string>",
"notes": "<string>",
"send_notification": True
}
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
service_id: 123,
agent_id: 123,
location_id: 123,
start_date: '<string>',
start_time: '<string>',
duration: 123,
status: '<string>',
customer_id: 123,
'customer.first_name': '<string>',
'customer.last_name': '<string>',
'customer.email': '<string>',
'customer.phone': '<string>',
price: '<string>',
notes: '<string>',
send_notification: true
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'service_id' => 123,
'agent_id' => 123,
'location_id' => 123,
'start_date' => '<string>',
'start_time' => '<string>',
'duration' => 123,
'status' => '<string>',
'customer_id' => 123,
'customer.first_name' => '<string>',
'customer.last_name' => '<string>',
'customer.email' => '<string>',
'customer.phone' => '<string>',
'price' => '<string>',
'notes' => '<string>',
'send_notification' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}"
payload := strings.NewReader("{\n \"service_id\": 123,\n \"agent_id\": 123,\n \"location_id\": 123,\n \"start_date\": \"<string>\",\n \"start_time\": \"<string>\",\n \"duration\": 123,\n \"status\": \"<string>\",\n \"customer_id\": 123,\n \"customer.first_name\": \"<string>\",\n \"customer.last_name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.phone\": \"<string>\",\n \"price\": \"<string>\",\n \"notes\": \"<string>\",\n \"send_notification\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"service_id\": 123,\n \"agent_id\": 123,\n \"location_id\": 123,\n \"start_date\": \"<string>\",\n \"start_time\": \"<string>\",\n \"duration\": 123,\n \"status\": \"<string>\",\n \"customer_id\": 123,\n \"customer.first_name\": \"<string>\",\n \"customer.last_name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.phone\": \"<string>\",\n \"price\": \"<string>\",\n \"notes\": \"<string>\",\n \"send_notification\": true\n}")
.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::Put.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_id\": 123,\n \"agent_id\": 123,\n \"location_id\": 123,\n \"start_date\": \"<string>\",\n \"start_time\": \"<string>\",\n \"duration\": 123,\n \"status\": \"<string>\",\n \"customer_id\": 123,\n \"customer.first_name\": \"<string>\",\n \"customer.last_name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.phone\": \"<string>\",\n \"price\": \"<string>\",\n \"notes\": \"<string>\",\n \"send_notification\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "error",
"error": {
"code": "booking_not_found",
"message": "Booking with ID 123 was not found"
}
}
{
"status": "error",
"error": {
"code": "time_slot_unavailable",
"message": "The new time slot is not available",
"details": {
"requested_time": "2024-01-25 16:00",
"agent_id": 3,
"conflicting_booking_id": 156,
"available_slots": [
"2024-01-25 17:00",
"2024-01-25 18:00"
]
}
}
}
{
"status": "error",
"error": {
"code": "validation_failed",
"message": "The provided data failed validation",
"details": {
"start_date": "Date cannot be in the past",
"customer.email": "Invalid email",
"status": "Invalid status for this booking"
}
}
}
{
"status": "error",
"error": {
"code": "invalid_request",
"message": "Invalid input data",
"details": {
"service_id": "The specified service does not exist",
"agent_id": "The specified agent does not exist"
}
}
}
Bookings
Update Booking
Updates an existing booking
PUT
/
wp-json
/
latepoint-api
/
v1
/
bookings
/
{id}
Update Booking
curl --request PUT \
--url https://your-site.com/wp-json/latepoint-api/v1/bookings/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <x-api-key>' \
--data '
{
"service_id": 123,
"agent_id": 123,
"location_id": 123,
"start_date": "<string>",
"start_time": "<string>",
"duration": 123,
"status": "<string>",
"customer_id": 123,
"customer.first_name": "<string>",
"customer.last_name": "<string>",
"customer.email": "<string>",
"customer.phone": "<string>",
"price": "<string>",
"notes": "<string>",
"send_notification": true
}
'import requests
url = "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}"
payload = {
"service_id": 123,
"agent_id": 123,
"location_id": 123,
"start_date": "<string>",
"start_time": "<string>",
"duration": 123,
"status": "<string>",
"customer_id": 123,
"customer.first_name": "<string>",
"customer.last_name": "<string>",
"customer.email": "<string>",
"customer.phone": "<string>",
"price": "<string>",
"notes": "<string>",
"send_notification": True
}
headers = {
"X-API-Key": "<x-api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<x-api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
service_id: 123,
agent_id: 123,
location_id: 123,
start_date: '<string>',
start_time: '<string>',
duration: 123,
status: '<string>',
customer_id: 123,
'customer.first_name': '<string>',
'customer.last_name': '<string>',
'customer.email': '<string>',
'customer.phone': '<string>',
price: '<string>',
notes: '<string>',
send_notification: true
})
};
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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'service_id' => 123,
'agent_id' => 123,
'location_id' => 123,
'start_date' => '<string>',
'start_time' => '<string>',
'duration' => 123,
'status' => '<string>',
'customer_id' => 123,
'customer.first_name' => '<string>',
'customer.last_name' => '<string>',
'customer.email' => '<string>',
'customer.phone' => '<string>',
'price' => '<string>',
'notes' => '<string>',
'send_notification' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}"
payload := strings.NewReader("{\n \"service_id\": 123,\n \"agent_id\": 123,\n \"location_id\": 123,\n \"start_date\": \"<string>\",\n \"start_time\": \"<string>\",\n \"duration\": 123,\n \"status\": \"<string>\",\n \"customer_id\": 123,\n \"customer.first_name\": \"<string>\",\n \"customer.last_name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.phone\": \"<string>\",\n \"price\": \"<string>\",\n \"notes\": \"<string>\",\n \"send_notification\": true\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<x-api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://your-site.com/wp-json/latepoint-api/v1/bookings/{id}")
.header("X-API-Key", "<x-api-key>")
.header("Content-Type", "application/json")
.body("{\n \"service_id\": 123,\n \"agent_id\": 123,\n \"location_id\": 123,\n \"start_date\": \"<string>\",\n \"start_time\": \"<string>\",\n \"duration\": 123,\n \"status\": \"<string>\",\n \"customer_id\": 123,\n \"customer.first_name\": \"<string>\",\n \"customer.last_name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.phone\": \"<string>\",\n \"price\": \"<string>\",\n \"notes\": \"<string>\",\n \"send_notification\": true\n}")
.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::Put.new(url)
request["X-API-Key"] = '<x-api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"service_id\": 123,\n \"agent_id\": 123,\n \"location_id\": 123,\n \"start_date\": \"<string>\",\n \"start_time\": \"<string>\",\n \"duration\": 123,\n \"status\": \"<string>\",\n \"customer_id\": 123,\n \"customer.first_name\": \"<string>\",\n \"customer.last_name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.phone\": \"<string>\",\n \"price\": \"<string>\",\n \"notes\": \"<string>\",\n \"send_notification\": true\n}"
response = http.request(request)
puts response.read_body{
"status": "error",
"error": {
"code": "booking_not_found",
"message": "Booking with ID 123 was not found"
}
}
{
"status": "error",
"error": {
"code": "time_slot_unavailable",
"message": "The new time slot is not available",
"details": {
"requested_time": "2024-01-25 16:00",
"agent_id": 3,
"conflicting_booking_id": 156,
"available_slots": [
"2024-01-25 17:00",
"2024-01-25 18:00"
]
}
}
}
{
"status": "error",
"error": {
"code": "validation_failed",
"message": "The provided data failed validation",
"details": {
"start_date": "Date cannot be in the past",
"customer.email": "Invalid email",
"status": "Invalid status for this booking"
}
}
}
{
"status": "error",
"error": {
"code": "invalid_request",
"message": "Invalid input data",
"details": {
"service_id": "The specified service does not exist",
"agent_id": "The specified agent does not exist"
}
}
}
Description
This endpoint allows you to update an existing booking. You can modify any booking field, including schedules, status, customer information, and notes.Authentication
string
required
Your LatePoint API Key with write permissions
Path Parameters
integer
required
Unique ID of the booking to update
Request Body
Booking Fields
integer
Service ID (requires availability verification if changed)
integer
Agent ID (requires availability verification if changed)
integer
Location ID
string
New booking date (format: YYYY-MM-DD)
string
New start time (format: HH:MM in 24-hour format)
integer
Custom duration in minutes
string
Booking statusPossible values:
pending- Pendingapproved- Approvedcancelled- Cancelledcompleted- Completedno_show- No show
Customer Information
integer
Change to a different customer (customer ID)
string
Update customer first name
string
Update customer last name
string
Update customer email
string
Update customer phone
Additional Fields
string
Custom price for this booking
string
Public booking notes
boolean
default:"false"
Whether to send notification to customer about changes
Response
Successful Response (200 OK)
string
Response status (“success”)
object
Updated booking object with all fields
Examples
Change Booking Status
curl -X PUT "http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/16" \
-H "X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ" \
-H "Content-Type: application/json" \
-d '{
"start_time": "15:30",
"duration": 90,
"status": "approved",
"notes": "Tiempo extendido por solicitud del cliente"
}'
const bookingId = 123;
const updateData = {
status: 'approved',
send_notification: true
};
const response = await fetch(`http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/${bookingId}`, {
method: 'PUT',
headers: {
'X-API-Key': 'lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ',
'Content-Type': 'application/json'
},
body: JSON.stringify(updateData)
});
const result = await response.json();
console.log(result);
import requests
import json
booking_id = 123
update_data = {
'status': 'approved',
'send_notification': True
}
response = requests.put(
f'http://latepoint-dev.local/wp-json/latepoint-api/v1/bookings/{booking_id}',
headers={
'X-API-Key': 'lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ',
'Content-Type': 'application/json'
},
data=json.dumps(update_data)
)
result = response.json()
print(result)
<?php
$booking_id = 123;
$update_data = [
'status' => 'approved',
'send_notification' => true
];
$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 => 'PUT',
CURLOPT_POSTFIELDS => json_encode($update_data),
CURLOPT_HTTPHEADER => [
'X-API-Key: lp_n1k6BVf3h7JRyjXkWMSoXi0BBZYRaOLL4QohDPQJ',
'Content-Type: application/json'
]
]);
$response = curl_exec($curl);
$result = json_decode($response, true);
curl_close($curl);
print_r($result);
?>
Error Codes
{
"status": "error",
"error": {
"code": "booking_not_found",
"message": "Booking with ID 123 was not found"
}
}
{
"status": "error",
"error": {
"code": "time_slot_unavailable",
"message": "The new time slot is not available",
"details": {
"requested_time": "2024-01-25 16:00",
"agent_id": 3,
"conflicting_booking_id": 156,
"available_slots": [
"2024-01-25 17:00",
"2024-01-25 18:00"
]
}
}
}
{
"status": "error",
"error": {
"code": "validation_failed",
"message": "The provided data failed validation",
"details": {
"start_date": "Date cannot be in the past",
"customer.email": "Invalid email",
"status": "Invalid status for this booking"
}
}
}
{
"status": "error",
"error": {
"code": "invalid_request",
"message": "Invalid input data",
"details": {
"service_id": "The specified service does not exist",
"agent_id": "The specified agent does not exist"
}
}
}
Validations
Automatic Validations
- Availability: If you change date, time or agent, availability is verified
- Valid States: Only allows valid status transitions
- Dates: Does not allow changing to past dates
- Unique Email: Verifies that email is not in use by another customer
- Permissions: Verifies that you have permissions to modify the booking
Status Transition Rules
| Current Status | Allowed States |
|---|---|
pending | approved, cancelled |
approved | completed, cancelled, no_show |
cancelled | pending, approved |
completed | cancelled (special permissions only) |
no_show | approved, cancelled |
Common Use Cases
1. Confirm Pending Booking
// Confirm a booking that was pending
async function confirmBooking(bookingId) {
const response = await fetch(`/wp-json/latepoint-api/v1/bookings/${bookingId}`, {
method: 'PUT',
headers: {
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
status: 'approved',
send_notification: true
})
});
if (response.ok) {
const result = await response.json();
console.log('Booking confirmed:', result.data.booking_code);
return result.data;
}
throw new Error('Error confirming booking');
}
2. Reschedule with Availability Check
// Reschedule a booking by checking availability first
async function rescheduleBooking(bookingId, newDate, newTime, agentId, serviceId) {
// First check availability
const availabilityResponse = await fetch(
`/wp-json/latepoint-api/v1/availability?service_id=${serviceId}&agent_id=${agentId}&date=${newDate}&duration=${duration}`
);
const availability = await availabilityResponse.json();
if (!availability.data.available_slots.includes(newTime)) {
throw new Error('The requested time slot is not available');
}
// Proceed with rescheduling
const response = await fetch(`/wp-json/latepoint-api/v1/bookings/${bookingId}`, {
method: 'PUT',
headers: {
'X-API-Key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
start_date: newDate,
start_time: newTime,
send_notification: true,
notes: 'Rescheduled by customer request'
})
});
return await response.json();
}
⌘I
