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

ElementTypeCardinalityDescription
Bundle.identifierIdentifier0..1Persistent identifier for the bundle
Bundle.typecode1..1document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection
Bundle.timestampinstant0..1When the bundle was assembled
Bundle.totalunsignedInt0..1If search, the total number of matches
Bundle.linkBackboneElement0..*Links related to this Bundle
Bundle.link.idString0..1Unique id for inter-element referencing
Bundle.link.extensionExtension0..*Additional content defined by implementations
Bundle.link.modifierExtensionExtension0..*Extensions that cannot be ignored even if unrecognized
Bundle.link.relationstring1..1See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1
Bundle.link.urluri1..1Reference details for the link
Bundle.entryBackboneElement0..*Entry in the bundle - will have a resource or information
Bundle.entry.idString0..1Unique id for inter-element referencing
Bundle.entry.extensionExtension0..*Additional content defined by implementations
Bundle.entry.modifierExtensionExtension0..*Extensions that cannot be ignored even if unrecognized
Bundle.entry.link0..*Links related to this entry
Bundle.entry.fullUrluri0..1URI for resource (Absolute URL server address or URI for UUID/OID)
Bundle.entry.resourceResource0..1A resource in the bundle
Bundle.entry.searchBackboneElement0..1Search related information
Bundle.entry.search.idString0..1Unique id for inter-element referencing
Bundle.entry.search.extensionExtension0..*Additional content defined by implementations
Bundle.entry.search.modifierExtensionExtension0..*Extensions that cannot be ignored even if unrecognized
Bundle.entry.search.modecode0..1match | include | outcome - why this is in the result set
Bundle.entry.search.scoredecimal0..1Search ranking (between 0 and 1)
Bundle.entry.requestBackboneElement0..1Additional execution information (transaction/batch/history)
Bundle.entry.request.idString0..1Unique id for inter-element referencing
Bundle.entry.request.extensionExtension0..*Additional content defined by implementations
Bundle.entry.request.modifierExtensionExtension0..*Extensions that cannot be ignored even if unrecognized
Bundle.entry.request.methodcode1..1GET | HEAD | POST | PUT | DELETE | PATCH
Bundle.entry.request.urluri1..1URL for HTTP equivalent of this entry
Bundle.entry.request.ifNoneMatchstring0..1For managing cache currency
Bundle.entry.request.ifModifiedSinceinstant0..1For managing cache currency
Bundle.entry.request.ifMatchstring0..1For managing update contention
Bundle.entry.request.ifNoneExiststring0..1For conditional creates
Bundle.entry.responseBackboneElement0..1Results of execution (transaction/batch/history)
Bundle.entry.response.idString0..1Unique id for inter-element referencing
Bundle.entry.response.extensionExtension0..*Additional content defined by implementations
Bundle.entry.response.modifierExtensionExtension0..*Extensions that cannot be ignored even if unrecognized
Bundle.entry.response.statusstring1..1Status response code (text optional)
Bundle.entry.response.locationuri0..1The location (if the operation returns a location)
Bundle.entry.response.etagstring0..1The Etag for the resource (if relevant)
Bundle.entry.response.lastModifiedinstant0..1Server's date time modified
Bundle.entry.response.outcomeResource0..1OperationOutcome with hints and warnings (for batch/transaction)
Bundle.signatureSignature0..1Digital 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 Bundle
  • Bundle.entry.resource.ofType(Observation).count() — How many Observations
  • Bundle.entry.fullUrl — All fullUrl values
  • Bundle.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.