Skip to content

xr/chest

Chest radiograph read: urgent flags, findings with boxes, device tips, CTR and interval change.

BetaCR · DXChestRadiologyEmergencyv1.0.0 · $0.05 / request

About

The full read of the chest radiograph study: every film is checked and routed, the frontal film is read and the result contains all sections the study supports.

Endpoint xr/chest/interpret · version 1.0.0 · $0.05 per request · the bare id xr/chest is an alias.

1. Calling the API#

Set up your API key#

Create a key in Settings → API Keys and set it as MEDRUN_KEY in your runtime.

export MEDRUN_KEY="YOUR_API_KEY"

Submit a request#

Every call is asynchronous: submitting returns a request with its id and status, and you follow it until the result is ready.

response=$(curl --request POST \
  --url https://api.medrun.ai/v1/run/xr/chest/interpret \
  --header "Authorization: Bearer $MEDRUN_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "input": {
    "files": [
      "file_01K7XRCHEST000000000000000"
    ],
    "options": {
      "report": false
    }
  }
}')
REQUEST_ID=$(echo "$response" | jq -r .id)

Request status

The submit call returns the request, not the result. Use the queue calls below to check its status and fetch the result, or subscribe to a webhook.

Stream progress#

Stages stream as server-sent events (received, queued, preprocessing, inference, report, completed). Critical findings are flagged first, before the full result.

curl --no-buffer \
  --url https://api.medrun.ai/v1/requests/$REQUEST_ID/events \
  --header "Authorization: Bearer $MEDRUN_KEY" \
  --header "Accept: text/event-stream"

2. Authentication#

The API uses API keys. Send Authorization: Bearer $MEDRUN_KEY with every call. Test keys (mr_test_…) run against the mock backend for free.

API key#

Protect your API key

Never ship a key in browser or mobile code. Call MedRun from your server, or use a server-side proxy.

3. Queue#

Long-running requests

Whole studies can take a minute or more. Rely on the event stream or webhooks instead of blocking while you wait.

Fetch request status#

Statuses run queued → preparing → running and end in succeeded, failed, canceled, rejected or expired.

curl --request GET \
  --url https://api.medrun.ai/v1/requests/$REQUEST_ID \
  --header "Authorization: Bearer $MEDRUN_KEY"

Get the result#

When the request has succeeded, output holds the result envelope. See the result format.

curl --request GET \
  --url https://api.medrun.ai/v1/requests/$REQUEST_ID \
  --header "Authorization: Bearer $MEDRUN_KEY" | jq .output

4. Files#

files is a flat list: DICOM files, folders, CD exports (DICOMDIR) and zip/tar archives. The platform groups them into series and runs.

Uploading files#

# 1. Create the upload (one PUT up to 100 MB; larger files get multipart part URLs)
upload=$(curl --request POST --url https://api.medrun.ai/v1/uploads \
  --header "Authorization: Bearer $MEDRUN_KEY" --header "Content-Type: application/json" \
  --data '{"filename": "study.zip", "bytes": 214000000, "media_type": "application/zip"}')
# 2. PUT the bytes to upload.url (with upload.headers)
curl --request PUT --upload-file study.zip "$(echo "$upload" | jq -r .upload.url)"
# 3. Complete it, then pass file.id in input.files
curl --request POST --url "$(echo "$upload" | jq -r .complete_url)" --header "Authorization: Bearer $MEDRUN_KEY"
FILE_ID=$(echo "$upload" | jq -r .file.id)

Hosted files (URL)#

You can also pass https URLs, for example signed S3 or GCS links. MedRun fetches them when the request starts.

5. Webhooks#

Add a webhook to the submit body. MedRun POSTs the request object, signed with Standard Webhooks headers, when the request ends. Configure secrets and see deliveries in Settings → Webhooks.

{
  "input": {
    "files": [
      "file_…"
    ]
  },
  "webhook": {
    "url": "https://example.org/medrun/webhook",
    "events": [
      "request.succeeded",
      "request.failed"
    ]
  }
}

6. Schema#

