API and FHIR

All endpoints are JSON over HTTPS and scoped to the signed-in user's hospital (tenant). Sessions are HttpOnly, Secure, SameSite=Strict cookies; writes also require a same-site Origin. Every write is checked against the role rules and the safety rules on the server, and recorded in the audit log.

Session

POST
/api/start

Create a private hospital workspace with synthetic data and sign in. Body {"role": "coder" | "manager" | "physician" | "finance"}. Limited per network.

POST
/api/role

In a hospital workspace, switch to a colleague's role.

GET
/api/me

User, role, hospital and the working date.

Before sending

GET
/api/prebill

Unsent claims with the value at risk and the rules that would deny them.

GET
/api/claims/{id}

Claim, note with coded evidence spans, checks (for unsent claims) or the denial case, approvals, history and audit. The patient appears as initials and record number.

POST
/api/claims/{id}/code

Code the note. {"ai": true} adds the language model; each suggestion must quote the note exactly and pass the negation and injection checks, or it is returned under rejected with the reason.

POST
/api/claims/{id}/fix

Apply one check's fix ({"index": n}) or every safe fix ({"all": true}). Coders and managers only.

POST
/api/claims/{id}/submit

Send to the insurer once. Duplicates and late claims are refused with the violated rule.

Autopilot

GET
/api/autopilot

The manager's policy, the queue and recent runs.

POST
/api/autopilot/policy

Manager only. Which administrative fixes may run unattended, auto-send and auto-resubmit, and the model-risk ceiling for sending. Clinical changes cannot be enabled.

POST
/api/autopilot/start · /api/autopilot/step

Start a run, then work up to four claims per step. Each result carries the outcome (sent, resubmitted, or routed to a coder, doctor or manager) and the step-by-step trace.

Front desk and payments

GET
/api/frontdesk

Next week's bookings and what was found for each.

POST
/api/frontdesk/{id}/prepare

Check eligibility, request prior approvals from the insurer, and estimate the patient's share.

GET
/api/payments

Remittances reconciled against approved amounts: totals, per-insurer days to pay, and the exceptions (underpaid, not paid, paid twice).

POST
/api/payments/{claim}

Manager or finance: raise a dispute, chase a missing payment or return an overpayment, with the letter drafted.

GET
/api/model

The denial-risk model's version and test metrics. Each unsent claim in /api/claims/{id} carries its risk and the factors behind it.

Denials

GET
/api/worklist

Open denials ranked by expected recovery weighted by deadline, with the proposed action and who must approve it.

POST
/api/claims/{id}/decide

{"decision": "approve" | "reject"}. Records the caller's approval; when every required role has approved, the action runs (resubmit, rebill, appeal, withdraw, bill patient, write off) after the safety rules are checked again.

Insights

GET
/api/insights

Totals, root causes by insurer × department × reason, open denials by deadline, and rules learned from denials.

POST
/api/learned/{id}

A manager approves or rejects a learned rule; approval re-checks unsent claims and re-triages open denials.

GET
/api/audit

The hospital's audit log.

FHIR R4

Shaped the way NPHIES exchanges them; profile and code-system URLs are placeholders.

GET
/fhir/Claim/{id}

Diagnoses (ICD-10), items, approvals (preAuthRef), attachments and care team.

GET
/fhir/ClaimResponse/{id}

Per-item adjudication with denial reasons.

GET
/fhir/CoverageEligibilityResponse/{id}

Whether the billed policy was in force on the date of service.

{
  "resourceType": "Claim", "id": "CLM-000206", "status": "active", "use": "claim",
  "insurer": { "display": "Sanabel Insurance" },
  "diagnosis": [{ "sequence": 1, "diagnosisCodeableConcept": { "coding": [{ "system": "http://hl7.org/fhir/sid/icd-10", "code": "M51.1" }] } }],
  "insurance": [{ "sequence": 1, "focal": true, "coverage": { "reference": "Coverage/COV-12" }, "preAuthRef": ["PA-SANB-40031"] }],
  "item": [{ "sequence": 2, "productOrService": { "coding": [{ "code": "PRC-205", "display": "MRI lumbar spine" }] }, "net": { "value": 2900, "currency": "SAR" } }]
}