FHIR Bundle Resource (R4)
Bundle is a container for a collection of resources. Element table, search parameters, example JSON and FHIRPath for FHIR R4.
- FHIR Bundle Resource (R4) — part of the free FHIR Toolbox library.
- Runs entirely in your browser: your FHIR data is never uploaded to a server.
Overview
Bundle is a container for a collection of resources. Its type drives the semantics: collection for a plain set, searchset for search results, transaction and batch for submitting many operations at once, document for a clinical document, message for messaging. Bundles are how most FHIR data is exchanged and exported.
Elements
| Element | Type | Cardinality | Description |
|---|---|---|---|
| Bundle.identifier | Identifier | 0..1 | Persistent identifier for the bundle |
| Bundle.type | code | 1..1 | document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection |
| Bundle.timestamp | instant | 0..1 | When the bundle was assembled |
| Bundle.total | unsignedInt | 0..1 | If search, the total number of matches |
| Bundle.link | BackboneElement | 0..* | Links related to this Bundle |
| Bundle.link.id | String | 0..1 | Unique id for inter-element referencing |
| Bundle.link.extension | Extension | 0..* | Additional content defined by implementations |
| Bundle.link.modifierExtension | Extension | 0..* | Extensions that cannot be ignored even if unrecognized |
| Bundle.link.relation | string | 1..1 | See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1 |
| Bundle.link.url | uri | 1..1 | Reference details for the link |
| Bundle.entry | BackboneElement | 0..* | Entry in the bundle - will have a resource or information |
| Bundle.entry.id | String | 0..1 | Unique id for inter-element referencing |
| Bundle.entry.extension | Extension | 0..* | Additional content defined by implementations |
| Bundle.entry.modifierExtension | Extension | 0..* | Extensions that cannot be ignored even if unrecognized |
| Bundle.entry.link | 0..* | Links related to this entry | |
| Bundle.entry.fullUrl | uri | 0..1 | URI for resource (Absolute URL server address or URI for UUID/OID) |
| Bundle.entry.resource | Resource | 0..1 | A resource in the bundle |
| Bundle.entry.search | BackboneElement | 0..1 | Search related information |
| Bundle.entry.search.id | String | 0..1 | Unique id for inter-element referencing |
| Bundle.entry.search.extension | Extension | 0..* | Additional content defined by implementations |
| Bundle.entry.search.modifierExtension | Extension | 0..* | Extensions that cannot be ignored even if unrecognized |
| Bundle.entry.search.mode | code | 0..1 | match | include | outcome - why this is in the result set |
| Bundle.entry.search.score | decimal | 0..1 | Search ranking (between 0 and 1) |
| Bundle.entry.request | BackboneElement | 0..1 | Additional execution information (transaction/batch/history) |
| Bundle.entry.request.id | String | 0..1 | Unique id for inter-element referencing |
| Bundle.entry.request.extension | Extension | 0..* | Additional content defined by implementations |
| Bundle.entry.request.modifierExtension | Extension | 0..* | Extensions that cannot be ignored even if unrecognized |
| Bundle.entry.request.method | code | 1..1 | GET | HEAD | POST | PUT | DELETE | PATCH |
| Bundle.entry.request.url | uri | 1..1 | URL for HTTP equivalent of this entry |
| Bundle.entry.request.ifNoneMatch | string | 0..1 | For managing cache currency |
| Bundle.entry.request.ifModifiedSince | instant | 0..1 | For managing cache currency |
| Bundle.entry.request.ifMatch | string | 0..1 | For managing update contention |
| Bundle.entry.request.ifNoneExist | string | 0..1 | For conditional creates |
| Bundle.entry.response | BackboneElement | 0..1 | Results of execution (transaction/batch/history) |
| Bundle.entry.response.id | String | 0..1 | Unique id for inter-element referencing |
| Bundle.entry.response.extension | Extension | 0..* | Additional content defined by implementations |
| Bundle.entry.response.modifierExtension | Extension | 0..* | Extensions that cannot be ignored even if unrecognized |
| Bundle.entry.response.status | string | 1..1 | Status response code (text optional) |
| Bundle.entry.response.location | uri | 0..1 | The location (if the operation returns a location) |
| Bundle.entry.response.etag | string | 0..1 | The Etag for the resource (if relevant) |
| Bundle.entry.response.lastModified | instant | 0..1 | Server's date time modified |
| Bundle.entry.response.outcome | Resource | 0..1 | OperationOutcome with hints and warnings (for batch/transaction) |
| Bundle.signature | Signature | 0..1 | Digital Signature |
Example JSON (R4)
{
"resourceType": "Bundle",
"id": "example",
"type": "transaction",
"entry": [
{
"fullUrl": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a",
"resource": {
"resourceType": "Patient",
"name": [
{
"family": "Smith",
"given": [
"John"
]
}
],
"gender": "male"
},
"request": {
"method": "POST",
"url": "Patient"
}
},
{
"fullUrl": "urn:uuid:88f151c0-a954-468a-88bd-5ae15c08e059",
"resource": {
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "29463-7",
"display": "Body weight"
}
]
},
"subject": {
"reference": "urn:uuid:61ebe359-bfdc-4613-8bf2-c5e300945f0a"
},
"valueQuantity": {
"value": 72.5,
"unit": "kg",
"system": "http://unitsofmeasure.org",
"code": "kg"
}
},
"request": {
"method": "POST",
"url": "Observation"
}
}
]
}
FHIRPath
Bundle.entry.resource.ofType(Patient)— Every Patient in the BundleBundle.entry.resource.ofType(Observation).count()— How many ObservationsBundle.entry.fullUrl— All fullUrl valuesBundle.entry.request.method— HTTP method of each transaction entry
Common validation errors
- Omitting request on transaction or batch entries. Each entry needs method and url.
- Referencing another entry by a relative id inside a transaction when the target has no server id yet. Use the target's fullUrl (for example urn:uuid:…) as the reference.
- Using a type of transaction when you mean collection, or the reverse. Transactions are atomic and are executed.
- Forgetting that entry.resource is a full resource with its own resourceType.
FHIR Toolbox is a free, privacy-first collection of HL7 FHIR utilities by Omindra Labs. Every tool performs zero-server processing — your health data never leaves your device.