Skip to content

SunCharts EHR API

Orders and results

EHR API as of 26.11.11.41 11 operations openapi.json ↓

# Result review inbox

GET /api/v1/labs/inbox

Up to 100 current preliminary/final/corrected report revisions without an acknowledgment; tenant scoped. Includes critical flag, patient/order/report identity and version. Not an external paging/escalation service.

Access OAuth 2.0 access tokenclinical.read

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl "$EHR_URL/api/v1/labs/inbox" -H "Authorization: Bearer $ACCESS_TOKEN"

# Patient orders and results

GET /api/v1/patients/{patient}/orders

Single-snapshot native orders, immutable specimen intake, current report versions and all acknowledgments. Staff only; source signatures remain external_unverified. No patient-portal release.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
patient required path string (uuid)

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl "$EHR_URL/api/v1/patients/{patient}/orders" -H "Authorization: Bearer $ACCESS_TOKEN"

# Create local order

POST /api/v1/patients/{patient}/orders

Clinician/owner only. Draft order, optional patient-matching visit/source order. Required request_id provides exact retry safety; changed reuse conflicts. No external transmission.

Access OAuth 2.0 access tokenclinical.write

Parameters

Name In Type Details
patient required path string (uuid)

Request body application/json · required

Fields NewLabOrder · 15
Field Type Details
content required OrderContent
category required string one of laboratory, imaging, procedure
clinical_reason required string length ≤ 2000
destination required string length ≤ 200
priority required string one of routine, urgent, stat
tests required array of RequestedLabTest items 1–30
key required string length ≤ 80
label required string length ≤ 200
code ClinicalCoding or null
title required string length ≤ 200
instructions string length ≤ 4000
reason required string length ≤ 1000
request_id required string (uuid)
source_history_id string or null
visit_id string or null
Example request body placeholder values
{
  "content": {
    "category": "laboratory",
    "clinical_reason": "string",
    "destination": "string",
    "priority": "routine",
    "tests": [
      {
        "key": "string",
        "label": "string",
        "code": {
          "code": null,
          "system": null,
          "display": null
        }
      }
    ],
    "title": "string",
    "instructions": "string"
  },
  "reason": "string",
  "request_id": "00000000-0000-4000-8000-000000000000",
  "source_history_id": "00000000-0000-4000-8000-000000000000",
  "visit_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl -X POST "$EHR_URL/api/v1/patients/{patient}/orders" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Edit draft order

PUT /api/v1/patients/{patient}/orders/{order}

Draft only. Complete replacement of content and nullable visit link. Placed order content stays unchanged; cancel and create a replacement. Appends attributed revision.

Access OAuth 2.0 access tokenclinical.write

Parameters

Name In Type Details
patient required path string (uuid)
order required path string (uuid)
If-Match required header string Quoted current order version.

Request body application/json · required

Fields EditLabOrder · 13
Field Type Details
content required OrderContent
category required string one of laboratory, imaging, procedure
clinical_reason required string length ≤ 2000
destination required string length ≤ 200
priority required string one of routine, urgent, stat
tests required array of RequestedLabTest items 1–30
key required string length ≤ 80
label required string length ≤ 200
code ClinicalCoding or null
title required string length ≤ 200
instructions string length ≤ 4000
reason required string length ≤ 1000
visit_id string or null
Example request body placeholder values
{
  "content": {
    "category": "laboratory",
    "clinical_reason": "string",
    "destination": "string",
    "priority": "routine",
    "tests": [
      {
        "key": "string",
        "label": "string",
        "code": {
          "code": null,
          "system": null,
          "display": null
        }
      }
    ],
    "title": "string",
    "instructions": "string"
  },
  "reason": "string",
  "visit_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl -X PUT "$EHR_URL/api/v1/patients/{patient}/orders/{order}" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Transition local order

POST /api/v1/patients/{patient}/orders/{order}/actions

Place draft locally; cancel/error before final results; complete only with final/corrected coverage for every requested test and acknowledgment of every current non-error report. Completion does not imply external delivery.

Access OAuth 2.0 access tokenclinical.write

Parameters

Name In Type Details
patient required path string (uuid)
order required path string (uuid)
If-Match required header string Quoted current order version.

Request body application/json · required

Fields LabOrderAction · 2
Field Type Details
action required string one of place, cancel, entered_in_error, complete
reason required string length ≤ 1000
Example request body placeholder values
{
  "action": "place",
  "reason": "string"
}

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl -X POST "$EHR_URL/api/v1/patients/{patient}/orders/{order}/actions" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Order revision history

GET /api/v1/patients/{patient}/orders/{order}/history

Immutable attributed snapshots including state changes, newest first.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
patient required path string (uuid)
order required path string (uuid)

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl "$EHR_URL/api/v1/patients/{patient}/orders/{order}/history" -H "Authorization: Bearer $ACCESS_TOKEN"

# Record panel report

POST /api/v1/patients/{patient}/orders/{order}/reports

Preliminary or final local entry. Exact request_id retries safe. Requested test keys and any specimen must belong to this order; rejected samples cannot support results. Final labs require received specimen; only linked imported reports may explicitly assert specimen_not_recorded. Source reports must match the reconciled source order. Every entry has an attributed immutable revision.

Access OAuth 2.0 access tokenclinical.write

Parameters

Name In Type Details
patient required path string (uuid)
order required path string (uuid)
If-Match required header string Quoted current order version.

Request body application/json · required

Fields NewLabReport · 25
Field Type Details
content required LabReportContent
accession required string length ≤ 120
observations required array of LabObservation items 1–100
flag required string one of unknown, normal, abnormal, high, low, critical_high, critical_low, critical
label required string length ≤ 200
value_type required string one of numeric, text, coded, absent
absent_reason string length ≤ 200
code ClinicalCoding or null
coded ClinicalCoding or null
comparator string one of , <, <=, >, >=
notes string length ≤ 4000
number number or null
reference_range string length ≤ 500
text string length ≤ 4000
units string length ≤ 100
performing_lab required string length ≤ 200
reported_at required string (date-time)
test_keys required array of string items 1–30
notes string length ≤ 10000
specimen_id string or null
specimen_not_recorded boolean default false
reason required string length ≤ 1000
request_id required string (uuid)
status required string one of preliminary, final
source_history_id string or null
Example request body placeholder values
{
  "content": {
    "accession": "string",
    "observations": [
      {
        "flag": "unknown",
        "label": "string",
        "value_type": "numeric",
        "absent_reason": "string",
        "code": {
          "code": null,
          "system": null,
          "display": null
        },
        "coded": {
          "code": null,
          "system": null,
          "display": null
        },
        "comparator": "",
        "notes": "string"
      }
    ],
    "performing_lab": "string",
    "reported_at": "2026-01-15T15:30:00Z",
    "test_keys": [
      "string"
    ],
    "notes": "string",
    "specimen_id": "00000000-0000-4000-8000-000000000000",
    "specimen_not_recorded": false
  },
  "reason": "string",
  "request_id": "00000000-0000-4000-8000-000000000000",
  "status": "preliminary",
  "source_history_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl -X POST "$EHR_URL/api/v1/patients/{patient}/orders/{order}/reports" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Revise panel report

PUT /api/v1/patients/{patient}/orders/{order}/reports/{report}

Current report version required. Preliminary -> preliminary/final/error. Final/corrected -> corrected/error with required reason. Original revisions remain unchanged. Any revision reopens completed order and requires its own acknowledgment. Source provenance is retained.

Access OAuth 2.0 access tokenclinical.write

Parameters

Name In Type Details
patient required path string (uuid)
order required path string (uuid)
report required path string (uuid)
If-Match required header string Quoted current report version.

Request body application/json · required

Fields EditLabReport · 23
Field Type Details
content required LabReportContent
accession required string length ≤ 120
observations required array of LabObservation items 1–100
flag required string one of unknown, normal, abnormal, high, low, critical_high, critical_low, critical
label required string length ≤ 200
value_type required string one of numeric, text, coded, absent
absent_reason string length ≤ 200
code ClinicalCoding or null
coded ClinicalCoding or null
comparator string one of , <, <=, >, >=
notes string length ≤ 4000
number number or null
reference_range string length ≤ 500
text string length ≤ 4000
units string length ≤ 100
performing_lab required string length ≤ 200
reported_at required string (date-time)
test_keys required array of string items 1–30
notes string length ≤ 10000
specimen_id string or null
specimen_not_recorded boolean default false
reason required string length ≤ 1000
status required string one of preliminary, final, corrected, entered_in_error
Example request body placeholder values
{
  "content": {
    "accession": "string",
    "observations": [
      {
        "flag": "unknown",
        "label": "string",
        "value_type": "numeric",
        "absent_reason": "string",
        "code": {
          "code": null,
          "system": null,
          "display": null
        },
        "coded": {
          "code": null,
          "system": null,
          "display": null
        },
        "comparator": "",
        "notes": "string"
      }
    ],
    "performing_lab": "string",
    "reported_at": "2026-01-15T15:30:00Z",
    "test_keys": [
      "string"
    ],
    "notes": "string",
    "specimen_id": "00000000-0000-4000-8000-000000000000",
    "specimen_not_recorded": false
  },
  "reason": "string",
  "status": "preliminary"
}

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl -X PUT "$EHR_URL/api/v1/patients/{patient}/orders/{order}/reports/{report}" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Acknowledge report revision

POST /api/v1/patients/{patient}/orders/{order}/reports/{report}/acknowledge

Clinical acknowledgment of current preliminary/final/corrected version with review/follow-up note. Does not send a message or notify the patient. New versions need new acknowledgment. Exact repeat is safe; changing the existing acknowledgment note conflicts.

Access OAuth 2.0 access tokenclinical.write

Parameters

Name In Type Details
patient required path string (uuid)
order required path string (uuid)
report required path string (uuid)
If-Match required header string Quoted current report version.

Request body application/json · required

Fields LabAcknowledgment · 1
Field Type Details
note required string length ≤ 2000
Example request body placeholder values
{
  "note": "string"
}

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl -X POST "$EHR_URL/api/v1/patients/{patient}/orders/{order}/reports/{report}/acknowledge" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json

# Report revision history

GET /api/v1/patients/{patient}/orders/{order}/reports/{report}/history

Immutable result snapshots, status, author, reason and source-signature origin, newest first.

Access OAuth 2.0 access tokenclinical.read

Parameters

Name In Type Details
patient required path string (uuid)
order required path string (uuid)
report required path string (uuid)

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl "$EHR_URL/api/v1/patients/{patient}/orders/{order}/reports/{report}/history" -H "Authorization: Bearer $ACCESS_TOKEN"

# Record specimen intake

POST /api/v1/patients/{patient}/orders/{order}/specimens

Immutable received/rejected laboratory specimen intake. Patient/order scoped. Collection <= receipt <= now+5min; rejected intake requires notes. Exact request_id retry returns original ID. Record replacements separately; post-intake amendment remains pending.

Access OAuth 2.0 access tokenclinical.write

Parameters

Name In Type Details
patient required path string (uuid)
order required path string (uuid)
If-Match required header string Quoted current order version.

Request body application/json · required

Fields NewLabSpecimen · 10
Field Type Details
content required SpecimenContent
accession required string length ≤ 120
body_site required string length ≤ 200
collected_at required string (date-time)
notes required string length ≤ 4000
received_at required string (date-time)
specimen_type required string length ≤ 200
status required string one of received, rejected
reason required string length ≤ 1000
request_id required string (uuid)
Example request body placeholder values
{
  "content": {
    "accession": "string",
    "body_site": "string",
    "collected_at": "2026-01-15T15:30:00Z",
    "notes": "string",
    "received_at": "2026-01-15T15:30:00Z",
    "specimen_type": "string",
    "status": "received"
  },
  "reason": "string",
  "request_id": "00000000-0000-4000-8000-000000000000"
}

Responses

200 Success
400 Invalid data or clinical relationship
401 Authentication required
403 Clinical role/scope denied
404 Record not in authenticated clinic/patient
409 Invalid transition, stale version, request ID collision or duplicate source mapping
413 Request exceeds 64KiB
428 Current quoted If-Match version required

Example call

curl -X POST "$EHR_URL/api/v1/patients/{patient}/orders/{order}/specimens" -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" -d @body.json