Prompt
How do I handle rescheduling for booked appointments through an API?
Latest observation
Oct 16, 2026
OpenAI APIWeb search: off
To handle rescheduling booked appointments through an API, the usual pattern is:
- Check the appointment can be moved
- Validate the new slot
- Update the appointment record
- Notify affected parties
- Record the change for audit/history
Common API design options
1) Update the existing appointment
Use a PATCH or PUT request to change the appointment time.
Example
PATCH /appointments/{appointmentId}
Content-Type: application/json
{
"startTime": "2026-02-20T14:00:00Z",
"endTime": "2026-02-20T14:30:00Z"
}
This works well if rescheduling is just an attribute update.
2) Use a dedicated reschedule endpoint
This is often cleaner when rescheduling has business rules.
Example
POST /appointments/{appointmentId}/reschedule
Content-Type: application/json
{
"newStartTime": "2026-02-20T14:00:00Z",
"newEndTime": "2026-02-20T14:30:00Z"
}
This is better if you want to:
- enforce special permissions
- trigger notifications
- preserve reschedule history
- run conflict checks atomically
Key checks you should perform
Availability check
Ensure the new slot is free:
- no overlap with another booking
- staff/resource availability
- location or room availability
Policy check
Confirm the appointment can be rescheduled:
- not too close to the start time
- not already completed/cancelled
- only certain users can reschedule
- rescheduling limits or fees
Timezone handling
Always store times in UTC and convert for display. Rescheduling issues often come from timezone mismatches.
Concurrency control
Two users may try to reschedule at once. Use:
- row/version locking
- optimistic concurrency via
ETag/If-Match - transactional update logic
Suggested response codes
200 OKor204 No Content— reschedule succeeded400 Bad Request— invalid time format or missing fields404 Not Found— appointment doesn’t exist409 Conflict— slot unavailable or appointment already changed422 Unprocessable Entity— business rule prevents rescheduling403 Forbidden— user not allowed to reschedule
Example response
{
"id": "apt_123",
"status": "confirmed",
"startTime": "2026-02-20T14:00:00Z",
"endTime": "2026-02-20T14:30:00Z",
"previousStartTime": "2026-02-20T12:00:00Z",
"previousEndTime": "2026-02-20T12:30:00Z",
"rescheduledAt": "2026-02-18T09:15:00Z"
}
Best practice
If rescheduling affects booking availability, treat it like a transaction:
- release old slot
- reserve new slot
- update appointment
- send notifications
All in one atomic operation if possible.
If you want, I can also show:
- a REST API design for rescheduling,
- database transaction logic,
- or example code in Node.js, Python, or .NET.