Create a Schedule

Create a Schedule resource that defines the availability container. The actor[] array keeps the standard FHIR reference shape because a schedule can point to practitioners, locations, devices, etc.

curl -X POST https://api.esus.health/fhir/Schedule \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "active": true,
    "serviceCategory": [{
      "coding": [{
        "system": "http://terminology.hl7.org/CodeSystem/service-category",
        "code": "1",
        "display": "General Practice"
      }]
    }],
    "actor": [{
      "reference": "Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789",
      "display": "Dr. Sarah Johnson"
    }],
    "planningHorizon": {
      "start": "2026-04-21T08:00:00Z",
      "end": "2026-04-21T17:00:00Z"
    }
  }'

Create Slots

Each slot references its parent schedule via the flat scheduleId field (not a FHIR reference object).

curl -X POST https://api.esus.health/fhir/Slot \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "scheduleId": "aa11bb22-cc33-dd44-ee55-ff6677889900",
    "status": "free",
    "start": "2026-04-21T09:00:00Z",
    "end": "2026-04-21T09:30:00Z",
    "overbooked": false,
    "comment": "Available for general checkup"
  }'

Slot Status Values

StatusMeaning
freeThe slot is available
busyThe slot is reserved
busy-unavailableThe slot exists but is not available
busy-tentativeThe slot is tentatively reserved
entered-in-errorRecorded in error

Search Available Slots

# All free slots for a practitioner from a given date
curl "https://api.esus.health/fhir/Slot?schedule.actor=Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789&status=free&date=ge2026-04-21" \
  -H "Authorization: Bearer YOUR_TOKEN"

Creating Many Slots

There is no $bulk-create operation exposed today. To create many slots, iterate the POST endpoint client-side (or use a FHIR transaction bundle through the fhir-batch endpoint — see the FHIR Batch documentation).

# Example: create 16 half-hour slots for a single schedule, client-side loop
for t in 09:00 09:30 10:00 10:30 11:00 11:30 12:00 12:30 14:00 14:30 15:00 15:30 16:00 16:30; do
  curl -X POST https://api.esus.health/fhir/Slot \
    -H "Authorization: Bearer YOUR_TOKEN" \
    -H "Content-Type: application/fhir+json" \
    -d "{
      \"scheduleId\": \"aa11bb22-cc33-dd44-ee55-ff6677889900\",
      \"status\": \"free\",
      \"start\": \"2026-04-21T${t}:00Z\",
      \"end\": \"2026-04-21T${t}:30Z\"
    }"
done