Explore documentation

Patient Coverage

How Esus represents a patient's insurance coverage

Set up the SDK server client to run the examples using esus. The REST examples use a session token. To run them with the SDK’s API key, send X-API-Key instead of Authorization.

Coverage

Coverage is a standalone FHIR resource with full CRUD at /fhir/Coverage. It represents a patient’s insurance coverage: who the beneficiary is, who pays (the payor), the plan, and its effective period. Other financial resources reference it by Coverage/<uuid> — for example Claim.insurance[].coverage and Account.coverage[].coverage.

API convention: on write, the beneficiary is a flat id (beneficiaryId); responses return it as beneficiary: { "reference": "Patient/<uuid>" }. payor is a required array of FHIR references; subscriber, policyHolder, and contract use the standard FHIR reference shape. All ids are UUIDs.

Create a Coverage

beneficiaryId and payor are the only required fields. status is optional (active, cancelled, draft, entered-in-error) and defaults to active. beneficiaryId must point to a Patient in your organization, otherwise the API returns 400.

REST
curl -X POST https://api.esus.health/fhir/Coverage \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "status": "active",
    "beneficiaryId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "payor": [
      { "reference": "Organization/9a8b7c6d-5e4f-3210-9876-543210fedcba" }
    ],
    "subscriberId": "MEMBER-12345",
    "relationship": {
      "coding": [{
        "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
        "code": "self"
      }]
    },
    "period": { "start": "2026-01-01", "end": "2026-12-31" },
    "class": [
      {
        "type": {
          "coding": [{
            "system": "http://terminology.hl7.org/CodeSystem/coverage-class",
            "code": "plan"
          }]
        },
        "value": "HMO-GOLD",
        "name": "Blue Cross Blue Shield — HMO Gold"
      }
    ],
    "order": 1
  }'
SDK
const created = await esus.fhir.create("Coverage", {
  "status": "active",
  "beneficiaryId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "payor": [
    {
      "reference": "Organization/9a8b7c6d-5e4f-3210-9876-543210fedcba"
    }
  ],
  "subscriberId": "MEMBER-12345",
  "relationship": {
    "coding": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/subscriber-relationship",
        "code": "self"
      }
    ]
  },
  "period": {
    "start": "2026-01-01",
    "end": "2026-12-31"
  },
  "class": [
    {
      "type": {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/coverage-class",
            "code": "plan"
          }
        ]
      },
      "value": "HMO-GOLD",
      "name": "Blue Cross Blue Shield — HMO Gold"
    }
  ],
  "order": 1
});

The response is 201 Created with the FHIR resource (resourceType: "Coverage", id, meta.versionId).

Read, Update, and Delete

# Read by id
curl "https://api.esus.health/fhir/Coverage/c1a2e3d4-5b6f-7890-abcd-ef1234567890" \
  -H "Authorization: Bearer YOUR_TOKEN"

# PATCH with a partial body (PUT also merges: omitted fields are kept)
curl -X PATCH "https://api.esus.health/fhir/Coverage/c1a2e3d4-5b6f-7890-abcd-ef1234567890" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{ "status": "cancelled" }'

# Delete (204 No Content)
curl -X DELETE "https://api.esus.health/fhir/Coverage/c1a2e3d4-5b6f-7890-abcd-ef1234567890" \
  -H "Authorization: Bearer YOUR_TOKEN"

PATCH also accepts application/json-patch+json and application/merge-patch+json, and an If-Match: W/"<version>" header returns 412 if the resource changed. Version history is available at /fhir/Coverage/:id/_history and /fhir/Coverage/:id/_history/:vid.

Search Coverages

ParameterMatching
patient / beneficiaryExact patient id (<uuid> or Patient/<uuid>)
statusExact
typePartial text match on the type CodeableConcept
payorPartial text match on the payor references
subscriberPartial text match on the subscriber reference
# All active coverages for a patient
curl "https://api.esus.health/fhir/Coverage?patient=3fa85f64-5717-4562-b3fc-2c963f66afa6&status=active" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Coverages for a payor
curl "https://api.esus.health/fhir/Coverage?payor=Organization/9a8b7c6d-5e4f-3210-9876-543210fedcba" \
  -H "Authorization: Bearer YOUR_TOKEN"

Referencing Coverage from Claim and Account

On a Claim, each insurance[] entry requires sequence, focal, and coverage. Per FHIR, mark the primary coverage with focal: true:

{
  "insurance": [
    {
      "sequence": 1,
      "focal": true,
      "coverage": { "reference": "Coverage/c1a2e3d4-5b6f-7890-abcd-ef1234567890" },
      "preAuthRef": ["PA-2026-12345"]
    }
  ]
}

On an Account, coverage[] lists the coverages backing the account, each with an optional priority:

{
  "coverage": [
    {
      "coverage": { "reference": "Coverage/c1a2e3d4-5b6f-7890-abcd-ef1234567890" },
      "priority": 1
    }
  ]
}