Send lab results (FHIR Observation)
post /api/fhir/Observation
Lab results for the pathology lab pack: one Observation, or a Bundle of them. Each needs a patient
identifier in subject (or a contained Patient), a code (LOINC preferred), a status
(final, amended, corrected or preliminary), an
effective time and a valueQuantity, valueString or
valueCodeableConcept. Results are kept only for patients who have a study in the
practice; a preliminary result never replaces a final one. The answer is an informational
OperationOutcome with the counts. 404 specialty-disabled while the pack is off.
Scope: fhir:write (hl7 tokens).
Rate limit: Per-token HL7 limit.
Audited as lab.intake in the practice's audit log.
Request body
A FHIR R4 Observation or Bundle, up to 256 KiB
application/fhir+json
{
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "718-7",
"display": "Hemoglobin"
}
]
},
"subject": {
"identifier": {
"value": "SYN12345"
}
},
"effectiveDateTime": "2026-10-08T08:00:00Z",
"valueQuantity": {
"value": 12.4,
"unit": "g/dL"
},
"referenceRange": [
{
"low": {
"value": 12
},
"high": {
"value": 16
}
}
]
}
Responses
200
Counts of results stored, for unknown patients and skipped (informational)
application/fhir+json
| Field | Type | Description |
|---|---|---|
resourceType |
"OperationOutcome" | |
issue |
array of object |
400
Not JSON, or not an Observation or Bundle (structure)
application/fhir+json
| Field | Type | Description |
|---|---|---|
resourceType |
"OperationOutcome" | |
issue |
array of object |
401
Problem: unauthenticated
403
Problem: forbidden, tenant-suspended, trial-expired
404
Problem: specialty-disabled
413
Problem: too-large
415
Not application/fhir+json (not-supported)
application/fhir+json
| Field | Type | Description |
|---|---|---|
resourceType |
"OperationOutcome" | |
issue |
array of object |
422
An Observation has no patient identifier (required)
application/fhir+json
| Field | Type | Description |
|---|---|---|
resourceType |
"OperationOutcome" | |
issue |
array of object |
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 |
| 404 |
specialty-disabled
|
Specialty pack is off |
Examples
curl
curl -X POST 'https://app.pacspilot.com/api/fhir/Observation' \
-H "Authorization: Bearer $PACSPILOT_TOKEN" \
-H 'Content-Type: application/fhir+json' \
--data-binary '{
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "718-7",
"display": "Hemoglobin"
}
]
},
"subject": {
"identifier": {
"value": "SYN12345"
}
},
"effectiveDateTime": "2026-10-08T08:00:00Z",
"valueQuantity": {
"value": 12.4,
"unit": "g/dL"
},
"referenceRange": [
{
"low": {
"value": 12
},
"high": {
"value": 16
}
}
]
}'
JavaScript
const res = await fetch("https://app.pacspilot.com/api/fhir/Observation", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,
"Content-Type": "application/fhir+json",
},
body: JSON.stringify({
"resourceType": "Observation",
"status": "final",
"code": {
"coding": [
{
"system": "http://loinc.org",
"code": "718-7",
"display": "Hemoglobin"
}
]
},
"subject": {
"identifier": {
"value": "SYN12345"
}
},
"effectiveDateTime": "2026-10-08T08:00:00Z",
"valueQuantity": {
"value": 12.4,
"unit": "g/dL"
},
"referenceRange": [
{
"low": {
"value": 12
},
"high": {
"value": 16
}
}
]
}),
});
console.log(res.status, await res.text());
Python
import os
import requests
data = "{\n \"resourceType\": \"Observation\",\n \"status\": \"final\",\n \"code\": {\n \"coding\": [\n {\n \"system\": \"http://loinc.org\",\n \"code\": \"718-7\",\n \"display\": \"Hemoglobin\"\n }\n ]\n },\n \"subject\": {\n \"identifier\": {\n \"value\": \"SYN12345\"\n }\n },\n \"effectiveDateTime\": \"2026-10-08T08:00:00Z\",\n \"valueQuantity\": {\n \"value\": 12.4,\n \"unit\": \"g/dL\"\n },\n \"referenceRange\": [\n {\n \"low\": {\n \"value\": 12\n },\n \"high\": {\n \"value\": 16\n }\n }\n ]\n}"
res = requests.request(
"POST",
"https://app.pacspilot.com/api/fhir/Observation",
headers={"Authorization": f"Bearer {os.environ['PACSPILOT_TOKEN']}", "Content-Type": "application/fhir+json"},
data=data.encode("utf-8"),
)
print(res.status_code, res.text)