ediverse Explore the platform

Spotlight PEPPOL BIS Billing 3.0 The EU e-invoicing mandate is here — France Sept 2026, Belgium Jan 2026, Germany 2025.

Binary — Opaque content container

Binary carries an unstructured payload: discharge letter PDF, DICOM image, consult audio, digital signature. Referenced by DocumentReference, Attachment and Bundle.

Purpose

Binary is the standard route for unstructured content inside a FHIR server. Two modes: in JSON via data (base64), or via direct REST access on /Binary/[id] with HTTP content negotiation.

Key fields

FieldTypeCardinalityRole
contentTypecode (MIME)1..1MIME content type (application/pdf, image/jpeg, application/dicom).
securityContextReference(Any)0..1Security context — used by the authorisation engine. Typically Patient or Encounter.
database64Binary0..1Inline base64-encoded data (reasonable sizes only).

JSON example

Embedded discharge letter PDF:

json binary-example.json
{
  "resourceType": "Binary",
  "id": "discharge-letter-pdf",
  "contentType": "application/pdf",
  "securityContext": { "reference": "Encounter/stay-12345" },
  "data": "JVBERi0xLjcKCjEgMCBvYmoKPDwgL1R5cGUgL0NhdGFsb2cgL1BhZ2VzIDIgMCBSID4+CmVuZG9iagovL0F2YWlsYWJsZSBhcyBpbmxpbmUgZGF0YSwgYmFzZTY0LWVuY29kZWQ="
}

REST API

  • POST /Binary with raw body + Content-Type: application/pdf — direct create with no JSON wrapper.
  • GET /Binary/[id] with Accept: application/pdf — fetches raw binary content.
  • GET /Binary/[id] with Accept: application/fhir+json — fetches JSON wrapper with base64 data.

Common pitfalls

  • Everything inline in JSON: for large files (> 1 MB), prefer direct REST access or DocumentReference + Attachment.url external.
  • SecurityContext missing: without context, the authorisation engine cannot determine access.
  • Corrupted base64: some middlewares (gateways) re-encode — verify integrity (hash) after transit.
  • DocumentReference — pointer + metadata to a clinical Binary.
  • Attachment — FHIR data type to embed a binary (with url to Binary).
  • Bundle — can reference Binary by fullUrl.
  • Media — deprecated in R5; clinical photos/videos migrate to DocumentReference + Binary.

See also: DocumentReference, Bundle.