SwasthyaDesk hospital software integration
Use HMS API v2 to connect SwasthyaDesk to Dr Perfect Report. Once your hospital’s connection is configured, SwasthyaDesk can send OPD and IPD orders for lab tests and scans, track progress and retrieve approved report PDFs.
Quickstart
- Ask the lab administrator to configure your branch and tariff and issue an
HmsIntegrationkey. - Store the key in your HMS backend and load the catalogue. Use its branch, tariff revision and rates in your order.
- Submit one request and save the returned
orderRefanditemRefvalues. Use them to reconcile charges, follow work and retrieve reports.
Send X-Api-Key with each HMS request and Content-Type: application/json when sending JSON. Import the OpenAPI download into Postman. Set DPR_HMS_KEY in your backend environment and use your lab's provisioned API host.
export DPR_API='https://api.drperfectreport.com'Connection setup
A lab administrator with access to all branches uses a staff bearer token and an active plan with api_access. These are full API paths on https://api.drperfectreport.com.
Authorization: Bearer <staff-access-token>Register the branch and billing mode
/api/hms-connections{
"name": "Example Hospital",
"branchId": "11111111-1111-4111-8111-111111111111",
"hospitalCollectsPayment": true
}Choose the active branch GUID from the lab's branch list (GET /api/branches?isActive=true). Connection creation returns 200 with id, name, branchId, hospitalCollectsPayment, catalogRevision and items. Keep the ID and revision. The branch and billing mode are selected at creation.
/api/hms-connectionsReturns 200 with an array of the lab's connections, including their tariff and revision.
Set the contract tariff
/api/hms-connections/{id}/catalogReplace the entire tariff with up to 2,000 distinct entries, using the current catalogRevision. Each rate is nonnegative INR with up to two decimal places. Send items: [] to clear the tariff. Success returns the updated connection and revision.
{
"catalogRevision": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
"items": [
{"itemType":"Test","itemId":"33333333-3333-4333-8333-333333333333","unitRate":350},
{"itemType":"Test","itemId":"44444444-4444-4444-8444-444444444444","unitRate":900}
]
}Issue and rotate the key
/api/api-keys{
"name": "Example Hospital HMS",
"scope": "HmsIntegration",
"hmsConnectionId": "99999999-9999-4999-8999-999999999999"
}Returns 200 with key metadata and the one-time plainKey. Save the secret in the HMS backend. Optionally send an expiresAt UTC timestamp. List key metadata with GET /api/api-keys.
/api/api-keys/{id}/revokeFor rotation, issue a second key for the same connection, switch the HMS backend and confirm it works, then revoke the old key. Send { "reason": "Rotated" } or an empty JSON object. Success is 204. The connection retains its patient links and orders.
Confirm an existing patient link
/api/hms-connections/{id}/patients/{externalPatientId}Use the lab patient's GUID in patientId when staff have confirmed the match. Success is 204. If the external ID already links to a different patient, the API returns 409 patient_conflict.
{"patientId":"bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb"}ApiKey.Read lists entries. ApiKey.Create creates connections and keys and replaces tariffs. Patient linking also requires Patient.Update. ApiKey.Delete revokes keys.OPD, IPD and billing
Use a stable externalPatientId for the hospital UHID and a stable externalEncounterId for each OPD consultation or IPD admission. All diagnostic requests under one admission use that same encounter ID and a fresh externalRequestId for each submission.
When hospitalCollectsPayment is true, the HMS issues the patient bill and controls patient report delivery. DrPerfectReport handles clinical work and internal printing. The report's QR page can verify the document and directs the patient to the hospital for the PDF. Lab patient billing and direct patient PDF delivery are disabled for these visits.
When the flag is false, the lab bills the patient and applies its own payment hold rules. Settle the hospital's commercial arrangement with the lab separately.
Post charges from the confirmation's accepted unitRate values, deduplicating by orderRef and itemRef. A profile or package is one charge and can expand into several clinical work items. HMS taxes and discounts are handled in the HMS.
Code examples
Set DPR_API to your API host and DPR_HMS_KEY to your connection key in the backend environment. Each example accepts the same commands.
| Command | What it does |
|---|---|
catalog | Print the first page of the branch catalogue with its revision and rates. |
submit | Submit a saved order.json and print the accepted order and charges. Use the OPD or IPD example with your own references and catalogue values. |
track HOSP-REQ-1042 | Look up the original request ID, print the work and report status, and save the first available PDF as report.pdf. |
After an uncertain submission, run track with your original request ID and follow the retry guidance. Run track again when the report is ready.
C# and .NET
Create a console project with dotnet new console and replace Program.cs with this example. Run dotnet run -- catalog from that folder. Use the same syntax for the other commands.
using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
var host = Setting("DPR_API").TrimEnd('/');
using var http = new HttpClient(new HttpClientHandler { AllowAutoRedirect = false })
{
BaseAddress = new Uri($"{host}/api/integration/v2/"),
Timeout = TimeSpan.FromSeconds(30)
};
http.DefaultRequestHeaders.Add("X-Api-Key", Setting("DPR_HMS_KEY"));
switch (args.Length == 0 ? "" : args[0])
{
case "catalog" when args.Length == 1:
Console.WriteLine(await ReadJsonAsync("catalog"));
break;
case "submit" when args.Length == 1:
var payload = await File.ReadAllTextAsync("order.json");
Console.WriteLine(await ReadJsonAsync("orders", payload));
break;
case "track" when args.Length == 2:
var requestId = Uri.EscapeDataString(args[1]);
using (var state = JsonDocument.Parse(await ReadJsonAsync($"orders/by-external-ref/{requestId}")))
{
Console.WriteLine(state.RootElement.GetRawText());
var orderRef = state.RootElement.GetProperty("order").GetProperty("orderRef").GetGuid();
using var reports = JsonDocument.Parse(await ReadJsonAsync($"orders/{orderRef}/reports"));
Console.WriteLine(reports.RootElement.GetRawText());
foreach (var report in reports.RootElement.EnumerateArray())
{
if (report.GetProperty("availability").GetString() != "Available") continue;
var reportId = report.GetProperty("reportId").GetGuid();
using var pdf = await http.GetAsync($"orders/{orderRef}/reports/{reportId}/pdf");
await EnsureSuccessAsync(pdf);
if (pdf.Content.Headers.ContentType?.MediaType != "application/pdf")
throw new InvalidOperationException("Expected application/pdf.");
await File.WriteAllBytesAsync("report.pdf", await pdf.Content.ReadAsByteArrayAsync());
break;
}
}
break;
default:
Console.Error.WriteLine("Use catalog, submit or track <externalRequestId>.");
Environment.ExitCode = 2;
break;
}
async Task<string> ReadJsonAsync(string path, string? payload = null)
{
using var request = new HttpRequestMessage(payload is null ? HttpMethod.Get : HttpMethod.Post, path);
if (payload is not null)
request.Content = new StringContent(payload, Encoding.UTF8, "application/json");
using var response = await http.SendAsync(request);
await EnsureSuccessAsync(response);
return await response.Content.ReadAsStringAsync();
}
static async Task EnsureSuccessAsync(HttpResponseMessage response)
{
if (!response.IsSuccessStatusCode)
throw new HttpRequestException($"HTTP {(int)response.StatusCode}: {await response.Content.ReadAsStringAsync()}");
}
static string Setting(string name) => Environment.GetEnvironmentVariable(name) is { Length: > 0 } value
? value : throw new InvalidOperationException($"Set {name} in the environment.");VB.NET
Create a .NET console project with dotnet new console -lang VB and replace Program.vb with this example. Run dotnet run -- catalog from that folder.
Option Strict On
Option Infer On
Imports System
Imports System.IO
Imports System.Net.Http
Imports System.Text
Imports System.Text.Json
Imports System.Threading.Tasks
Module Program
Function Main(args As String()) As Integer
Try
Return RunAsync(args).GetAwaiter().GetResult()
Catch ex As Exception
Console.Error.WriteLine(ex.Message)
Return 1
End Try
End Function
Private Async Function RunAsync(args As String()) As Task(Of Integer)
Dim command = If(args.Length > 0, args(0), "")
Dim host = Setting("DPR_API").TrimEnd("/"c)
Using http As New HttpClient(New HttpClientHandler With {.AllowAutoRedirect = False}) With {
.BaseAddress = New Uri($"{host}/api/integration/v2/"),
.Timeout = TimeSpan.FromSeconds(30)
}
http.DefaultRequestHeaders.Add("X-Api-Key", Setting("DPR_HMS_KEY"))
If command = "catalog" AndAlso args.Length = 1 Then
Console.WriteLine(Await ReadJsonAsync(http, "catalog"))
ElseIf command = "submit" AndAlso args.Length = 1 Then
Dim payload = Await File.ReadAllTextAsync("order.json")
Console.WriteLine(Await ReadJsonAsync(http, "orders", payload))
ElseIf command = "track" AndAlso args.Length = 2 Then
Await TrackAsync(http, args(1))
Else
Console.Error.WriteLine("Use catalog, submit or track <externalRequestId>.")
Return 2
End If
End Using
Return 0
End Function
Private Async Function TrackAsync(http As HttpClient, requestId As String) As Task
Dim externalRef = Uri.EscapeDataString(requestId)
Using state = JsonDocument.Parse(Await ReadJsonAsync(http, $"orders/by-external-ref/{externalRef}"))
Console.WriteLine(state.RootElement.GetRawText())
Dim orderRef = state.RootElement.GetProperty("order").GetProperty("orderRef").GetGuid()
Dim orderPath = $"orders/{orderRef}"
Using reports = JsonDocument.Parse(Await ReadJsonAsync(http, $"{orderPath}/reports"))
Console.WriteLine(reports.RootElement.GetRawText())
For Each report In reports.RootElement.EnumerateArray()
If report.GetProperty("availability").GetString() <> "Available" Then Continue For
Dim reportId = report.GetProperty("reportId").GetGuid()
Using pdf = Await http.GetAsync($"{orderPath}/reports/{reportId}/pdf")
Await EnsureSuccessAsync(pdf)
If pdf.Content.Headers.ContentType?.MediaType <> "application/pdf" Then
Throw New InvalidOperationException("Expected application/pdf.")
End If
Dim bytes = Await pdf.Content.ReadAsByteArrayAsync()
Await File.WriteAllBytesAsync("report.pdf", bytes)
End Using
Exit For
Next
End Using
End Using
End Function
Private Async Function ReadJsonAsync(http As HttpClient, path As String,
Optional payload As String = Nothing) As Task(Of String)
Dim method = If(payload Is Nothing, HttpMethod.Get, HttpMethod.Post)
Using request As New HttpRequestMessage(method, path)
If payload IsNot Nothing Then
request.Content = New StringContent(payload, Encoding.UTF8, "application/json")
End If
Using response = Await http.SendAsync(request)
Await EnsureSuccessAsync(response)
Return Await response.Content.ReadAsStringAsync()
End Using
End Using
End Function
Private Async Function EnsureSuccessAsync(response As HttpResponseMessage) As Task
If Not response.IsSuccessStatusCode Then
Dim body = Await response.Content.ReadAsStringAsync()
Throw New HttpRequestException($"HTTP {CInt(response.StatusCode)}: {body}")
End If
End Function
Private Function Setting(name As String) As String
Dim value = Environment.GetEnvironmentVariable(name)
If String.IsNullOrWhiteSpace(value) Then
Throw New InvalidOperationException($"Set {name} in the environment.")
End If
Return value
End Function
End ModuleNode.js
Save as hms.mjs and run node hms.mjs catalog.
import { readFile, writeFile } from "node:fs/promises";
const { DPR_API, DPR_HMS_KEY } = process.env;
if (!DPR_API || !DPR_HMS_KEY) throw new Error("Set DPR_API and DPR_HMS_KEY in the environment.");
const base = DPR_API.replace(/\/+$/, "") + "/api/integration/v2";
async function call(path, payload) {
const headers = { "X-Api-Key": DPR_HMS_KEY };
if (payload !== undefined) headers["Content-Type"] = "application/json";
const response = await fetch(`${base}/${path}`, {
method: payload === undefined ? "GET" : "POST",
headers,
body: payload,
redirect: "error",
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}: ${await response.text()}`);
return response;
}
const [command, requestId] = process.argv.slice(2);
if (command === "catalog") {
const catalog = await (await call("catalog")).json();
console.log(JSON.stringify(catalog, null, 2));
} else if (command === "submit") {
const payload = await readFile("order.json");
const order = await (await call("orders", payload)).json();
console.log(JSON.stringify(order, null, 2));
} else if (command === "track" && requestId) {
const state = await (await call(`orders/by-external-ref/${encodeURIComponent(requestId)}`)).json();
console.log(JSON.stringify(state, null, 2));
const orderPath = `orders/${encodeURIComponent(state.order.orderRef)}`;
const reports = await (await call(`${orderPath}/reports`)).json();
console.log(JSON.stringify(reports, null, 2));
const ready = reports.find(report => report.availability === "Available");
if (ready) {
const pdf = await call(`${orderPath}/reports/${encodeURIComponent(ready.reportId)}/pdf`);
if (pdf.headers.get("content-type")?.split(";")[0] !== "application/pdf") {
throw new Error("Expected application/pdf.");
}
await writeFile("report.pdf", Buffer.from(await pdf.arrayBuffer()));
}
} else {
console.error("Use catalog, submit or track <externalRequestId>.");
process.exitCode = 2;
}Python
Save as hms.py and run python3 hms.py catalog. This example uses the standard library.
import json
import os
import sys
from pathlib import Path
from urllib.error import HTTPError
from urllib.parse import quote
from urllib.request import HTTPRedirectHandler, Request, build_opener
host = os.environ["DPR_API"].rstrip("/")
key = os.environ["DPR_HMS_KEY"]
base = f"{host}/api/integration/v2"
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
http = build_opener(NoRedirect())
def call(path, payload=None):
headers = {"X-Api-Key": key}
if payload is not None:
headers["Content-Type"] = "application/json"
request = Request(f"{base}/{path}", data=payload, headers=headers)
try:
with http.open(request, timeout=30) as response:
return response.headers.get_content_type(), response.read()
except HTTPError as error:
detail = error.read().decode("utf-8", errors="replace")
raise SystemExit(f"HTTP {error.code}: {detail}") from None
args = sys.argv[1:]
if args == ["catalog"]:
print(json.dumps(json.loads(call("catalog")[1]), indent=2))
elif args == ["submit"]:
payload = Path("order.json").read_bytes()
print(json.dumps(json.loads(call("orders", payload)[1]), indent=2))
elif len(args) == 2 and args[0] == "track":
request_id = quote(args[1], safe="")
state = json.loads(call(f"orders/by-external-ref/{request_id}")[1])
print(json.dumps(state, indent=2))
order_ref = quote(state["order"]["orderRef"], safe="")
order_path = f"orders/{order_ref}"
reports = json.loads(call(f"{order_path}/reports")[1])
print(json.dumps(reports, indent=2))
ready = next((report for report in reports if report["availability"] == "Available"), None)
if ready:
report_id = quote(ready["reportId"], safe="")
content_type, pdf = call(f"{order_path}/reports/{report_id}/pdf")
if content_type != "application/pdf":
raise SystemExit("Expected application/pdf.")
Path("report.pdf").write_bytes(pdf)
else:
raise SystemExit("Use catalog, submit or track <externalRequestId>.")Catalogue
/catalogThe connection tariff and the branch's enabled investigations determine which items are available.
| Query | Meaning |
|---|---|
search | Optional name or code match, up to 100 characters. |
modality | Optional, case-insensitive. Pathology, Ultrasound, XRay, CT or MRI. Bundles can match more than one modality. |
page | 1–2,000, default 1. |
pageSize | 1–100, default 50. total is the count after filtering. |
curl --fail-with-body "$DPR_API/api/integration/v2/catalog?search=CBC&page=1&pageSize=50" \
-H "X-Api-Key: $DPR_HMS_KEY"{
"branchId": "11111111-1111-4111-8111-111111111111",
"catalogRevision": "22222222-2222-4222-8222-222222222222",
"currency": "INR",
"page": 1,
"pageSize": 50,
"total": 1,
"items": [
{
"itemType": "Test",
"itemId": "33333333-3333-4333-8333-333333333333",
"name": "Complete Blood Count",
"code": "CBC",
"department": "Haematology",
"modalities": ["Pathology"],
"unitRate": 350
}
]
}Create an order
/orders| Field | How to send it |
|---|---|
externalRequestId | Unique request ID within this connection. Keep it for retries and reconciliation. |
externalPatientId, externalEncounterId | Required hospital UHID and consultation or admission ID. |
encounterType | Required uppercase OPD or IPD. |
branchId, catalogRevision | Required GUIDs from your catalogue response. |
items | 1–50 distinct entries with itemType of Test, Profile or Package, and the catalogue itemId and expectedUnitRate. |
patient | Required on first use of an unlinked patient ID. Send fullName (up to 200 characters), gender (1 Male, 2 Female, 3 Other), and dateOfBirth (YYYY-MM-DD) or age (0–150). ageUnit is 1 Years (default), 2 Months or 3 Days. phone is optional. |
orderingDoctor, urgency | Optional. Doctor name up to 150 characters. Urgency is 1 Routine (default), 2 Urgent or 3 Stat. |
answers | Optional array of up to 50 order-question answers with key and value. Use the keys supplied by the lab. |
Each external reference is 1–100 ASCII characters, starts with a letter or digit, and can include dots, hyphens and underscores. The API trims and compares references in uppercase.
Mixed OPD request
This CBC and ultrasound example uses synthetic catalogue IDs. Copy IDs and prices from your connection's catalogue when submitting.
{
"externalRequestId": "HOSP-REQ-1042",
"externalPatientId": "UHID-07014",
"externalEncounterId": "OPD-2026-0612",
"encounterType": "OPD",
"branchId": "11111111-1111-4111-8111-111111111111",
"catalogRevision": "22222222-2222-4222-8222-222222222222",
"patient": {
"fullName": "Synthetic Patient",
"gender": 2,
"dateOfBirth": "1990-05-21"
},
"orderingDoctor": "Dr Example",
"urgency": 1,
"items": [
{"itemType":"Test","itemId":"33333333-3333-4333-8333-333333333333","expectedUnitRate":350},
{"itemType":"Test","itemId":"44444444-4444-4444-8444-444444444444","expectedUnitRate":900}
]
}curl --fail-with-body "$DPR_API/api/integration/v2/orders" \
-H "X-Api-Key: $DPR_HMS_KEY" -H 'Content-Type: application/json' \
--data-binary @order.json{
"orderRef": "55555555-5555-4555-8555-555555555555",
"visitNumber": "DPR/V/2026/00354",
"branchId": "11111111-1111-4111-8111-111111111111",
"externalRequestId": "HOSP-REQ-1042",
"externalPatientId": "UHID-07014",
"externalEncounterId": "OPD-2026-0612",
"encounterType": "OPD",
"currency": "INR",
"total": 1250,
"hospitalCollectsPayment": true,
"items": [
{
"itemRef": "66666666-6666-4666-8666-666666666666",
"itemType": "Test",
"itemId": "33333333-3333-4333-8333-333333333333",
"name": "Complete Blood Count",
"code": "CBC",
"unitRate": 350
},
{
"itemRef": "77777777-7777-4777-8777-777777777777",
"itemType": "Test",
"itemId": "44444444-4444-4444-8444-444444444444",
"name": "Ultrasound Abdomen",
"code": "USG-ABD",
"unitRate": 900
}
]
}Example IPD request for a linked patient
Send the same encounter ID for further requests during this admission. Omit patient once the hospital UHID is linked to a lab patient.
{
"externalRequestId": "HOSP-REQ-1043",
"externalPatientId": "UHID-07014",
"externalEncounterId": "ADM-2026-0031",
"encounterType": "IPD",
"branchId": "11111111-1111-4111-8111-111111111111",
"catalogRevision": "22222222-2222-4222-8222-222222222222",
"items": [
{"itemType":"Test","itemId":"33333333-3333-4333-8333-333333333333","expectedUnitRate":350}
]
}Track and reconcile an order
/orders/{orderRef}/orders/by-external-ref/{requestId}Both endpoints return the saved confirmation in order and current progress. Store the original HMS request ID so you can reconcile submissions before you receive the lab's orderRef.
For pathology read resultStatus and, when linked, sampleStatus. Visit-level sampleStatuses can include specimens registered before they were linked to work. For radiology read imagingStage for each investigation. workRef identifies the clinical item and billableItemRef identifies its charge.
curl --fail-with-body "$DPR_API/api/integration/v2/orders/by-external-ref/HOSP-REQ-1042" \
-H "X-Api-Key: $DPR_HMS_KEY"Show the 200 status response
{
"order": {
"orderRef": "55555555-5555-4555-8555-555555555555",
"visitNumber": "DPR/V/2026/00354",
"branchId": "11111111-1111-4111-8111-111111111111",
"externalRequestId": "HOSP-REQ-1042",
"externalPatientId": "UHID-07014",
"externalEncounterId": "OPD-2026-0612",
"encounterType": "OPD",
"currency": "INR",
"total": 1250,
"hospitalCollectsPayment": true,
"items": [
{
"itemRef": "66666666-6666-4666-8666-666666666666",
"itemType": "Test",
"itemId": "33333333-3333-4333-8333-333333333333",
"name": "Complete Blood Count",
"code": "CBC",
"unitRate": 350
},
{
"itemRef": "77777777-7777-4777-8777-777777777777",
"itemType": "Test",
"itemId": "44444444-4444-4444-8444-444444444444",
"name": "Ultrasound Abdomen",
"code": "USG-ABD",
"unitRate": 900
}
]
},
"visitStatus": "SampleCollected",
"sampleStatuses": ["Collected"],
"items": [
{
"workRef": "66666666-6666-4666-8666-666666666666",
"billableItemRef": "66666666-6666-4666-8666-666666666666",
"modality": "Pathology",
"resultStatus": "Pending",
"imagingStage": null,
"sampleStatus": "Collected"
},
{
"workRef": "77777777-7777-4777-8777-777777777777",
"billableItemRef": "77777777-7777-4777-8777-777777777777",
"modality": "Ultrasound",
"resultStatus": "Pending",
"imagingStage": "Registered",
"sampleStatus": null
}
]
}List and download reports
/orders/{orderRef}/reportsThe list includes reports with a recorded approval. Clinical work can finish at different times, so continue polling pending items, including after IPD discharge. workRefs identify the clinical work covered by the PDF and itemRefs identify the related charges.
[
{
"reportId": "88888888-8888-4888-8888-888888888888",
"reportNumber": "DPR/RPT/2026/00068",
"version": 1,
"generatedAt": "2026-11-28T09:12:00Z",
"modality": "Pathology",
"availability": "Available",
"workRefs": ["66666666-6666-4666-8666-666666666666"],
"itemRefs": ["66666666-6666-4666-8666-666666666666"]
}
]| Availability | HMS action |
|---|---|
Available | Download and apply the billing owner's delivery rules. |
PaymentHold | Wait for the lab to release the report under its payment policy. |
AwaitingReissue | Wait for the lab to approve an updated report. |
Superseded, Withdrawn | Stop serving the old copy and look for a new available report. |
PdfUnavailable | Contact the lab if an approved PDF remains unavailable. |
/orders/{orderRef}/reports/{reportId}/pdf200 streams application/pdf. Check the current listing before serving cached copies. A held report returns 402, an unavailable version returns 409, and an unknown report or order returns 404.
curl --fail "$DPR_API/api/integration/v2/orders/55555555-5555-4555-8555-555555555555/reports/88888888-8888-4888-8888-888888888888/pdf" \
-H "X-Api-Key: $DPR_HMS_KEY" --output report.pdfCancel a billable item
/orders/{orderRef}/items/{itemRef}/cancelUse the confirmation's itemRef. Send a reason of up to 250 characters. Repeat cancellation requests are safe. Started, outsourced or already lab-invoiced work returns 409 cancellation_review_required.
curl --fail-with-body "$DPR_API/api/integration/v2/orders/55555555-5555-4555-8555-555555555555/items/77777777-7777-4777-8777-777777777777/cancel" \
-H "X-Api-Key: $DPR_HMS_KEY" -H 'Content-Type: application/json' \
--data '{"reason":"Clinician cancelled the request"}'{"itemRef":"77777777-7777-4777-8777-777777777777","status":"Cancelled"}After confirmation, reconcile the charge through your HMS credit or refund workflow.
Errors and retries
HMS domain errors include code and message. Invalid JSON or model fields may return validation problem details. Authentication failures can have an empty body.
| HTTP | Recovery |
|---|---|
400 | Correct the request. Check invalid_query, invalid_branch, invalid_order, patient_details_required or item_unavailable. |
401 | Check the backend key or staff token for missing, invalid, expired or revoked credentials. |
402 | payment_hold. The lab must settle or release the report. |
403 | Check the connection key scope, staff permissions and api_access entitlement. |
404 | Check the order, item or report ID for this connection. After an uncertain submission, look up the original request ID. |
409 | Resolve catalog_changed, request_conflict, encounter_conflict, patient_conflict, patient_link_required, report_unavailable or cancellation_review_required. |
503 | retry_later. Reconcile and retry the saved payload with backoff if absent. |
409 request_conflict. After a confirmed catalog_changed rejection, refresh the catalogue and reconfirm the amount before submitting.