Scheduling
Appointment Responses
Managing participant responses to appointments
Set up the SDK server client to run the examples using esus. The REST examples use a session token. To run them with the SDK’s API key, send X-API-Key instead of Authorization.
What is AppointmentResponse?
The AppointmentResponse resource records how a participant responded to an appointment: accepted, declined, tentative, or still pending.
Responses are never generated automatically: neither POST /fhir/Appointment nor $book creates one, and creating a response does not change the Appointment (neither its status nor participant[].status). Update the Appointment separately if needed.
Participant Status Values
| Status | Meaning |
|---|---|
accepted | Participant accepts the appointment (default if omitted) |
declined | Participant declines the appointment |
tentative | Participant tentatively accepts |
needs-action | Participant needs to respond |
Create an AppointmentResponse
The appointment is referenced with the flat appointmentId field (required; must be an existing Appointment). actor keeps the FHIR reference shape. Other optional fields: participantType[], start, end, comment, identifier[].
curl -X POST https://api.esus.health/fhir/AppointmentResponse \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/fhir+json" \
-d '{
"appointmentId": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"participantStatus": "accepted",
"actor": {
"reference": "Patient/3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
"participantType": [{
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "SBJ",
"display": "subject"
}]
}],
"comment": "I will be there on time"
}'
const created = await esus.fhir.create("AppointmentResponse", {
"appointmentId": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"participantStatus": "accepted",
"actor": {
"reference": "Patient/3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
"participantType": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "SBJ",
"display": "subject"
}
]
}
],
"comment": "I will be there on time"
});
The response (201) uses the standard FHIR shape: "appointment": { "reference": "Appointment/d4e5f6a7-..." }. Deleting an Appointment also deletes its responses.
A practitioner’s response is the same request with their reference as actor:
{
"appointmentId": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"participantStatus": "accepted",
"actor": { "reference": "Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789" },
"participantType": [{
"coding": [{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "PPRF",
"display": "primary performer"
}]
}]
}
Search Responses
AppointmentResponse search supports only two parameters: appointment (exact Appointment id, <uuid> or Appointment/<uuid>) and status (the participantStatus). There is no actor search parameter.
# All responses for an appointment
curl "https://api.esus.health/fhir/AppointmentResponse?appointment=d4e5f6a7-b8c9-0123-def4-567890abcdef" \
-H "Authorization: Bearer YOUR_TOKEN"
# Declined responses for an appointment
curl "https://api.esus.health/fhir/AppointmentResponse?appointment=d4e5f6a7-b8c9-0123-def4-567890abcdef&status=declined" \
-H "Authorization: Bearer YOUR_TOKEN"
Handling Rejections
When a participant declines, record it:
curl -X POST https://api.esus.health/fhir/AppointmentResponse \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/fhir+json" \
-d '{
"appointmentId": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"participantStatus": "declined",
"actor": { "reference": "Patient/3fa85f64-5717-4562-b3fc-2c963f66afa6" },
"comment": "Schedule conflict - will call to reschedule"
}'
const created = await esus.fhir.create("AppointmentResponse", {
"appointmentId": "d4e5f6a7-b8c9-0123-def4-567890abcdef",
"participantStatus": "declined",
"actor": {
"reference": "Patient/3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
"comment": "Schedule conflict - will call to reschedule"
});
Then decide what happens to the appointment: usually PATCH it to cancelled (valid from proposed, pending, booked and arrived) and free its slot. noshow is for a patient who didn’t attend, not for a declined invitation.