Documents
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).operatoranddeviceuse the standard FHIR reference shape. The bytes are uploaded withPOST /files/uploadand referenced fromcontent.url.
Create Media
content (a single attachment) is required. status defaults to completed.
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"
}
}'
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
| Status | Meaning |
|---|---|
preparation | Capture planned / being prepared |
in-progress | Capture in progress |
not-done | Capture was not performed |
on-hold | Capture paused |
stopped | Capture stopped |
completed | Capture completed (default) |
entered-in-error | Recording error |
unknown | Status 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"