Implementation guide

HL7 chart export API

Generate HL7 messages for chart and patient summaries.

HL7 export

Guide scope

MethodGETAccessexportAuthBearer key

HL7 chart export API

Use HL7 chart export endpoints to generate HL7 v2 messages for patient summaries and chart objects.

Authentication

Send x-api-key with HL7 export scope.

Endpoints

  • GET /exportHl7PatientAdt exports patient demographics as ADT.
  • GET /exportHl7PatientSummary exports a longitudinal patient summary.
  • GET /exportHl7Encounter exports an encounter message.
  • GET /exportHl7Note exports a note message.
  • GET /exportHl7Assessment exports an assessment message.

Required query parameters

  • patientId is required for all patient-specific HL7 exports.
  • encounterId is required for encounter exports.
  • noteId is required for note exports.
  • assessmentId is required for assessment exports.
  • limit controls the number of records in summary exports.

ADT export example

curl -X GET "https://popularishealth.web.app/exportHl7PatientAdt?patientId=patient_12345" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/hl7-v2"

Longitudinal summary example

curl -X GET "https://popularishealth.web.app/exportHl7PatientSummary?patientId=patient_12345&limit=50" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/hl7-v2"

Encounter export example

curl -X GET "https://popularishealth.web.app/exportHl7Encounter?patientId=patient_12345&encounterId=encounter_100" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/hl7-v2"

Note export example

curl -X GET "https://popularishealth.web.app/exportHl7Note?patientId=patient_12345&noteId=note_100" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/hl7-v2"

Assessment export example

curl -X GET "https://popularishealth.web.app/exportHl7Assessment?patientId=patient_12345&assessmentId=assessment_100" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Accept: application/hl7-v2"

Sample HL7 response

MSH|^~\&|EMRDESK|EMRDESK|PARTNER|PARTNER|20260307124500||MDM^T02|MDM1741345500|P|2.5.1
EVN|T02|20260307124500
PID|1||MRN12345^^^EMRDESK^MR||DOE^JANE||19800101|F
PV1|1|O|Main Clinic||||Smith^Jordan
TXA|1|PN|TEXT||20260307124500|Jordan Smith||||note_100||AU|AV
OBX|1|TX|NOTE^ChartNote||Patient reports improved sleep and reduced anxiety

Response headers

  • x-request-id is returned for tracing and can be supplied by the caller.
  • x-ratelimit-limit shows the request limit for the current key.
  • x-ratelimit-remaining shows requests left in the current window.
  • x-ratelimit-reset shows when the current rate-limit window resets.

What gets mapped

  • Patient demographics map into PID and related segments.
  • Encounter context maps into PV1, DG1, and order-oriented segments when available.
  • Notes and assessments map into text and observation segments.

Use HL7 when the partner expects v2 messages. Use FHIR export when the partner can consume resource-based JSON.

Common errors

  • 401: the API key is missing, revoked, or invalid.
  • 403: the key does not include HL7 export scope.
  • 404: the requested patient, encounter, note, assessment, or export object was not found.
  • 429: the partner key exceeded its configured rate limit.

For inbound HL7 messages, review the HL7 intake guide.