Skip to content

Booking an Appointment

Booking an Appointment

This guide walks you through the complete appointment booking flow: searching for available slots, creating an appointment, and managing it through its lifecycle.

Overview

The DELPHOS scheduling system uses a stateful appointment lifecycle that tracks every appointment from initial request through completion. Each appointment transitions through well-defined states, ensuring full auditability and conflict prevention.

Appointment Lifecycle

requested → confirmed → checked_in → in_progress → completed
│ │ │
└───────────┴────────────┴──→ cancelled
│ │
└───────────┴──→ no_show
└──→ rescheduled

Booking Sources

Appointments can originate from multiple channels:

SourceDescription
webPatient self-service portal
phonePhone call booking
whatsappWhatsApp conversation
apiDirect API integration
walk_inWalk-in patient
chatbotDELPHOS conversational assistant

Step 1: Search Available Slots

Before creating an appointment, search for available time slots that match the patient’s needs.

Request

Terminal window
curl -X GET "https://your-instance.delphos.app/v1/scheduling/slots?\
date_from=2026-04-15&\
date_to=2026-04-18&\
appointment_type_id=550e8400-e29b-41d4-a716-446655440003&\
provider_id=550e8400-e29b-41d4-a716-446655440001&\
location_id=550e8400-e29b-41d4-a716-446655440004&\
duration_minutes=30&\
limit=10" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json"

Query Parameters

ParameterTypeRequiredDescription
date_fromdateYesStart of search range (YYYY-MM-DD)
date_todateYesEnd of search range (YYYY-MM-DD)
appointment_type_iduuidYesType of appointment
provider_iduuidNoSpecific provider (omit for cross-provider search)
specialtystringNoFilter by specialty (used with cross-provider search)
location_iduuidNoSpecific location
duration_minutesintegerNoDesired duration in minutes
limitintegerNoMax results (default: 50, max: 200)
cursorstringNoPagination cursor from previous response

Response

{
"slots": [
{
"provider_profile_id": "550e8400-e29b-41d4-a716-446655440001",
"location_id": "550e8400-e29b-41d4-a716-446655440004",
"start_time": "2026-04-15T09:00:00Z",
"end_time": "2026-04-15T09:30:00Z",
"duration_minutes": 30,
"score": 1.0
},
{
"provider_profile_id": "550e8400-e29b-41d4-a716-446655440001",
"location_id": "550e8400-e29b-41d4-a716-446655440004",
"start_time": "2026-04-15T10:00:00Z",
"end_time": "2026-04-15T10:30:00Z",
"duration_minutes": 30,
"score": 1.0
}
],
"next_cursor": "eyJzdGFydCI6IjIwMjYtMDQtMTVUMTE6MDAifQ==",
"has_more": true
}

Step 2: Create the Appointment

Once you have identified a suitable slot, create the appointment.

Request

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/scheduling/appointments" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"provider_profile_id": "550e8400-e29b-41d4-a716-446655440001",
"patient_id": "550e8400-e29b-41d4-a716-446655440002",
"appointment_type_id": "550e8400-e29b-41d4-a716-446655440003",
"location_id": "550e8400-e29b-41d4-a716-446655440004",
"start_time": "2026-04-15T09:00:00Z",
"end_time": "2026-04-15T09:30:00Z",
"source": "web",
"notes": "Follow-up consultation for blood pressure monitoring"
}'

Request Body

FieldTypeRequiredDescription
provider_profile_iduuidYesProvider conducting the appointment
patient_iduuidYesPatient being seen
appointment_type_iduuidYesType of appointment (consultation, exam, etc.)
location_iduuidYesPhysical location
start_timedatetimeYesStart time in UTC (ISO 8601)
end_timedatetimeYesEnd time in UTC (ISO 8601)
room_iduuidNoSpecific room assignment
sourcestringNoBooking channel (default: api)
notesstringNoPatient-visible notes
internal_notesstringNoStaff-only notes
external_referencestringNoExternal system reference (max 255 chars)
metadataobjectNoAdditional key-value data

Response (201 Created)

{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"provider_profile_id": "550e8400-e29b-41d4-a716-446655440001",
"patient_id": "550e8400-e29b-41d4-a716-446655440002",
"appointment_type_id": "550e8400-e29b-41d4-a716-446655440003",
"location_id": "550e8400-e29b-41d4-a716-446655440004",
"room_id": null,
"start_time": "2026-04-15T09:00:00Z",
"end_time": "2026-04-15T09:30:00Z",
"status": "requested",
"source": "web",
"notes": "Follow-up consultation for blood pressure monitoring",
"internal_notes": null,
"external_reference": null,
"metadata": {},
"version": 1,
"created_at": "2026-04-14T18:30:00Z",
"updated_at": "2026-04-14T18:30:00Z"
}

