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 /exportHl7PatientAdtexports patient demographics as ADT.GET /exportHl7PatientSummaryexports a longitudinal patient summary.GET /exportHl7Encounterexports an encounter message.GET /exportHl7Noteexports a note message.GET /exportHl7Assessmentexports an assessment message.
Required query parameters
patientIdis required for all patient-specific HL7 exports.encounterIdis required for encounter exports.noteIdis required for note exports.assessmentIdis required for assessment exports.limitcontrols 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¬eId=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 anxietyResponse headers
x-request-idis returned for tracing and can be supplied by the caller.x-ratelimit-limitshows the request limit for the current key.x-ratelimit-remainingshows requests left in the current window.x-ratelimit-resetshows 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.
