FHIR

FHIR Bundle explained: the nine bundle types and when to use each

A FHIR Bundle is a container for several resources. The nine bundle types in FHIR R4 (document, message, transaction, transaction-response, batch, batch-response, history, searchset, collection), how a transaction differs from a batch, and a minimal JSON example.

by Published 2 min read

Short answer: A Bundle is the FHIR resource that groups other resources: search results, a set of writes sent in one request, a clinical document such as a patient summary, or a message. Its type says what the group means and how a server must handle it.

The nine types in FHIR R4

  • searchset: the results of a search, with paging links.
  • transaction: writes processed all-or-nothing; if one fails, none is applied.
  • batch: writes processed independently; each entry succeeds or fails on its own.
  • transaction-response / batch-response: what the server returns for each.
  • document: a clinical document (the first entry is a Composition), such as the International Patient Summary; it is signed or stored as a whole.
  • message: a message, the first entry is a MessageHeader.
  • history: the versions of resources.
  • collection: a set of resources with no further meaning.

Transaction vs batch

Use a transaction when the resources depend on each other, for example a Patient and the Observations that reference it: references between entries can use temporary urn:uuid: identifiers that the server resolves. Use a batch for independent operations where partial success is acceptable.

{
  "resourceType": "Bundle",
  "type": "transaction",
  "entry": [
    {"fullUrl": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a",
     "resource": {"resourceType": "Patient", "name": [{"family": "Example"}]},
     "request": {"method": "POST", "url": "Patient"}},
    {"resource": {"resourceType": "Observation", "status": "final",
       "code": {"coding": [{"system": "http://loinc.org", "code": "8867-4"}]},
       "subject": {"reference": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a"},
       "valueQuantity": {"value": 72, "unit": "/min", "system": "http://unitsofmeasure.org", "code": "/min"}},
     "request": {"method": "POST", "url": "Observation"}}
  ]
}

In Anpheros

Anpheros Platform accepts transaction and batch bundles and returns searchset bundles with paging; the International Patient Summary is returned as a document bundle. See the FHIR sandbox to try them, and the International Patient Summary in FHIR.

Sources

Frequently asked questions

What is the difference between a FHIR transaction and a batch?

A transaction is all-or-nothing; a batch processes each entry independently.

How do I reference a resource created in the same bundle?

Give it a fullUrl such as urn:uuid:… and use that as the reference; in a transaction the server replaces it with the real id.

What type is a patient summary?

A document bundle whose first entry is a Composition.

Why does my search return a Bundle?

Search results are always a searchset bundle, with links to the next page.

Anpheros Platform

Try it free in the sandbox

Your first FHIR call in 5 minutes. An HL7 FHIR R4 API with the patient's consent built in: try it in the sandbox, then connect your own app or clinic system.

Free · 30 synthetic patients · no card

This guide is for information and does not replace medical advice. For decisions about your health, talk to your doctor. In an emergency, call your local emergency number (112 in Europe).
Written by
The Anpheros team

Anpheros builds a medical record that the patient controls and can share with any clinic, on an HL7 FHIR R4 platform, based in the EU. These guides help you understand and organise your health; they do not replace your doctor.

About Anpheros →
Anpheros

The more you log, the clearer your record

Your health history in one place, under your control.

Symptom diaryPatterns show over time
Emergency cardQR in your phone's Wallet
All your resultsLabs and reports together
You decideWho sees what, and for how long
Create your free account

Free · Works in your browser · No card