Input#

  • fileslist<string>* required

    The chest radiograph study: DICOM files, a folder, a CD export or a zip; PNG/JPEG images are read too. `file_…` ids from /v1/uploads or https URLs.

  • prior_fileslist<string>

    Optional earlier chest film of the same patient (the comparison section joins in a later version).

  • clinical_contextobject

    Optional. Age is used when the DICOM header has none; never names, IDs or dates.

    • age_yearsinteger

      Range: 0 … 130

    • sexenum

      Possible values: female, male, other, unknown

    • indicationstring

      For example "dyspnoea after line insertion" or "ICU morning film, intubated".

  • optionsobject
    • reportbooleanadd-on

      Adds a draft chest radiograph report written from the structured result (English). +$0.02 per run.

      Default value: false

    • report_languageenum

      Default value: "en"

      Possible values: en

    • returnlist<enum>

      JSON is always returned. DICOM objects reference your original UIDs.

      Default value: ["json","dicom-sr","dicom-seg"]

      Possible values: json, dicom-sr, dicom-seg

Example input:

{
  "files": [
    "file_01K7XRCHEST000000000000000"
  ],
  "options": {
    "report": false
  }
}

Output#

The output is the MedRun result envelope: sections[] with a status per section, then findings, measurements, scores, classifications, guidance, the optional report and artifacts (DICOM SR/SEG, overlays, PDF, FHIR).

  • triage Triage: Worklist priority: critical for pneumothorax, a malpositioned endotracheal or nasogastric tube, free air or pneumomediastinum; urgent for effusion, consolidation, a widened mediastinum, a malpositioned central line or a nasogastric tip off the film; routine otherwise. Every flag points to its finding.
  • quality Image quality: Projection (PA, AP or lateral) of the read film, rotation of the stored image, calibration and exposure flags; rotation, inspiration and penetration of the patient join later.
  • findings Findings: Normal or abnormal, and a 37-finding panel in Fleischner glossary terms: the 17 findings with a radiologist reference are always stated (present, absent, or for consolidation, nodule or mass and cardiomegaly also not excluded); the others are listed when present. Boxes for local findings join with the VinDr-trained detector.
  • pneumothorax Pneumothorax: Pneumothorax present or absent, with side and outline on the film. Rim size by the BTS and ACCP conventions and chest-drain detection join later.
  • lines-tubes Lines and tubes: Endotracheal tube, nasogastric tube, central venous catheter and Swan-Ganz catheter: presence, outline and the RANZCR position category (normal, borderline, abnormal; nasogastric tip not on the film); the endotracheal tube tip, the carina and the tip-to-carina distance in millimetres when the film carries a pixel spacing.
  • pneumonia Pneumonia: Airspace opacity consistent with pneumonia, with side and outline; lobe joins later.
  • tuberculosis Tuberculosis: TB abnormality score 0–100 with a locally set threshold for screening programmes (WHO CAD), after a bacteriologically confirmed evaluation.
  • lung-nodules Lung nodules: Nodule and mass boxes with diameter and a CT recommendation.
  • cardiomegaly Cardiothoracic ratio: Heart and thoracic widths and the cardiothoracic ratio on PA films.
  • effusion Pleural effusion: Effusion side and size grade (blunting, meniscus, half the hemithorax or more).
  • edema Pulmonary oedema: Oedema severity 0–3 and the RALE score.
  • fractures Fractures: Rib, clavicle, scapula and vertebral fractures with boxes and rib numbers.
  • segment-anatomy Anatomy segmentation: Lungs, heart, clavicles, scapulae, mediastinum, aorta, diaphragm and spine outlines (lungs and heart already come with every read as evidence).
  • compare Comparison with prior: Per-finding change against a prior film (improving, stable, worsening), new and resolved findings, device moves.
  • cvd-risk Cardiovascular risk: Ten-year cardiovascular risk from the frontal film.
  • lung-cancer-risk Lung cancer risk: Long-term lung-cancer risk and the screening suggestion.
  • report Draft report: Opt-in draft report (findings, impression, limitations) written from the structured result; every number is validated against it.

OpenAPI document: https://api.medrun.ai/v1/models/xr/chest/interpret/openapi.json