Subscribing to Events

Health Gorilla supports FHIR Subscription resources to allow clients to register for real-time event notifications. Subscriptions let your application receive webhook notifications when specific types of data are created or updated, eliminating the need for continuous polling.

Subscriptions are supported for both FHIR R4 and STU3 environments.


Creating a Subscription

To begin receiving webhooks, create a Subscription resource using the FHIR RESTful API.

HTTP Request

POST /fhir/Subscription
Authorization: Bearer {access_token}
Content-Type: application/fhir+json

Example Request Body (R4)

{
  "resourceType": "Subscription",
  "status": "active",
  "reason": "Notify when new clinical documents are available",
  "criteria": "DocumentReference?status=current",
  "channel": {
    "type": "rest-hook",
    "endpoint": "https://yourapp.com/webhooks/hg",
    "payload": "application/fhir+json"
  }
} 

Note: All webhook endpoints must use https. Plain HTTP endpoints are not supported.

Supported Criteria

The criteria field defines which resource events should trigger your webhook. Health Gorilla supports a curated set of criteria expressions based on resource type and status.

Examples

Resource TypeSupported Criteria
DocumentReferenceDocumentReference?status=current
EncounterEncounter?status=finished
AllergyIntoleranceAllergyIntolerance?clinical-status=active
ObservationObservation?code=xxx (lab-specific)
ImmunizationImmunization?status=completed

Contact your Health Gorilla integration engineer for help designing subscription filters based on your workflow.

Managing Subscriptions

You can retrieve, update, or delete subscriptions like any other FHIR resource.

Get All Subscriptions

GET /fhir/Subscription
Authorization: Bearer {access_token}

Update a Subscription

PUT /fhir/Subscription/{id}
Authorization: Bearer {access_token}
Content-Type: application/fhir+json

Delete a Subscription

DELETE /fhir/Subscription/{id}
Authorization: Bearer {access_token}