Create or update an order (FHIR ServiceRequest)
post /api/fhir/ServiceRequest
Creates the order, or updates it when an order with the same accession number exists (conditional
on the ACSN identifier, v2-0203). The patient comes from a contained
Patient that subject references, or from
subject.identifier and display. PLAC and
FILL identifiers give the placer and filler order numbers. status
revoked cancels the order.
Scope: fhir:write (hl7 tokens).
Rate limit: Per-token HL7 limit.
Audited as order.receive in the practice's audit log.
Request body
A FHIR R4 ServiceRequest, up to 256 KiB
application/fhir+json
{
"resourceType": "ServiceRequest",
"status": "active",
"intent": "order",
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "ACSN"
}
]
},
"value": "SYNACC0001"
}
],
"code": {
"coding": [
{
"code": "CTHEAD",
"display": "CT head without contrast"
}
]
},
"subject": {
"reference": "#pt"
},
"contained": [
{
"resourceType": "Patient",
"id": "pt",
"identifier": [
{
"value": "SYN-0001"
}
],
"name": [
{
"family": "SYNTHETIC",
"given": [
"PATIENT01"
]
}
],
"birthDate": "1970-01-01"
}
],
"occurrenceDateTime": "2026-03-14T09:00:00Z"
}
Responses
200
Existing order updated
application/fhir+json
| Field | Type | Description |
|---|---|---|
resourceType |
"ServiceRequest" | |
id |
string | |
status |
"active" | "revoked" | "completed" | |
intent |
"order" | |
identifier |
array of object |
201
Order created
| Header | Description |
|---|---|
Location |
The order's URL |
application/fhir+json
| Field | Type | Description |
|---|---|---|
resourceType |
"ServiceRequest" | |
id |
string | |
status |
"active" | "revoked" | "completed" | |
intent |
"order" | |
identifier |
array of object |
{
"resourceType": "ServiceRequest",
"id": "01JA2Z6Q7Y9K3M5N8P0R2S4T6V",
"status": "active",
"intent": "order",
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "ACSN"
}
]
},
"value": "SYNACC0001"
}
]
}
400
Not JSON or not a ServiceRequest (structure). Problem: validation
application/fhir+json
| Field | Type | Description |
|---|---|---|
resourceType |
"OperationOutcome" | |
issue |
array of object |
401
Problem: unauthenticated
403
Problem: forbidden, tenant-suspended, trial-expired
413
Problem: too-large
415
Not application/fhir+json (not-supported)
application/fhir+json
| Field | Type | Description |
|---|---|---|
resourceType |
"OperationOutcome" | |
issue |
array of object |
422
A required element is missing or invalid (required, value)
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 |
| 400 |
validation
|
Invalid request |
Examples
curl
curl -X POST 'https://app.pacspilot.com/api/fhir/ServiceRequest' \
-H "Authorization: Bearer $PACSPILOT_TOKEN" \
-H 'Content-Type: application/fhir+json' \
--data-binary '{
"resourceType": "ServiceRequest",
"status": "active",
"intent": "order",
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "ACSN"
}
]
},
"value": "SYNACC0001"
}
],
"code": {
"coding": [
{
"code": "CTHEAD",
"display": "CT head without contrast"
}
]
},
"subject": {
"reference": "#pt"
},
"contained": [
{
"resourceType": "Patient",
"id": "pt",
"identifier": [
{
"value": "SYN-0001"
}
],
"name": [
{
"family": "SYNTHETIC",
"given": [
"PATIENT01"
]
}
],
"birthDate": "1970-01-01"
}
],
"occurrenceDateTime": "2026-03-14T09:00:00Z"
}'
JavaScript
const res = await fetch("https://app.pacspilot.com/api/fhir/ServiceRequest", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.PACSPILOT_TOKEN}`,
"Content-Type": "application/fhir+json",
},
body: JSON.stringify({
"resourceType": "ServiceRequest",
"status": "active",
"intent": "order",
"identifier": [
{
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "ACSN"
}
]
},
"value": "SYNACC0001"
}
],
"code": {
"coding": [
{
"code": "CTHEAD",
"display": "CT head without contrast"
}
]
},
"subject": {
"reference": "#pt"
},
"contained": [
{
"resourceType": "Patient",
"id": "pt",
"identifier": [
{
"value": "SYN-0001"
}
],
"name": [
{
"family": "SYNTHETIC",
"given": [
"PATIENT01"
]
}
],
"birthDate": "1970-01-01"
}
],
"occurrenceDateTime": "2026-03-14T09:00:00Z"
}),
});
console.log(res.status, await res.text());
Python
import os
import requests
data = "{\n \"resourceType\": \"ServiceRequest\",\n \"status\": \"active\",\n \"intent\": \"order\",\n \"identifier\": [\n {\n \"type\": {\n \"coding\": [\n {\n \"system\": \"http://terminology.hl7.org/CodeSystem/v2-0203\",\n \"code\": \"ACSN\"\n }\n ]\n },\n \"value\": \"SYNACC0001\"\n }\n ],\n \"code\": {\n \"coding\": [\n {\n \"code\": \"CTHEAD\",\n \"display\": \"CT head without contrast\"\n }\n ]\n },\n \"subject\": {\n \"reference\": \"#pt\"\n },\n \"contained\": [\n {\n \"resourceType\": \"Patient\",\n \"id\": \"pt\",\n \"identifier\": [\n {\n \"value\": \"SYN-0001\"\n }\n ],\n \"name\": [\n {\n \"family\": \"SYNTHETIC\",\n \"given\": [\n \"PATIENT01\"\n ]\n }\n ],\n \"birthDate\": \"1970-01-01\"\n }\n ],\n \"occurrenceDateTime\": \"2026-03-14T09:00:00Z\"\n}"
res = requests.request(
"POST",
"https://app.pacspilot.com/api/fhir/ServiceRequest",
headers={"Authorization": f"Bearer {os.environ['PACSPILOT_TOKEN']}", "Content-Type": "application/fhir+json"},
data=data.encode("utf-8"),
)
print(res.status_code, res.text)