FHIR

Last checked · 3 min read

FHIR (Fast Healthcare Interoperability Resources, said “fire”) is HL7's standard for sharing health records between computer systems. It splits a record into small pieces called resources, such as Patient, Observation or MedicationRequest. Systems read and write them over a web API. Release R4 came out in December 2018, with a correction (4.0.1) in 2019. Most systems build on it today.

Resources and the web API

FHIR describes health data as resources. The standard calls the resource “the basic building block”. A resource can be a patient, an observation such as a blood pressure reading, an allergy, a medication order or a claim.1 Each resource has a type, an id and a version. Systems usually send it as JSON, with the media type application/fhir+json.

Systems work with resources through a short list of actions on web addresses like /Observation/123. They can read, read one version, search, create, update, patch, delete and see the history. They can also send several actions at once in a batch or a transaction.2 These are plain web requests. So any program that can send a request can write to a FHIR server, and that now includes AI agents.

Versions: R4, R5 and R6

FHIR has had several releases. R4 came out on 27 December 2018, and its correction, 4.0.1, on 30 October 2019. R5 followed on 26 March 2023, and R6 is being voted on.5 Most live servers, national guides and vendor APIs still use R4. So a project started today usually targets 4.0.1. The actions are mostly the same across releases. What changes is the shape of some resources.

How an AI agent writes to FHIR

An agent rarely talks to a hospital’s FHIR server on its own. A gateway or an app holds the keys, usually a sign-in the server’s owner set up for it. The agent asks that app to run a tool, such as “create an Observation”.

What an agent may write depends on the server. Epic’s public R4 test server, for example, lists create for allergies and conditions, and create and update for observations, documents and service requests. It lists only read and search for medication orders. Each customer’s setup can differ.3

Where a write can say one thing and store another

FHIR’s own rules leave a gap between what an agent reports and what the server saved:

  • Create only if new. A create sent with If-None-Exist that matches one existing resource is ignored. The server answers 200 OK and creates nothing.2 An agent that reads “200” as “created” reports a write that never happened.
  • The saved copy is optional. A client can ask the server to send back what it saved, using the Prefer header. But servers only “SHOULD” do it.2 So the answer may not show what was saved.
  • Version checks. An update sent with If-Match and an old version gets 412 Precondition Failed. Nothing is written.2 An agent that just tries again can overwrite someone else’s change.
  • Errors after the fact. A timeout or a server error doesn’t say whether the write went through. Only reading the resource again tells you.

The safe habit is simple. Read the resource back after every write, and compare it with what the agent meant to save. Our FHIR write benchmark runs these cases on a real server and shows where a read-back catches them and where it misses, misses first. The method is a read-back check.

FHIR and audit

FHIR also has resources for recording what happened. AuditEvent is “a record of an event made for purposes of maintaining a security log”. Provenance describes who and what took part in making a resource.48 With them, a server, or a tool in front of it, can describe agent actions in a format other health systems already read. See audit trail for AI in healthcare.

An example

A conditional create that matches an existing resource (FHIR R4 rules)http
POST /fhir/AllergyIntolerance HTTP/1.1
Content-Type: application/fhir+json
If-None-Exist: identifier=https://hospital.example/allergy|A-1001

HTTP/1.1 200 OK
Location: /fhir/AllergyIntolerance/88/_history/3

# One match: the server ignores the POST and answers 200.
# Nothing new was created. A 201 would have meant a new resource.

How Deedglass uses it

Today Deedglass can sit in front of a FHIR server through its REST connector. You set up the tools, such as one per resource type and action. Your rules decide each call. After each write, a read-back checks the fields you name (Checked).6 Since v0.3.0, the FHIR connector (beta) puts a FHIR R4 server behind Deedglass as one tool per interaction, on the resource types you list.7 It reads each write back at the version the server reported and compares the fields the agent sent (Checked).7 Since v0.4.0, a write can be Proven on HAPI FHIR JPA 8.x and Medplum 5.x running on Postgres. Deedglass reads the FHIR server's own change log and checks that the transaction holding the version the server reported is what the agent sent, and nothing else. HAPI FHIR 7.x and older, deletes on Medplum, other servers and managed EHRs stay Checked.7 Records also export as FHIR R4 AuditEvent and Provenance, with ids and digests instead of clinical content.9

Related on this site

Sources

  1. 1HL7 FHIR R4: Overview · hl7.org · checked 19 October 2026
  2. 2HL7 FHIR R4: RESTful API · hl7.org · checked 19 October 2026
  3. 3Epic: public FHIR R4 sandbox capability statement · fhir.epic.com · checked 19 October 2026
  4. 4HL7 FHIR R4: AuditEvent · hl7.org · checked 19 October 2026
  5. 5HL7 FHIR: version history · hl7.org · checked 19 October 2026
  6. 6Deedglass docs: the REST connector (read-backs) · docs.deedglass.com · checked 19 October 2026
  7. 7Deedglass docs: the FHIR connector · docs.deedglass.com · checked 19 October 2026
  8. 9Deedglass docs: Exports, records as FHIR AuditEvent and Provenance · docs.deedglass.com · checked 19 October 2026
  9. 8HL7 FHIR R4: Provenance · hl7.org · checked 19 October 2026

Last checked 19 October 2026. We re-check the glossary every month. If something here is wrong, write to hello@deedglass.com.