Conflict Detection

DELPHOS automatically detects scheduling conflicts. If the requested time slot overlaps with an existing appointment for the same provider and location, you will receive a 409 Conflict response:

{
"detail": "Appointment conflicts with existing appointment at the requested time"
}

Step 3: Confirm the Appointment

New appointments start in requested status. Confirm them to signal the provider has accepted:

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/scheduling/appointments/\
a1b2c3d4-e5f6-7890-abcd-ef1234567890/confirm" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"confirmed_by": "Dr. Silva"}'

Step 4: Day-of-Visit Lifecycle

On the day of the appointment, move through the remaining states:

Check-In

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/scheduling/appointments/\
{appointment_id}/check-in" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"checked_in_by": "Reception Desk 1"}'

Start Appointment

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/scheduling/appointments/\
{appointment_id}/start" \
-H "x-api-key: YOUR_API_KEY"

Complete Appointment

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/scheduling/appointments/\
{appointment_id}/complete" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"notes": "Blood pressure stable at 120/80. Continue current medication."}'

Rescheduling

Rescheduling atomically cancels the existing appointment and creates a new one in a single transaction. The original appointment transitions to rescheduled status, and a new appointment is created with the updated time.

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/scheduling/appointments/\
{appointment_id}/reschedule" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"new_start_time": "2026-04-16T14:00:00Z",
"new_end_time": "2026-04-16T14:30:00Z"
}'

Cancellation

Cancel an appointment with an optional reason. DELPHOS supports configurable cancellation policies per tenant. A typical configuration might be:

  • 24+ hours before: No restrictions
  • 1-24 hours before: Late cancellation fee may apply
  • Less than 1 hour: Cancellation may be restricted

The exact policy is tenant-configurable via the Configuration API.

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/scheduling/appointments/\
{appointment_id}/cancel" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Patient requested reschedule due to travel",
"cancelled_by": "Patient via phone"
}'

Marking No-Shows

When a patient does not attend a confirmed or checked-in appointment:

Terminal window
curl -X POST "https://your-instance.delphos.app/v1/scheduling/appointments/\
{appointment_id}/no-show" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"notes": "Patient did not respond to confirmation calls"}'

Retrieving Appointments

List Appointments

Terminal window
curl -X GET "https://your-instance.delphos.app/v1/scheduling/appointments?\
provider_id=550e8400-e29b-41d4-a716-446655440001&\
status=confirmed&\
date_from=2026-04-15&\
date_to=2026-04-20&\
limit=25" \
-H "x-api-key: YOUR_API_KEY"

List Query Parameters

ParameterTypeDescription
provider_iduuidFilter by provider
patient_iduuidFilter by patient
location_iduuidFilter by location
statusstringFilter by status
date_fromdateStart of date range
date_todateEnd of date range
limitintegerResults per page
cursorstringPagination cursor

Get Single Appointment

Retrieve a single appointment with its full status change history:

Terminal window
curl -X GET "https://your-instance.delphos.app/v1/scheduling/appointments/\
a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "x-api-key: YOUR_API_KEY"

The detail response includes a status_history array showing every state transition with timestamps and actors.


Updating Appointments

Update notes, metadata, or room assignment on existing appointments. Updates use optimistic locking — you must provide the current version number to prevent conflicting changes.

Terminal window
curl -X PUT "https://your-instance.delphos.app/v1/scheduling/appointments/\
a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"version": 2,
"notes": "Patient needs wheelchair access",
"internal_notes": "Insurance pre-auth required",
"room_id": "550e8400-e29b-41d4-a716-446655440099"
}'

Multi-Location Support

Providers who work at multiple locations have their schedules managed per-location. DELPHOS automatically detects cross-location conflicts:

Terminal window
curl -X GET "https://your-instance.delphos.app/v1/scheduling/providers/\
{provider_id}/cross-location-conflicts?\
date_from=2026-04-15&date_to=2026-04-20" \
-H "x-api-key: YOUR_API_KEY"

Response:

{
"conflicts": [
{
"date": "2026-04-16",
"location_a": "Clinic Downtown",
"location_b": "Hospital North",
"overlap_start": "14:00",
"overlap_end": "15:00"
}
],
"has_conflicts": true
}

Error Handling

Status CodeErrorDescription
404Not FoundAppointment does not exist
409ConflictTime slot already occupied, or optimistic lock version mismatch
422Validation ErrorInvalid request body (e.g., start_time after end_time)

Next Steps