DocumentReference

The FHIR R4 DocumentReference resource represents metadata about clinical documents such as C-CDAs, PDFs, imaging reports, and other unstructured records.

In Health Gorilla, DocumentReference is used to discover and access patient documents aggregated from multiple clinical data sources. It is the primary resource used to locate and retrieve document-based clinical data.

Overview

DocumentReference provides:

  • Metadata about a document (type, author, date, status)
  • References to the patient associated with the document
  • Links to the actual document content via content.attachment.url

It does not contain the document itself. To retrieve the document content, use the Binary endpoint referenced in the attachment.

Common Use Cases

  • Retrieve clinical documents for a patient
  • Discover available documents before retrieval
  • Access diagnostic reports, clinical notes, and discharge summaries
  • Download document content (PDF, CDA, images)
  • Support care coordination and transitions

HG-Specific Behavior

  • Documents may originate from multiple external networks and sources
  • Document metadata is normalized across sources for consistent access
  • Not all documents are fully structured or coded
  • Document content is accessed separately via the Binary endpoint
  • Some document retrieval workflows may involve asynchronous processing

Resource Attributes

AttributeDescriptionExample ValuesFHIR Data Type
subjectPatient associated with the documentPatient/{id}Reference(Patient)
statusStatus of the document referencecurrent, supersededcode
typeType of documentclinical-note, discharge-summaryCodeableConcept
categoryClassification of the documentclinical-note, imagingCodeableConcept[]
dateDocument creation or indexing date2024-02-12T12:34:56ZdateTime
authorAuthor of the documentPractitioner/{id}Reference[]
contentAttachment metadata including document access URLBinary/{id}BackboneElement[]

Retrieve Documents

Search Documents

GET /fhir/R4/DocumentReference?patient={id}

Returns a Bundle of DocumentReference resources matching the search criteria.

Retrieve by ID

GET /fhir/R4/DocumentReference/{id}

Returns a single DocumentReference.

Operations

Download Document Content

To retrieve the actual document file, use the Binary endpoint referenced in:

content[].attachment.url

Example:

GET /fhir/R4/Binary/{id}
Authorization: Bearer {access_token}

Notes:

  • Binary content may be protected or time-limited
  • The required scope is typically the same as the referencing resource (for example, documentreference.read)

Search Behavior

  • Searches are scoped to the authenticated tenant
  • The patient parameter is required for most queries
  • Results are returned as a FHIR Bundle
  • Pagination is supported via Bundle.link

Search Parameters

A document search must be bounded. Supply at least one of patient, type, category, or _lastUpdated. A request with none of them is rejected.

ParameterRequiredDescription
patientNoThe patient whose documents you want, as Patient/{id}. You can also search by a patient identifier using patient.identifier.
typeNoFilters on the document type.
categoryNoFilters on the document category. In STU3 this parameter is named class.
dateNoFilters on DocumentReference.date, the time the document reference was created, rather than the period of care the document describes.
custodianNoReturns documents held by the given organization, as Organization/{id}.
_lastUpdatedNoFilters on when the record was last written in the Health Gorilla FHIR server. Accepts a comparison prefix, for example ge2025-01-01.
_offsetNoSkips the given number of results.
_countNoLimits the number of results returned per page.
_tagNoFilters on meta.tag.
_securityNoFilters on meta.security.

The search also accepts _include=DocumentReference:subject and _include=Coverage:beneficiary to return referenced resources.

Authentication

All requests require OAuth 2.0 bearer token authentication.

Required scopes:

  • documentreference.read for read operations
  • documentreference.write for create, update, and delete operations

For more information, see: OAuth 2.0 Authentication

Notifications

The FHIR R4 API does not provide direct subscriptions for DocumentReference.

Document updates may be available through broader event or notification workflows depending on configuration.

Error Handling

All operations return standard FHIR OperationOutcome responses for errors.

For more information, see: Error Handling

Related Resources

  • Binary: Retrieve document content
  • Patient: Associated patient record
  • Provenance: Source and origin of documents

External Reference