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?

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 to searchset.
  • Registering a patient — discover the NOM-024 / MX address codes via the terminology ValueSets, then POST a Patient with CURP/RFC identifiers and the second-lastname extension using system/Patient.cru.
  • Booking an appointment end-to-end — discover a service, practitioner, room, and free slot with system/Appointment.cru + system/Practitioner.rs, then POST the Appointment past its booking preconditions — including the specialty selection 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 POST an Encounter for an existing patient with system/Encounter.cru + system/Patient.rs + system/Practitioner.rs.
  • Writing and amending a clinical note — create the LOINC-sectioned Composition projection of a visit and amend it with If-Match optimistic concurrency, using the BAA-gated system/Composition.cru.
  • Uploading a document — attach a PDF, scan, or image as a DocumentReference (multipart $upload or inline base64) and read it back via a 30-minute signed URL, using the BAA-gated system/DocumentReference.cru.
  • Fetching a patient's full record — pull a patient's encounters, observations, notes, documents, medications, and orders in one scope-filtered Patient/$everything Bundle.
  • 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-hook Subscription with system/Subscription.crud, verify the HMAC signature on every delivery, dedupe on the event id, and recover missed events with $replay.