Send HL7 v2 messages
post /api/v1/hl7
One HL7 v2 message (any 2.x version; ORM, OMG, OMI, ORU, ADT, MDM with a CDA document) or a batch
file (FHS/BHS … BTS/FTS, at most 200 messages) in ER7 with segments separated by carriage returns.
The character set comes from MSH-18. Each message is answered with an HL7 ACK:
AA when applied or not needed, AE or AR with the reason in
MSA-3. Orders link to studies by Study Instance UID, else by accession number. The HTTP status is
400 only when a message cannot be parsed at all, so read the ACK.
Scope: hl7:write (hl7 tokens).
Rate limit: Per-token HL7 limit.
Audited as order.receive in the practice's audit log.
Request body
ER7, up to 1 MiB
x-application/hl7-v2+er7
MSH|^~\&|SYNRIS|SYNCLINIC|PACSPILOT|PACSPILOT|20260314083000||ORM^O01|MSG00001|P|2.5.1
PID|1||SYN-0001^^^SYN^MR||SYNTHETIC^PATIENT01||19700101|O
ORC|NW|PLC0001|SYNACC0001
OBR|1|PLC0001|SYNACC0001|CTHEAD^CT head without contrast|||20260314090000
Responses
200
HL7 ACK (or batch ACK)
x-application/hl7-v2+er7
MSH|^~\&|PACSPILOT|PACSPILOT|SYNRIS|SYNCLINIC|20260314083001||ACK^O01|01JA2Z6Q7Y9K3M5N8P0R2S4T6V|P|2.5.1
MSA|AA|MSG00001|1 order(s)
400
The message could not be parsed: ACK with AR. Problem: validation
x-application/hl7-v2+er7
401
Problem: unauthenticated
403
Problem: forbidden, tenant-suspended, trial-expired
413
Problem: too-large
429
Problem: rate-limited
500
Problem: internal
503
Problem: tenant-migrating
Errors
| Status | Type | Meaning |
|---|---|---|
| 401 |
unauthenticated
|
Not authenticated |
| 403 |
forbidden
|
Not allowed |
| 500 |
internal
|
Internal error |
| 429 |
rate-limited
|
Rate limited |
| 503 |
tenant-migrating
|
Practice is being moved |
| 403 |
tenant-suspended
|
Practice is read-only |
| 403 |
trial-expired
|
Trial has ended |
| 413 |
too-large
|
Message too large |
| 400 |
validation
|
Invalid request |
Examples
curl
curl -X POST 'https://app.pacspilot.com/api/v1/hl7' \
-H "Authorization: Bearer $PACSPILOT_TOKEN" \
-H 'Content-Type: x-application/hl7-v2+er7' \
--data-binary @message.hl7
JavaScript
import { readFile } from "node:fs/promises";
const res = await fetch("https://app.pacspilot.com/api/v1/hl7", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,
"Content-Type": "x-application/hl7-v2+er7",
},
body: await readFile("message.hl7"),
});
console.log(res.status, await res.text());
Python
import os
import requests
with open("message.hl7", "rb") as f:
data = f.read()
res = requests.request(
"POST",
"https://app.pacspilot.com/api/v1/hl7",
headers={"Authorization": f"Bearer {os.environ['PACSPILOT_TOKEN']}", "Content-Type": "x-application/hl7-v2+er7"},
data=data,
)
print(res.status_code, res.text)