Prompt
Scheduling API with webhooks and calendar sync
Latest observation
Oct 16, 2026
OpenAI APIWeb search: off
Here’s a solid Scheduling API with webhooks and calendar sync blueprint you can use as a starting point.
Core features
- Create/update/cancel appointments
- Manage users, staff, resources, and availability
- Prevent double-booking
- Support recurring events
- Webhook notifications for booking lifecycle changes
- Calendar sync with Google Calendar and Microsoft Outlook
- Timezone-safe scheduling
- Idempotent booking creation
Main entities
- User: customer or attendee
- Staff: host/provider
- Resource: room, equipment, etc.
- AvailabilityRule: working hours / blackouts
- Appointment: scheduled event
- CalendarConnection: linked external calendar account
- WebhookSubscription: callback endpoints
Suggested API endpoints
Appointments
POST /appointmentsGET /appointments/{id}GET /appointments?user_id=&staff_id=&from=&to=PATCH /appointments/{id}DELETE /appointments/{id}
Availability
GET /availability?staff_id=&from=&to=POST /availability/rulesPATCH /availability/rules/{id}DELETE /availability/rules/{id}
Calendar sync
POST /calendar-connections/googlePOST /calendar-connections/microsoftGET /calendar-connectionsDELETE /calendar-connections/{id}POST /calendar-sync/runor background job trigger
Webhooks
POST /webhooksGET /webhooksPATCH /webhooks/{id}DELETE /webhooks/{id}
Webhook events
appointment.createdappointment.updatedappointment.cancelledappointment.rescheduledappointment.confirmedappointment.no_showcalendar.connectedcalendar.disconnectedsync.completedsync.failed
Example appointment request
POST /appointments
{
"customer_id": "cus_123",
"staff_id": "staff_456",
"start_time": "2026-10-16T14:00:00Z",
"end_time": "2026-10-16T14:30:00Z",
"timezone": "America/New_York",
"notes": "Follow-up call",
"idempotency_key": "b9c2a3f5-7a2a-4e3d-9e4d-1a2b3c4d5e6f"
}
Example webhook payload
{
"event": "appointment.created",
"id": "evt_abc123",
"created_at": "2026-10-16T12:00:00Z",
"data": {
"appointment_id": "apt_789",
"customer_id": "cus_123",
"staff_id": "staff_456",
"start_time": "2026-10-16T14:00:00Z",
"end_time": "2026-10-16T14:30:00Z",
"status": "confirmed"
}
}
Webhook delivery best practices
- Sign payloads with HMAC
- Include
event_idfor deduplication - Retry with exponential backoff
- Store delivery attempts
- Return
2xxonly after successful processing - Support replay endpoint
Calendar sync approach
Two-way sync
- Push new appointments to external calendar
- Pull external events to detect conflicts
- Use provider event IDs to map records
- Use incremental sync tokens where supported
Conflict handling
- If external calendar has busy event, block slot
- Decide precedence:
- external calendar wins
- internal booking wins
- manual review required
Important considerations
- Use UTC internally, convert for display
- Handle daylight saving changes
- Lock rows or use transactions when booking
- Support idempotency on create/update
- Respect provider rate limits
- Encrypt OAuth tokens at rest
- Separate availability calculation from persistence
Suggested status lifecycle
pendingconfirmedcancelledrescheduledcompletedno_show
Minimal data model
appointments(
id,
customer_id,
staff_id,
start_time_utc,
end_time_utc,
timezone,
status,
external_calendar_event_id,
created_at,
updated_at
)
webhook_subscriptions(
id,
url,
secret,
events,
active,
created_at
)
calendar_connections(
id,
user_id,
provider,
access_token_encrypted,
refresh_token_encrypted,
expires_at,
sync_cursor,
created_at
)
If you want, I can next turn this into one of these:
- a full OpenAPI spec
- a database schema
- a Node.js/Express implementation
- a calendar sync design with Google/Microsoft OAuth flow