How it works

Replace phone calls with one HTTP request.

HBYS sends the request, Medonay evaluates the rules, the insurer is notified in real time. Every actor and every technical step is below.

What happens today

Private hospital pre-authorization in Türkiye still runs largely over the phone. The patient waits at the cashier while a staffer queues for an insurer operator.

Current flow

Hospital staff calls the insurer, reads the policy verbally, dictates each line item. Wait time typically 5-25 minutes.

Real cost

Patient experience friction, brand damage; 4-6 FTEs in a mid-size hospital tied to the phone; recurring monthly line-item deltas from verbal-transmission errors.

After Medonay

One synchronous API call, sub-second decision, automatic audit trail, HMAC-signed async webhook to the insurer. Milliseconds instead of minutes.

HBYS (Hospital Information System)

HBYS is the software platform that runs a hospital's administrative, financial and clinical operations end to end. Patient registration, outpatient, lab (LIS), radiology (RIS), pharmacy, billing and pre-authorization modules.

No HBYS vendor in Türkiye publishes public REST documentation. Integration always proceeds through NDA + PDF spec + VPN test environment. This structural friction is what forced Medonay into the adapter pattern.

VendorTypical Customer Profile
AdataMid-size private hospital
Akgün YazılımPublic + private hospitals (widest Türkiye footprint)
AritmosPrivate + some university hospitals
CompuGroup (CGM)International; some Türkiye chains including Acıbadem
DoctorsoftIndependent clinics + small private hospitals
FonetMid-to-large private hospitals
KarmedRegional private hospitals
ProbelUniversity + some private hospital chains
SisoftLarge private hospital chains (highest API maturity)

Private health insurance pre-authorization

Pre-authorization = the insurer confirms, before service is delivered, that the service is in scope and at what coverage rate. Policy + coverage + waiting period + annual limit + plan rules are evaluated in sequence.

Allianz's Pot-ALL integration is the only publicly-referenced real-time pre-authorization REST API in Türkiye. Every other carrier runs on SOAP/XML, a closed portal, or a call center. Real-time API is today's gap, not tomorrow's tech.

CarrierPositioning
Acıbadem Sağlık SigortaIntegrated with the Acıbadem hospital chain
Allianz SigortaMarket leader; Pot-ALL is the only known real-time API example in Türkiye
Anadolu SigortaTürkiye İş Bankası group
AXA SigortaInternational
AksigortaSabancı group
Ergo SigortaMunich Re Türkiye operation
Generali SigortaItalian group
HDI SigortaTalanx group
Mapfre SigortaSpanish group
Türkiye SigortaState-bank umbrella entity

Where Medonay stands today

The codebase ships 1 mock + 1 Sisoft HBYS adapter (FHIR R4-shaped) and only a mock insurance adapter. Thanks to the adapter pattern, adding a new vendor is one file + one DB row; the AdjudicationEngine never changes. The adapter schedule opens with the first real partner.

Scenario: 38-year-old Ahmet, lab + ECG

Nine steps for a single patient. Target latency: sub-second synchronous response to the hospital.

  1. 1

    Outpatient registration

    Reception enters Ahmet's national ID; HBYS knows he holds an Allianz supplementary health policy.

  2. 2

    Doctor recommends

    Internal medicine recommends two items: 901550 Complete blood count (70 TL), 902340 12-lead ECG (120 TL).

  3. 3

    HBYS calls Medonay

    Sisoft HBYS calls POST /v1/provision/request. X-API-Key in headers, patient policy + two items in the body. Payload in the hospital's own shape.

  4. 4

    Adapter normalizes

    SisoftAdapter.NormalizeRequest is invoked. The raw national ID is SHA-256-hashed at this boundary; the service layer never sees plaintext.

  5. 5

    Cross-insurer policy resolution

    When the hospital payload carries 'patient.provider_code', Medonay queries only that insurer (hint fast-path). Otherwise it queries every active insurer in parallel. When two or more match (e.g. a patient with Doga at Medicana plus Acibadem at Acibadem), Medonay refuses to pick: it returns 409 POLICY_SELECTION_REQUIRED with the candidate list. The hospital staff asks the patient which policy to use and resubmits with the same 'hbys_request_id' and 'provider_code' set; the original request transitions from 'awaiting_selection' to 'decided'. The system never makes a money-impacting choice on the patient's behalf.

  6. 6

    Adjudication engine decides

    For each item: category in scope? Policy active? Coverage lookup, waiting period, plan rules (DSL), per-item / sub-limit / annual limit clamps. Sequential and deterministic.

  7. 7

    Persist + sync response

    provision_decisions + items + outbound_webhook_deliveries written in one transaction. JSON returned to HBYS; measured p95 under 100 ms in production.

  8. 8

    Async insurer notification

    Worker pool picks up the queued webhook, POSTs to the insurer's URL with HMAC-SHA256 signature. On failure: 60s, 5m, 30m, 2h, 12h backoff. Eventually dead_letter.

  9. 9

    Hospital prints the decision

    Staff sees ✅ Approved on screen: which item at which rate, patient co-pay amount. Cashier calls the patient.

Technical architecture: a bird's-eye view

High-level flow plus the five principles that keep the system scalable.

HOSPITALHospital HBYSSisoft / Fonet / ...POST /v1/provision/requestX-API-Key200 · ProvisionDecisionunder a secondMEDONAYMedonay Go APICloud Run, europe-west1HospitalSystemAdapter.NormalizeRequest()InsuranceProviderAdapter.LookupPolicy()AdjudicationEngine.Decide()Tx { provision_decisions + items + outbound }worker.PoolPOST insurer_callback_urlsigned, from the queue/v1/webhooks/insurer/...INSURERInsurer back-endtheir own systemsInbound dispatcherreverses or annotates the decision

Adapter pattern

Each HBYS and each insurer gets its own adapter file. New partner = 1 file + 1 DB row + 1 registry entry. Engine code never changes.

Pure adjudication engine

Same (request, policy) → same decision. No time.Now(), no DB writes, no outbound HTTP inside the engine. engine_version is stamped onto every decision; a past decision can be reproduced on the same version.

Cross-insurer policy resolution

The hospital does not need to know which insurer covers the patient; Medonay queries every active insurer in parallel. When two or more match (a patient with valid policies at multiple carriers: group + supplementary, or different hospital-aligned plans), Medonay does NOT silently pick: it returns 409 POLICY_SELECTION_REQUIRED with the candidates, the operator asks the patient, then resubmits with the same request id and the chosen 'provider_code'. The operator can also bypass this by sending the insurer code on the first request (hint fast-path). The system never makes a money-impacting choice for the patient.

Audit & rule_trace

Every state-changing call writes an audit_log row (append-only, regulator-facing). Every decision stores a rule_trace JSONB showing which rule fired in which order.

Security baseline

National ID SHA-256 + pepper, JWT (panel) + X-API-Key (HBYS), multi-tenant org_id scoping, HMAC webhook signatures, bcrypt cost 12, custom HTTP server timeouts + custom HTTP client.

Scale envelope

Cloud Run cpu=1 memory=1Gi concurrency=80 max-instances=10. DB pool 5/instance → 50 max connections per installation. Target p95 < 1 s; bound by upstream adapter latency.

Ready to talk?

Whether you're on the hospital or insurer side, share your current integration state and we'll draft an adapter schedule together.