{"openapi":"3.0.3","info":{"title":"Demo-EHR API","version":"1.0.0","description":"Synthetic EHR for integration-testing Ordina. The push contract (endpoints Ordina exposes) is documented in the Integration tab."},"servers":[{"url":"https://demo-ehr.ordina.health"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Connection key from the Integration tab"}},"examples":{"NormalizedOrder":{"value":{"external_order_id":"DEMO-100001","ehr_source":"demo-ehr","target_queue":"outbox","agency":{"external_id":"uuid","name":"ProHealth Home Care Inc.","npi":"1457389210","ordina_agency_id":"ordina-agency-uuid"},"office_location":{"external_id":"uuid","code":"02","name":"ProHealth Hospice San Jose","ordina_location_id":"ordina-location-uuid"},"patient":{"external_patient_id":"70001","first_name":"Ursula","middle_name":"N","last_name":"Tisson","date_of_birth":"1931-08-10","gender":"female","phone":"(408) 555-0134","address":{"line1":"2635 N First St","city":"San Jose","state":"CA","zip":"95134"},"medicare_id":"1EG4TE5MK73"},"physician_npi":"1234567893","physician":{"npi":"1234567893","first_name":"Scott","last_name":"Schneiderman","credential":"DO","phone":"(831) 649-0350","fax":"(831) 649-0351"},"order_type":"other","order_type_label":"Hospice Certification","service_type":"hospice","discipline":null,"priority":"normal","order_date":"2026-11-19","due_date":"2026-12-03","documents":[{"document_type":"original","file_name":"DEMO-100001_Tisson_Hospice-Certification.pdf","mime_type":"application/pdf","url":"http://localhost:3100/api/v1/orders/DEMO-100001/document","size_bytes":9123,"sha256":"…","content_base64":"JVBERi0xLjcK…"}],"raw_payload":{"template":"hospice_cti","title":"Hospice Physician Certification of Terminal Illness","…":"all fields printed on the PDF"},"created_at":"2026-11-19T09:10:00.000Z","updated_at":"2026-11-19T09:10:00.000Z"}}}},"paths":{"/api/v1/connection":{"get":{"summary":"Health + handshake. Returns which connected account the key belongs to, EHR identity, office locations and that account's order counts.","description":"Used for: EHRConnector.getConnectionStatus(). Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":"{ \"status\": \"connected\", \"ehr_source\": \"demo-ehr\", \"version\": \"1.0.0\", \"account\": { \"name\": \"ProHealth\", \"ordina_agency_id\": \"uuid\" }, \"agency\": {…}, \"locations\": [...], \"orders\": { \"total\": 1000, \"unsent\": 120 } }"}}}}}},"/api/v1/orders":{"get":{"summary":"Pull the calling account's orders created/updated since a timestamp, as NormalizedOrder objects. Cursor-paginated. include=document embeds the PDF as base64.","description":"Used for: EHRConnector.fetchOrders(agencyId, since) — EHRSyncJob pull mode. Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":"{ \"data\": [NormalizedOrder…], \"next_cursor\": \"2026-11-19T09:10:00.000Z|DEMO-100250\" | null, \"count\": 100 }"}}}}}},"/api/v1/orders/{id}":{"get":{"summary":"Fetch one order (by DEMO-xxxxx order number or UUID) as a NormalizedOrder.","description":"Used for: Re-fetch / reconcile a single order. Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":"NormalizedOrder"}}}}}},"/api/v1/orders/{id}/document":{"get":{"summary":"Download the order PDF. version=signed returns the copy Ordina posted back after signature.","description":"Used for: documents[].url in pushed payloads. Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":"application/pdf (binary)"}}}}}},"/api/v1/orders/ack":{"post":{"summary":"Bulk acknowledge orders Ordina pulled so they are not returned again as unsent. Stores Ordina's internal id.","description":"Used for: End of EHRSyncJob pull cycle. Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"example":"{ \"orders\": [ { \"external_order_id\": \"DEMO-100001\", \"ordina_order_id\": \"uuid\", \"queue\": \"outbox\" } ] }"}}},"responses":{"200":{"description":"OK","content":{"application/json":{"example":"{ \"acknowledged\": 1, \"not_found\": [] }"}}}}}},"/api/v1/orders/{id}/status":{"post":{"summary":"Ordina reports lifecycle changes back: delivered, returned (with reason), rejected, undelivered.","description":"Used for: Order lifecycle webhooks (Ordina → EHR). Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"example":"{ \"status\": \"returned\", \"reason\": \"Wrong physician\", \"ordina_order_id\": \"uuid\", \"occurred_at\": \"2026-11-19T10:00:00Z\" }"}}},"responses":{"200":{"description":"OK","content":{"application/json":{"example":"{ \"external_order_id\": \"DEMO-100001\", \"status\": \"returned\" }"}}}}}},"/api/v1/orders/{id}/signed":{"post":{"summary":"Ordina posts the physician-signed PDF back to the EHR. JSON with base64, or multipart/form-data with a 'file' field.","description":"Used for: EHRConnector.pushSignedOrder(orderId, doc). Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"example":"{ \"signed_pdf_base64\": \"JVBERi0…\", \"signed_by\": \"Dr. Scott Schneiderman\", \"signed_by_npi\": \"1234567893\", \"signed_at\": \"2026-11-19T10:00:00Z\", \"ordina_order_id\": \"uuid\" }"}}},"responses":{"200":{"description":"OK","content":{"application/json":{"example":"{ \"external_order_id\": \"DEMO-100001\", \"status\": \"signed\", \"bytes\": 48211 }"}}}}}},"/api/v1/physicians/{npi}":{"get":{"summary":"Look up a physician by NPI as known to the EHR (name, credential, phone, fax, address).","description":"Used for: MD Verification / physician matching. Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":"{ \"npi\": \"1234567893\", \"first_name\": \"Scott\", \"last_name\": \"Schneiderman\", \"credential\": \"DO\", ... }"}}}}}},"/api/v1/locations":{"get":{"summary":"List the agency's office locations so Ordina can map them to office_location_id.","description":"Used for: Connection setup: location mapping (stamps office_location_id at ingestion). Auth: Bearer {DEMO_EHR_API_KEY}","security":[{"bearer":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":"{ \"data\": [ { \"external_id\": \"uuid\", \"code\": \"02\", \"name\": \"ProHealth Hospice San Jose\", \"service_line\": \"hospice\" } ] }"}}}}}}}}