Explore documentation

Media and Images

Managing clinical media and images

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.

Media Resource

Media represents audio, video, and images captured in clinical workflows: patient photos, wound images, ultrasound clips, and more.

API convention: patient and encounter are flat ids (subjectId, encounterId). operator and device use the standard FHIR reference shape. The bytes are uploaded with POST /files/upload and referenced from content.url.

Create Media

content (a single attachment) is required. status defaults to completed.

REST
curl -X POST https://api.esus.health/fhir/Media \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/fhir+json" \
  -d '{
    "status": "completed",
    "type": {
      "coding": [{
        "system": "http://terminology.hl7.org/CodeSystem/media-type",
        "code": "image",
        "display": "Image"
      }]
    },
    "modality": {
      "coding": [{
        "system": "http://dicom.nema.org/resources/ontology/DCM",
        "code": "XC",
        "display": "External-camera Photography"
      }]
    },
    "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "encounterId": "c1a2e3d4-5b6f-7890-abcd-ef1234567890",
    "createdDateTime": "2026-04-21T10:30:00Z",
    "operator": {
      "reference": "Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789"
    },
    "bodySite": {
      "coding": [{
        "system": "http://snomed.info/sct",
        "code": "72037002",
        "display": "Left lower leg"
      }]
    },
    "note": [{ "text": "Wound assessment — day 3 post-surgery" }],
    "content": {
      "contentType": "image/jpeg",
      "url": "https://api.esus.health/files/b8f0c2d1-9e3a-4f5b-8c7d-1a2b3c4d5e6f",
      "title": "wound-day3.jpg"
    }
  }'
SDK
const created = await esus.fhir.create("Media", {
  "status": "completed",
  "type": {
    "coding": [
      {
        "system": "http://terminology.hl7.org/CodeSystem/media-type",
        "code": "image",
        "display": "Image"
      }
    ]
  },
  "modality": {
    "coding": [
      {
        "system": "http://dicom.nema.org/resources/ontology/DCM",
        "code": "XC",
        "display": "External-camera Photography"
      }
    ]
  },
  "subjectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "encounterId": "c1a2e3d4-5b6f-7890-abcd-ef1234567890",
  "createdDateTime": "2026-04-21T10:30:00Z",
  "operator": {
    "reference": "Practitioner/a7b1c2d3-e4f5-6789-abcd-ef0123456789"
  },
  "bodySite": {
    "coding": [
      {
        "system": "http://snomed.info/sct",
        "code": "72037002",
        "display": "Left lower leg"
      }
    ]
  },
  "note": [
    {
      "text": "Wound assessment — day 3 post-surgery"
    }
  ],
  "content": {
    "contentType": "image/jpeg",
    "url": "https://api.esus.health/files/b8f0c2d1-9e3a-4f5b-8c7d-1a2b3c4d5e6f",
    "title": "wound-day3.jpg"
  }
});

Other accepted fields: identifier, basedOn, partOf, view, createdPeriod, issued, reasonCode, deviceName, device, height, width, frames.

For a video (e.g. an ultrasound clip), set type to the video code and use a video contentType — note that the upload whitelist only accepts the formats listed on the Uploading Document Content page (common video formats such as MP4 are not on that list today).

Media Status

StatusMeaning
preparationCapture planned / being prepared
in-progressCapture in progress
not-doneCapture was not performed
on-holdCapture paused
stoppedCapture stopped
completedCapture completed (default)
entered-in-errorRecording error
unknownStatus unknown

Search Media

Media supports three search parameters: patient (exact id), status (exact) and type (substring of the stored type JSON, e.g. type=image). _include is not supported.

# All media for a patient
curl "https://api.esus.health/fhir/Media?patient=3fa85f64-5717-4562-b3fc-2c963f66afa6" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Images only
curl "https://api.esus.health/fhir/Media?patient=3fa85f64-5717-4562-b3fc-2c963f66afa6&type=image" \
  -H "Authorization: Bearer YOUR_TOKEN"