Skip to main content
PUT
/
api
/
agenda
/
bookings
/
{id}
Update Booking
curl --request PUT \
  --url https://api.example.com/api/agenda/bookings/{id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "client_id": "<string>",
  "staff_id": "<string>",
  "item_type": "<string>",
  "item_id": "<string>",
  "status": "<string>",
  "booking_date": "<string>",
  "start_time": "<string>",
  "end_time": "<string>",
  "duration": 123,
  "notes": "<string>"
}
'
{
  "booking_id": "<string>",
  "client_id": "<string>",
  "client": {
    "name": "<string>",
    "surname": "<string>",
    "phone": "<string>"
  },
  "staff_id": {},
  "staff": {
    "name": "<string>",
    "surname": "<string>"
  },
  "item_type": "<string>",
  "item_id": "<string>",
  "status": "<string>",
  "booking_date": "<string>",
  "start_time": "<string>",
  "end_time": "<string>",
  "duration": 123,
  "notes": {},
  "created_at": "<string>",
  "updated_at": "<string>",
  "401 Unauthorized": {},
  "400 Bad Request": {},
  "404 Not Found": {}
}
Updates an existing booking with new information. The endpoint automatically recalculates end_time if start_time or duration are updated.

Authentication

This endpoint requires authentication via Bearer token in the Authorization header or auth_token cookie.
Authorization: Bearer YOUR_TOKEN

Path Parameters

id
string
required
The unique identifier (UUID) of the booking to updateExample: abc123-def456-ghi789

Request Body

All fields are optional. Only include the fields you want to update.
client_id
string
ID of the clientMust be a valid user UUID (100 characters max)
staff_id
string
ID of the staff member assigned to this bookingSet to null to unassign staff. Must be a valid user UUID if provided.
item_type
string
Type of item being bookedAllowed values: service, pack
item_id
string
ID of the service or pack being bookedMust be a valid service or pack UUID (100 characters max)
status
string
Update the booking statusAllowed values:
  • pending: Awaiting confirmation
  • confirmed: Booking confirmed
  • completed: Service completed
  • cancelled: Booking cancelled
  • no_show: Client did not show up
booking_date
string
Reschedule to a different dateFormat: ISO 8601 date string (e.g., 2024-03-15 or 2024-03-15T00:00:00.000Z)
start_time
string
Update the start timeFormat: HH:mm (24-hour format)Example: 09:30, 14:00Note: Updating this will trigger automatic end_time recalculation if duration is present
end_time
string
Explicitly set the end timeFormat: HH:mm (24-hour format)If start_time and duration are both updated, this will be automatically recalculated unless explicitly provided
duration
integer
Update the duration in minutesTriggers automatic end_time recalculation if start_time is also presentExample: 60 for 1 hour, 90 for 1.5 hours
notes
string
Update notes or special instructionsSupports text format, max length based on database TEXT type

Response

Returns the updated booking object with related client and staff information.
booking_id
string
Unique identifier for the booking (UUID)
client_id
string
ID of the client who made the booking
client
object
Client information
staff_id
string | null
ID of the assigned staff member
staff
object | null
Staff member information
item_type
string
Type of booked item: service or pack
item_id
string
ID of the service or pack being booked
status
string
Current booking status
booking_date
string
Date of the booking (ISO 8601 format)
start_time
string
Start time in HH:mm format
end_time
string
End time in HH:mm format
duration
integer
Duration in minutes
notes
string | null
Notes or special instructions
created_at
string
Timestamp when the booking was originally created
updated_at
string
Timestamp when the booking was last updated

Examples

curl -X PUT 'https://api.beils.com/api/agenda/bookings/abc123-def456-ghi789' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "status": "confirmed"
  }'

Response Example

{
  "booking_id": "abc123-def456-ghi789",
  "client_id": "client-uuid-123",
  "client": {
    "name": "María",
    "surname": "García",
    "phone": "+34 600 123 456"
  },
  "staff_id": "staff-uuid-789",
  "staff": {
    "name": "Carlos",
    "surname": "Ruiz"
  },
  "item_type": "service",
  "item_id": "service-uuid-789",
  "status": "confirmed",
  "booking_date": "2024-03-15T00:00:00.000Z",
  "start_time": "10:00",
  "end_time": "11:00",
  "duration": 60,
  "notes": "Confirmed via phone call",
  "created_at": "2024-03-01T08:30:00.000Z",
  "updated_at": "2024-03-05T10:15:00.000Z"
}

Error Responses

401 Unauthorized
error
Missing or invalid authentication token
{
  "statusCode": 401,
  "statusMessage": "Unauthorized: Token is missing or invalid"
}
400 Bad Request
error
Missing or invalid booking ID
{
  "statusCode": 400,
  "statusMessage": "Booking ID is required"
}
404 Not Found
error
Booking with the specified ID does not exist
{
  "statusCode": 404,
  "statusMessage": "Booking not found"
}

Notes

  • The following fields are protected and cannot be updated: booking_id, created_at, updated_at
  • When updating start_time and duration together, the end_time is automatically recalculated
  • The recalculation correctly handles time overflow across midnight
  • If booking_date is provided as a string, it’s automatically converted to a proper Date object
  • Partial updates are supported - only send the fields you want to change
  • The updated_at timestamp is automatically updated on every successful update
  • To unassign a staff member, explicitly set staff_id to null in the request

Build docs developers (and LLMs) love