Recipes
Opinionated, end-to-end workflows. Each recipe ships a working result against the v1 surface — bearer auth, the four read-write FHIR R4 resources (Patient, Appointment, Encounter, Observation), and the huli CLI. Code samples are shown in cURL, TypeScript, Python, Java, and Go; every one runs as-is.
What do you want to build?
Register a patient
Create and dedupe a Patient record.
POST /Patient →Book an appointment
Availability → booked, end to end.
POST /Appointment →Send results from the lab
Push laboratory results into the chart as Observations.
POST /Observation →Sync a daily patient list
Pull each day's patients and appointments with the Huli CLI.
huli fhir patient search →Wire a read-only partner
Give an analytics or reporting tool least-privilege read access.
system/Patient.rs →Receive webhooks
React to appointments and clinical events as they happen.
POST /webhooks →v1 recipes
- Sandbox quickstart — get a sandbox organization pre-seeded with fake FHIR data from a Huli org admin, receive the bearer credential through a one-time share link, and make your first call. Five minutes from link to a
200. - Run your first authenticated Patient search — bearer token +
system/Patient.rs, the canonical first request. Five minutes from key tosearchset. - Registering a patient — discover the NOM-024 / MX address codes via the terminology ValueSets, then
POSTa Patient with CURP/RFC identifiers and the second-lastname extension usingsystem/Patient.cru. - Booking an appointment end-to-end — discover a service, practitioner, room, and free slot with
system/Appointment.cru+system/Practitioner.rs, thenPOSTthe Appointment past its booking preconditions — including thespecialtyselection a multi-specialty service requires. - Scheduling an administrative meeting — book an internal meeting with no patient: a required title, optional all-day flag, and external email invitees, against a service whose appointment type is
administrative. - Creating a clinical encounter — discover the practitioner participant, then
POSTan Encounter for an existing patient withsystem/Encounter.cru+system/Patient.rs+system/Practitioner.rs. - Writing and amending a clinical note — create the LOINC-sectioned
Compositionprojection of a visit and amend it withIf-Matchoptimistic concurrency, using the BAA-gatedsystem/Composition.cru. - Uploading a document — attach a PDF, scan, or image as a
DocumentReference(multipart$uploador inline base64) and read it back via a 30-minute signed URL, using the BAA-gatedsystem/DocumentReference.cru. - Fetching a patient's full record — pull a patient's encounters, observations, notes, documents, medications, and orders in one scope-filtered
Patient/$everythingBundle. - Wire a read-only partner — consume Appointment + Encounter read-only with
system/Appointment.rs+system/Encounter.rs, resolving the Practitioner/Organization references they point at. - Sync a daily patient list with the huli CLI — cron-safe, restart-idempotent Patient + Appointment pagination driven by the CLI.
- Send lab results to the chart — create Observations with required LOINC codes and UCUM units, with reference-range handling.
- Creating and sharing an API key as a clinic admin — the Practice Settings flow to mint, scope, reveal, share, and rotate an admin bearer key.
- Choosing a CLI authentication path — interactive OAuth vs M2M (
huli auth setup) vs a one-off bearer token; when to use which. - Debugging a failed FHIR search — read the
OperationOutcome, map the common failures, and trace a correlation id to its audit record. - Receive webhooks — register a
rest-hookSubscription withsystem/Subscription.crud, verify the HMAC signature on every delivery, dedupe on the event id, and recover missed events with$replay.