Skip to main content

Appointments

Appointments represent scheduled clinical interactions between patients and practitioners.

Create an Appointment

const { data: appt } = await clinik.appointments.create({
  status: 'booked',
  patientId: 'pt_abc123',
  practitionerId: 'prac_def456',
  start: '2025-02-01T14:00:00Z',
  end: '2025-02-01T14:30:00Z',
  minutesDuration: 30,
  appointmentType: 'followup',
  serviceType: 'Cardiology consultation',
  serviceCategory: 'specialist',
  specialty: 'Cardiology',
  reasonCode: 'Blood pressure follow-up',
  priority: 0,
  description: 'Follow-up visit for hypertension management',
  patientInstruction: 'Please bring your home BP log',
});

New Fields

Based On (ServiceRequest)

Link an appointment to the ServiceRequest it was created to assess:
const { data } = await clinik.appointments.create({
  status: 'proposed',
  patientId: 'pt_abc123',
  practitionerId: 'prac_def456',
  basedOnId: 'sr_referral789',
  serviceType: 'Orthopedic consultation',
  description: 'Referral follow-up for knee pain',
  // ...
});

Requested Period

Specify preferred time windows when the patient is available:
const { data } = await clinik.appointments.create({
  status: 'proposed',
  patientId: 'pt_abc123',
  practitionerId: 'prac_def456',
  requestedPeriod: [
    { start: '2025-02-03T09:00:00Z', end: '2025-02-03T12:00:00Z' },
    { start: '2025-02-04T14:00:00Z', end: '2025-02-04T17:00:00Z' },
  ],
  description: 'Patient prefers morning or afternoon slots',
  // ...
});

Created Timestamp

Track when the appointment was initially created (defaults to now):
const { data } = await clinik.appointments.create({
  status: 'booked',
  patientId: 'pt_abc123',
  practitionerId: 'prac_def456',
  start: '2025-02-01T14:00:00Z',
  end: '2025-02-01T14:30:00Z',
  created: '2025-01-20T08:30:00Z', // when the booking was made
  // ...
});

Status Lifecycle

proposed → pending → booked → checked-in → arrived → fulfilled
                                                    ↘ cancelled / noshow
StatusDescription
proposedSuggested but not confirmed
pendingAwaiting confirmation
bookedConfirmed and scheduled
checked-inPatient has checked in
arrivedPatient is at the facility
fulfilledAppointment completed
cancelledCancelled before completion
noshowPatient did not attend
waitlistOn a waitlist

Update an Appointment

// Check in a patient
await clinik.appointments.update('appt_xyz789', {
  status: 'checked-in',
});

// Cancel with reason
await clinik.appointments.update('appt_xyz789', {
  status: 'cancelled',
  cancelationReason: 'Patient requested reschedule',
});

// Reschedule with updated service details
await clinik.appointments.update('appt_xyz789', {
  start: '2025-02-03T10:00:00Z',
  end: '2025-02-03T10:30:00Z',
  appointmentType: 'followup',
  serviceType: 'General checkup',
  specialty: 'Family Medicine',
  reasonCode: 'Annual wellness visit',
  priority: 0,
  comment: 'Rescheduled from Feb 1 per patient request',
});

Search Appointments

// Upcoming appointments for a patient
const { data: upcoming } = await clinik.appointments.search({
  patientId: 'pt_abc123',
  status: 'booked',
  dateFrom: new Date().toISOString().split('T')[0],
  sort: 'date',
  count: 10,
});

// All appointments for a practitioner today
const today = new Date().toISOString().split('T')[0];
const { data: schedule } = await clinik.appointments.search({
  dateFrom: today,
  dateTo: today,
  sort: 'date',
});

Priority

Priority is an integer from 0-9:
ValueMeaning
0Routine (default)
1-3Low urgency
4-6Medium urgency
7-9High urgency

Complete Field Reference

FieldTypeRequiredDescription
statusstringYesproposed, pending, booked, arrived, fulfilled, cancelled, noshow, checked-in, waitlist
patientIdstringYesPatient reference
practitionerIdstringNoPractitioner reference
startstringNoStart time (ISO 8601)
endstringNoEnd time (ISO 8601)
minutesDurationnumberNoDuration in minutes (max 1440)
appointmentTypestringNoroutine, walkin, urgent, followup
serviceTypestringNoService being booked
serviceCategorystringNoService category
specialtystringNoRequired specialty
reasonCodestringNoReason for appointment
prioritynumberNo0 (routine) to 9 (urgent)
descriptionstringNoSubject line
commentstringNoAdditional comments
patientInstructionstringNoInstructions for patient
cancelationReasonstringNoReason for cancellation
basedOnIdstringNoServiceRequest this appointment assesses
requestedPeriodArray<{ start?, end? }>NoPreferred time windows
createdstringNoWhen initially created (defaults to now)