Skip to main content
Docs vCurrentAPI
Version: Current

HL7 v2

Send a medication order in HL7 v2 format (ORM^O01 / RDE^O11) and get the native SauBit risk analysis. Useful for legacy integrations that still exchange HL7 v2.

Copia um prompt pronto com fluxo de integração, payload e exemplos.

Endpoint

POST /api/v1/hl7v2/$check (API key auth, scope interactions:check).

The body can be:

  • the raw HL7 message (Content-Type: text/plain), segments separated by \r; or
  • a JSON envelope: { "message": "MSH|^~\\&|..." }.

Segments read

SegmentUse
MSHHeader; field/component separators.
PIDAge (from PID-7, date of birth) and sex (PID-8).
AL1Allergies (AL1-3).
DG1Conditions/diagnoses (DG1-3/DG1-4).
RXO / RXEMedications: name (RXO-1/RXE-2), dose (RXO-2/RXE-3 + units; g→mg).
RXRRoute (associated with the last medication).
OBXLabs by identifier/text: potassium, INR, QTc.

The medication name uses the text component of the coded field (e.g. IBUPRO^Ibuprofeno^LIbuprofeno).

Example

curl -X POST "https://api.saubit.com.br/api/v1/hl7v2/\$check" \
-H "X-API-Key: sm_live_..." \
-H "Content-Type: text/plain" \
--data-binary $'MSH|^~\\&|EHR|HOSP|SAUBIT|SAUBIT|20260629||RDE^O11|MSG1|P|2.5\rPID|1||123||SILVA^JOAO||19500101|M\rDG1|1||N18.5^Insuficiência renal crônica^I10\rRXE|1|IBUPRO^Ibuprofeno^L|400|||mg\rRXE|2|NAPRO^Naproxeno^L|500|||mg'

The response is the native SauBit JSON (prescription_risk_level, interactions, clinical_alerts, …), identical to /interactions/check. Messages without MSH or without RXO/RXE return 422.

Also supports Idempotency-Key (see Best practices).