{"openapi":"3.1.0","info":{"title":"ClinicView API","version":"1.0.0","description":"FHIR R4 and HL7 v2 API for ClinicView practices. Authenticate with a Bearer API key created in Settings → API & interoperability.","contact":{"name":"ClinicView developers","url":"https://system.clinicview.co.za/za/developers"}},"servers":[{"url":"https://system.clinicview.co.za"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"cvk_<48 hex>","description":"Scopes: fhir.read, fhir.write, hl7.write, hl7.read. Rate limit: 300 requests per minute per key."}}},"paths":{"/api/fhir/metadata":{"get":{"operationId":"capabilityStatement","summary":"Capability statement","description":"What this server supports. No API key needed.\n\nThe FHIR `CapabilityStatement`: supported resources, interactions and search parameters. Use it to check connectivity; it needs no key.","tags":["Getting data (FHIR)"],"security":[],"parameters":[],"responses":{"200":{"description":"The CapabilityStatement.","content":{"application/fhir+json":{"example":{"resourceType":"CapabilityStatement","status":"active","date":"2026-11-22","kind":"instance","software":{"name":"ClinicView","version":"1.0"},"implementation":{"description":"ClinicView FHIR R4 API","url":"https://system.clinicview.co.za/api/fhir"},"fhirVersion":"4.0.1","format":["application/fhir+json"],"rest":[{"mode":"server","security":{"description":"Bearer API key (create under Settings → API & integrations). Scopes: fhir.read, fhir.write."},"resource":[{"type":"Patient","interaction":[{"code":"read"},{"code":"search-type"},{"code":"create"}],"searchParam":[{"name":"_id","type":"string"},{"name":"identifier","type":"string"},{"name":"name","type":"string"},{"name":"family","type":"string"},{"name":"given","type":"string"},{"name":"birthdate","type":"date"},{"name":"gender","type":"string"},{"name":"_count","type":"string"}]},{"type":"Practitioner","interaction":[{"code":"read"},{"code":"search-type"}],"searchParam":[{"name":"_id","type":"string"},{"name":"name","type":"string"}]},{"type":"Appointment","interaction":[{"code":"read"},{"code":"search-type"}],"searchParam":[{"name":"_id","type":"string"},{"name":"patient","type":"reference"},{"name":"date","type":"date"},{"name":"status","type":"string"},{"name":"_count","type":"string"}]},{"type":"Encounter","interaction":[{"code":"read"},{"code":"search-type"}],"searchParam":[{"name":"_id","type":"string"},{"name":"patient","type":"reference"},{"name":"date","type":"date"},{"name":"_count","type":"string"}]},{"type":"Condition","interaction":[{"code":"read"},{"code":"search-type"}],"searchParam":[{"name":"_id","type":"string"},{"name":"patient","type":"reference"},{"name":"code","type":"string"},{"name":"_count","type":"string"}]},{"type":"Observation","interaction":[{"code":"read"},{"code":"search-type"}],"searchParam":[{"name":"patient","type":"reference"},{"name":"category","type":"string"},{"name":"date","type":"date"},{"name":"_count","type":"string"}]},{"type":"MedicationRequest","interaction":[{"code":"read"},{"code":"search-type"}],"searchParam":[{"name":"_id","type":"string"},{"name":"patient","type":"reference"},{"name":"_count","type":"string"}]},{"type":"AllergyIntolerance","interaction":[{"code":"read"},{"code":"search-type"}],"searchParam":[{"name":"patient","type":"reference"}]}]}]}}}}}}},"/api/fhir/Patient":{"get":{"operationId":"patientsSearch","summary":"Search patients","description":"Find patients with search parameters; returns a FHIR Bundle (searchset).\n\nReturns patients of your practice as a `Bundle` of type `searchset`. Records of restricted (VIP) patients and confidential notes are never returned.\n\nMerged duplicates are not returned. Results are sorted by surname.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"identifier","in":"query","required":false,"description":"Patient number or ID/passport number, optionally `system|value` with a ClinicView identifier system.","schema":{"type":"string"},"example":"https://fhir.clinicview.co.za/identifier/za-id-number|9004120123081"},{"name":"family","in":"query","required":false,"description":"Surname starts with (case-insensitive).","schema":{"type":"string"},"example":"Mokoena"},{"name":"given","in":"query","required":false,"description":"First name starts with.","schema":{"type":"string"},"example":"Thandi"},{"name":"name","in":"query","required":false,"description":"Any part of the name, patient number or phone.","schema":{"type":"string"},"example":"thandi"},{"name":"birthdate","in":"query","required":false,"description":"Date of birth, with optional prefix eq, ge, gt, le, lt.","schema":{"type":"string"},"example":"1990-04-12"},{"name":"gender","in":"query","required":false,"description":"male, female, other or unknown.","schema":{"type":"string"},"example":"female"},{"name":"_id","in":"query","required":false,"description":"A Patient id.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},{"name":"_count","in":"query","required":false,"description":"Results to return: 1–200, default 50.","schema":{"type":"integer"},"example":"20"}],"responses":{"200":{"description":"A Bundle of matching resources.","content":{"application/fhir+json":{"example":{"resourceType":"Bundle","type":"searchset","total":1,"link":[{"relation":"self","url":"https://system.clinicview.co.za/api/fhir/Patient?family=Mokoena&birthdate=1990-04-12"}],"entry":[{"fullUrl":"https://system.clinicview.co.za/api/fhir/Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11","resource":{"resourceType":"Patient","id":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11","meta":{"lastUpdated":"2026-11-20T09:14:05+02:00"},"identifier":[{"use":"usual","system":"https://fhir.clinicview.co.za/identifier/patient-number","value":"P000123"},{"use":"official","system":"https://fhir.clinicview.co.za/identifier/za-id-number","value":"9004120123081"}],"active":true,"name":[{"use":"official","family":"Mokoena","given":["Thandi"],"prefix":["Ms"]}],"telecom":[{"system":"phone","value":"+27821234567","use":"mobile"},{"system":"email","value":"thandi@example.com"}],"gender":"female","birthDate":"1990-04-12","address":[{"line":["12 Jacaranda Street"],"city":"Pretoria","district":"Hatfield","state":"Gauteng","postalCode":"0083","country":"ZA"}],"communication":[{"language":{"text":"zu"},"preferred":true}]},"search":{"mode":"match"}}]}}}},"400":{"description":"Invalid date parameter \"2026/11/01\""},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}},"post":{"operationId":"patientsCreate","summary":"Create a patient","description":"Register a new patient from a FHIR Patient resource.\n\nCreates a patient in your practice. `name` (family + given) is required. A South African ID number (identifier system below) is validated, and a patient with the same ID or passport number is refused with **409** so you never create duplicates.\n\nThe response is the stored Patient, including the new id and patient number, with a `Location` header.","tags":["Creating data (FHIR)"],"security":[{"apiKey":["fhir.write"]}],"parameters":[],"requestBody":{"required":true,"content":{"application/fhir+json":{"schema":{"type":"object"},"example":{"resourceType":"Patient","name":[{"use":"official","family":"Dlamini","given":["Sipho"]}],"gender":"male","birthDate":"1985-06-15","identifier":[{"system":"https://fhir.clinicview.co.za/identifier/za-id-number","value":"8506155800087"}],"telecom":[{"system":"phone","value":"+27831112222"},{"system":"email","value":"sipho@example.com"}],"address":[{"line":["4 Protea Avenue"],"city":"Midrand","state":"Gauteng","postalCode":"1685"}]}}}},"responses":{"201":{"description":"Created. `Location` points to the new Patient.","content":{"application/fhir+json":{"example":{"resourceType":"Patient","id":"6d1f3b5a-7c9e-4b2d-8f1a-3c5e7a9b1d00","meta":{"lastUpdated":"2026-11-20T09:14:05+02:00"},"identifier":[{"use":"usual","system":"https://fhir.clinicview.co.za/identifier/patient-number","value":"P000124"},{"use":"official","system":"https://fhir.clinicview.co.za/identifier/za-id-number","value":"8506155800087"}],"active":true,"name":[{"use":"official","family":"Dlamini","given":["Sipho"]}],"telecom":[{"system":"phone","value":"+27831112222","use":"mobile"},{"system":"email","value":"sipho@example.com"}],"gender":"male","birthDate":"1985-06-15","address":[{"line":["4 Protea Avenue"],"city":"Midrand","state":"Gauteng","postalCode":"1685","country":"ZA"}],"communication":[{"language":{"text":"en"},"preferred":true}]}}}},"400":{"description":"Body must be a FHIR JSON resource"},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.write scope"},"409":{"description":"A patient with this identifier already exists: Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"422":{"description":"Patient.name with family and given is required"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Patient/{id}":{"get":{"operationId":"patientsRead","summary":"Read a patient","description":"One Patient by id.\n\nReturns a single `Patient` resource.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The Patient id.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"}],"responses":{"200":{"description":"The Patient.","content":{"application/fhir+json":{"example":{"resourceType":"Patient","id":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11","meta":{"lastUpdated":"2026-11-20T09:14:05+02:00"},"identifier":[{"use":"usual","system":"https://fhir.clinicview.co.za/identifier/patient-number","value":"P000123"},{"use":"official","system":"https://fhir.clinicview.co.za/identifier/za-id-number","value":"9004120123081"}],"active":true,"name":[{"use":"official","family":"Mokoena","given":["Thandi"],"prefix":["Ms"]}],"telecom":[{"system":"phone","value":"+27821234567","use":"mobile"},{"system":"email","value":"thandi@example.com"}],"gender":"female","birthDate":"1990-04-12","address":[{"line":["12 Jacaranda Street"],"city":"Pretoria","district":"Hatfield","state":"Gauteng","postalCode":"0083","country":"ZA"}],"communication":[{"language":{"text":"zu"},"preferred":true}]}}}},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11 not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Practitioner":{"get":{"operationId":"practitionersSearch","summary":"Search practitioners","description":"Find practitioners with search parameters; returns a FHIR Bundle (searchset).\n\nReturns practitioners of your practice as a `Bundle` of type `searchset`. Records of restricted (VIP) patients and confidential notes are never returned.\n\nMembers of your team marked as practitioners, with registration and practice numbers.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"_id","in":"query","required":false,"description":"Practitioner id (ignored in search; use read).","schema":{"type":"string"},"example":"3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"},{"name":"_count","in":"query","required":false,"description":"Results to return: 1–200, default 50.","schema":{"type":"integer"},"example":"20"}],"responses":{"200":{"description":"A Bundle of matching resources.","content":{"application/fhir+json":{"example":{"resourceType":"Bundle","type":"searchset","total":1,"link":[{"relation":"self","url":"https://system.clinicview.co.za/api/fhir/Practitioner"}],"entry":[{"fullUrl":"https://system.clinicview.co.za/api/fhir/Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22","resource":{"resourceType":"Practitioner","id":"3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22","identifier":[{"system":"https://fhir.clinicview.co.za/identifier/practitioner-registration","value":"MP0654321","assigner":{"display":"HPCSA"}},{"system":"https://fhir.clinicview.co.za/identifier/bhf-practice-number","value":"0123456"}],"active":true,"name":[{"text":"Dr Naledi Dlamini","prefix":["Dr"]}],"telecom":[{"system":"email","value":"naledi@example.com"}],"qualification":[{"code":{"text":"General practice"}}]},"search":{"mode":"match"}}]}}}},"400":{"description":"Invalid date parameter \"2026/11/01\""},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Practitioner/{id}":{"get":{"operationId":"practitionersRead","summary":"Read a practitioner","description":"One Practitioner by id.\n\nReturns a single `Practitioner` resource.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The Practitioner id.","schema":{"type":"string"},"example":"3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"}],"responses":{"200":{"description":"The Practitioner.","content":{"application/fhir+json":{"example":{"resourceType":"Practitioner","id":"3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22","identifier":[{"system":"https://fhir.clinicview.co.za/identifier/practitioner-registration","value":"MP0654321","assigner":{"display":"HPCSA"}},{"system":"https://fhir.clinicview.co.za/identifier/bhf-practice-number","value":"0123456"}],"active":true,"name":[{"text":"Dr Naledi Dlamini","prefix":["Dr"]}],"telecom":[{"system":"email","value":"naledi@example.com"}],"qualification":[{"code":{"text":"General practice"}}]}}}},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22 not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Appointment":{"get":{"operationId":"appointmentsSearch","summary":"Search appointments","description":"Find appointments with search parameters; returns a FHIR Bundle (searchset).\n\nReturns appointments of your practice as a `Bundle` of type `searchset`. Records of restricted (VIP) patients and confidential notes are never returned.\n\nNewest first. ClinicView statuses map to FHIR: booked/confirmed → booked, checked in/in progress → arrived, completed → fulfilled, no-show → noshow.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"patient","in":"query","required":false,"description":"The Patient id (or Patient/<id>). `subject` is accepted as an alias.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},{"name":"date","in":"query","required":false,"description":"Filter on the start time. Prefix with eq (that whole day, the default), ge, gt, le or lt. Repeat to make a range.","schema":{"type":"string"},"example":"ge2026-11-01"},{"name":"_count","in":"query","required":false,"description":"Results to return: 1–200, default 50.","schema":{"type":"integer"},"example":"20"}],"responses":{"200":{"description":"A Bundle of matching resources.","content":{"application/fhir+json":{"example":{"resourceType":"Bundle","type":"searchset","total":1,"link":[{"relation":"self","url":"https://system.clinicview.co.za/api/fhir/Appointment?patient=8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11&date=ge2026-11-01"}],"entry":[{"fullUrl":"https://system.clinicview.co.za/api/fhir/Appointment/c4e8b2a6-1d3f-4a5c-8e7b-9f0d2c4a6b33","resource":{"resourceType":"Appointment","id":"c4e8b2a6-1d3f-4a5c-8e7b-9f0d2c4a6b33","meta":{"lastUpdated":"2026-11-18T15:02:11+02:00"},"status":"booked","appointmentType":{"text":"in_person"},"serviceType":[{"text":"Follow-up consultation"}],"description":"Follow-up: blood pressure","start":"2026-11-24T09:30:00+02:00","end":"2026-11-24T09:45:00+02:00","created":"2026-11-18T15:02:11+02:00","participant":[{"actor":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"status":"accepted"},{"actor":{"reference":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"},"status":"accepted"}]},"search":{"mode":"match"}}]}}}},"400":{"description":"Invalid date parameter \"2026/11/01\""},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Appointment/{id}":{"get":{"operationId":"appointmentsRead","summary":"Read an appointment","description":"One Appointment by id.\n\nReturns a single `Appointment` resource.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The Appointment id.","schema":{"type":"string"},"example":"c4e8b2a6-1d3f-4a5c-8e7b-9f0d2c4a6b33"}],"responses":{"200":{"description":"The Appointment.","content":{"application/fhir+json":{"example":{"resourceType":"Appointment","id":"c4e8b2a6-1d3f-4a5c-8e7b-9f0d2c4a6b33","meta":{"lastUpdated":"2026-11-18T15:02:11+02:00"},"status":"booked","appointmentType":{"text":"in_person"},"serviceType":[{"text":"Follow-up consultation"}],"description":"Follow-up: blood pressure","start":"2026-11-24T09:30:00+02:00","end":"2026-11-24T09:45:00+02:00","created":"2026-11-18T15:02:11+02:00","participant":[{"actor":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"status":"accepted"},{"actor":{"reference":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"},"status":"accepted"}]}}}},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Appointment/c4e8b2a6-1d3f-4a5c-8e7b-9f0d2c4a6b33 not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Encounter":{"get":{"operationId":"encountersSearch","summary":"Search encounters","description":"Find encounters with search parameters; returns a FHIR Bundle (searchset).\n\nReturns encounters of your practice as a `Bundle` of type `searchset`. Records of restricted (VIP) patients and confidential notes are never returned.\n\nConsultations. Signed consultations are `finished`; telemedicine is class `VR`, in person `AMB`. Confidential (psychotherapy) notes are never exposed.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"patient","in":"query","required":false,"description":"The Patient id (or Patient/<id>). `subject` is accepted as an alias.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},{"name":"date","in":"query","required":false,"description":"Filter on the start of the consultation. Prefix with eq (that whole day, the default), ge, gt, le or lt. Repeat to make a range.","schema":{"type":"string"},"example":"ge2026-11-01"},{"name":"_count","in":"query","required":false,"description":"Results to return: 1–200, default 50.","schema":{"type":"integer"},"example":"20"}],"responses":{"200":{"description":"A Bundle of matching resources.","content":{"application/fhir+json":{"example":{"resourceType":"Bundle","type":"searchset","total":1,"link":[{"relation":"self","url":"https://system.clinicview.co.za/api/fhir/Encounter?patient=8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11&date=2026-11-24"}],"entry":[{"fullUrl":"https://system.clinicview.co.za/api/fhir/Encounter/e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44","resource":{"resourceType":"Encounter","id":"e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44","meta":{"lastUpdated":"2026-11-24T09:58:41+02:00"},"status":"finished","class":{"system":"http://terminology.hl7.org/CodeSystem/v3-ActCode","code":"AMB","display":"ambulatory"},"serviceType":{"text":"general_practice"},"subject":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"participant":[{"individual":{"reference":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"}}],"period":{"start":"2026-11-24T09:34:00+02:00","end":"2026-11-24T09:58:41+02:00"},"reasonCode":[{"text":"Headaches for a week"}],"appointment":[{"reference":"Appointment/c4e8b2a6-1d3f-4a5c-8e7b-9f0d2c4a6b33"}]},"search":{"mode":"match"}}]}}}},"400":{"description":"Invalid date parameter \"2026/11/01\""},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Encounter/{id}":{"get":{"operationId":"encountersRead","summary":"Read an encounter","description":"One Encounter by id.\n\nReturns a single `Encounter` resource.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The Encounter id.","schema":{"type":"string"},"example":"e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44"}],"responses":{"200":{"description":"The Encounter.","content":{"application/fhir+json":{"example":{"resourceType":"Encounter","id":"e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44","meta":{"lastUpdated":"2026-11-24T09:58:41+02:00"},"status":"finished","class":{"system":"http://terminology.hl7.org/CodeSystem/v3-ActCode","code":"AMB","display":"ambulatory"},"serviceType":{"text":"general_practice"},"subject":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"participant":[{"individual":{"reference":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"}}],"period":{"start":"2026-11-24T09:34:00+02:00","end":"2026-11-24T09:58:41+02:00"},"reasonCode":[{"text":"Headaches for a week"}],"appointment":[{"reference":"Appointment/c4e8b2a6-1d3f-4a5c-8e7b-9f0d2c4a6b33"}]}}}},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Encounter/e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44 not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Condition":{"get":{"operationId":"conditionsSearch","summary":"Search conditions","description":"Find conditions with search parameters; returns a FHIR Bundle (searchset).\n\nReturns conditions of your practice as a `Bundle` of type `searchset`. Records of restricted (VIP) patients and confidential notes are never returned.\n\nDiagnoses recorded in consultations, coded with ICD-10.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"patient","in":"query","required":false,"description":"The Patient id (or Patient/<id>). `subject` is accepted as an alias.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},{"name":"code","in":"query","required":false,"description":"ICD-10 code, optionally `system|code`.","schema":{"type":"string"},"example":"I10"},{"name":"_count","in":"query","required":false,"description":"Results to return: 1–200, default 50.","schema":{"type":"integer"},"example":"20"}],"responses":{"200":{"description":"A Bundle of matching resources.","content":{"application/fhir+json":{"example":{"resourceType":"Bundle","type":"searchset","total":1,"link":[{"relation":"self","url":"https://system.clinicview.co.za/api/fhir/Condition?patient=8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11&code=I10"}],"entry":[{"fullUrl":"https://system.clinicview.co.za/api/fhir/Condition/a7c9e1b3-5d7f-4a2c-9e4b-6d8f0a2c4e55","resource":{"resourceType":"Condition","id":"a7c9e1b3-5d7f-4a2c-9e4b-6d8f0a2c4e55","clinicalStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/condition-clinical","code":"active"}]},"verificationStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/condition-ver-status","code":"confirmed"}]},"category":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/condition-category","code":"encounter-diagnosis"}]}],"code":{"coding":[{"system":"http://hl7.org/fhir/sid/icd-10","code":"I10","display":"Essential (primary) hypertension"}],"text":"Essential (primary) hypertension"},"subject":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"encounter":{"reference":"Encounter/e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44"},"recordedDate":"2026-11-24T09:51:02+02:00","recorder":{"reference":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"}},"search":{"mode":"match"}}]}}}},"400":{"description":"Invalid date parameter \"2026/11/01\""},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Condition/{id}":{"get":{"operationId":"conditionsRead","summary":"Read a condition","description":"One Condition by id.\n\nReturns a single `Condition` resource.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The Condition id.","schema":{"type":"string"},"example":"a7c9e1b3-5d7f-4a2c-9e4b-6d8f0a2c4e55"}],"responses":{"200":{"description":"The Condition.","content":{"application/fhir+json":{"example":{"resourceType":"Condition","id":"a7c9e1b3-5d7f-4a2c-9e4b-6d8f0a2c4e55","clinicalStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/condition-clinical","code":"active"}]},"verificationStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/condition-ver-status","code":"confirmed"}]},"category":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/condition-category","code":"encounter-diagnosis"}]}],"code":{"coding":[{"system":"http://hl7.org/fhir/sid/icd-10","code":"I10","display":"Essential (primary) hypertension"}],"text":"Essential (primary) hypertension"},"subject":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"encounter":{"reference":"Encounter/e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44"},"recordedDate":"2026-11-24T09:51:02+02:00","recorder":{"reference":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"}}}}},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Condition/a7c9e1b3-5d7f-4a2c-9e4b-6d8f0a2c4e55 not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Observation":{"get":{"operationId":"observationsSearch","summary":"Search observations","description":"Find observations with search parameters; returns a FHIR Bundle (searchset).\n\nReturns observations of your practice as a `Bundle` of type `searchset`. Records of restricted (VIP) patients and confidential notes are never returned.\n\nVital signs (LOINC-coded, UCUM units; blood pressure as one panel with systolic and diastolic components) and released laboratory results. Pending results are not returned.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"patient","in":"query","required":true,"description":"The Patient id (or Patient/<id>). `subject` is accepted as an alias.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},{"name":"category","in":"query","required":false,"description":"`vital-signs` or `laboratory`; both when omitted.","schema":{"type":"string"},"example":"laboratory"},{"name":"_count","in":"query","required":false,"description":"Results to return: 1–200, default 50.","schema":{"type":"integer"},"example":"20"}],"responses":{"200":{"description":"A Bundle of matching resources.","content":{"application/fhir+json":{"example":{"resourceType":"Bundle","type":"searchset","total":1,"link":[{"relation":"self","url":"https://system.clinicview.co.za/api/fhir/Observation?patient=8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11&category=laboratory"}],"entry":[{"fullUrl":"https://system.clinicview.co.za/api/fhir/Observation/lab-d3f5b7c9-1e3a-4c5e-9b7d-0f2a4c6e8a77","resource":{"resourceType":"Observation","id":"lab-d3f5b7c9-1e3a-4c5e-9b7d-0f2a4c6e8a77","status":"final","category":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/observation-category","code":"laboratory","display":"Laboratory"}]}],"code":{"coding":[{"system":"http://loinc.org","code":"4548-4","display":"Hemoglobin A1c"}],"text":"Hemoglobin A1c"},"subject":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"effectiveDateTime":"2026-11-22T07:10:00+02:00","issued":"2026-11-22T11:42:00+02:00","valueQuantity":{"value":6.9,"unit":"%"},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation","code":"H"}]}],"referenceRange":[{"text":"4.0-6.0"}],"note":[{"text":"Repeat in 3 months"}]},"search":{"mode":"match"}}]}}}},"400":{"description":"Observation search requires the patient parameter"},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/Observation/{id}":{"get":{"operationId":"observationsRead","summary":"Read an observation","description":"One Observation by id.\n\nReturns a single `Observation` resource.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The Observation id: `lab-<uuid>` for a laboratory result, `vs-<uuid>-<code>` for a vital sign (e.g. `-bp`, `-pulse`).","schema":{"type":"string"},"example":"lab-d3f5b7c9-1e3a-4c5e-9b7d-0f2a4c6e8a77"}],"responses":{"200":{"description":"The Observation.","content":{"application/fhir+json":{"example":{"resourceType":"Observation","id":"lab-d3f5b7c9-1e3a-4c5e-9b7d-0f2a4c6e8a77","status":"final","category":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/observation-category","code":"laboratory","display":"Laboratory"}]}],"code":{"coding":[{"system":"http://loinc.org","code":"4548-4","display":"Hemoglobin A1c"}],"text":"Hemoglobin A1c"},"subject":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"effectiveDateTime":"2026-11-22T07:10:00+02:00","issued":"2026-11-22T11:42:00+02:00","valueQuantity":{"value":6.9,"unit":"%"},"interpretation":[{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation","code":"H"}]}],"referenceRange":[{"text":"4.0-6.0"}],"note":[{"text":"Repeat in 3 months"}]}}}},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Observation/lab-d3f5b7c9-1e3a-4c5e-9b7d-0f2a4c6e8a77 not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/MedicationRequest":{"get":{"operationId":"medicationRequestsSearch","summary":"Search medication requests","description":"Find medication requests with search parameters; returns a FHIR Bundle (searchset).\n\nReturns medication requests of your practice as a `Bundle` of type `searchset`. Records of restricted (VIP) patients and confidential notes are never returned.\n\nPrescription items (drafts excluded), with NAPPI codes when known, dosage text, quantity and repeats.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"patient","in":"query","required":false,"description":"The Patient id (or Patient/<id>). `subject` is accepted as an alias.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},{"name":"_count","in":"query","required":false,"description":"Results to return: 1–200, default 50.","schema":{"type":"integer"},"example":"20"}],"responses":{"200":{"description":"A Bundle of matching resources.","content":{"application/fhir+json":{"example":{"resourceType":"Bundle","type":"searchset","total":1,"link":[{"relation":"self","url":"https://system.clinicview.co.za/api/fhir/MedicationRequest?patient=8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"}],"entry":[{"fullUrl":"https://system.clinicview.co.za/api/fhir/MedicationRequest/f9b1d3e5-7a9c-4e1b-8d3f-5a7c9e1b3d88","resource":{"resourceType":"MedicationRequest","id":"f9b1d3e5-7a9c-4e1b-8d3f-5a7c9e1b3d88","status":"active","intent":"order","groupIdentifier":{"value":"RX-000412"},"medicationCodeableConcept":{"coding":[{"system":"https://fhir.clinicview.co.za/codesystem/nappi","code":"700123001"}],"text":"Amlodipine 5 mg tablets"},"subject":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"encounter":{"reference":"Encounter/e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44"},"authoredOn":"2026-11-24T09:55:10+02:00","requester":{"reference":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"},"dosageInstruction":[{"text":"5 mg oral once daily for 30 days Take in the morning","route":{"text":"oral"}}],"dispenseRequest":{"quantity":{"value":30},"numberOfRepeatsAllowed":5},"substitution":{"allowedBoolean":true}},"search":{"mode":"match"}}]}}}},"400":{"description":"Invalid date parameter \"2026/11/01\""},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/MedicationRequest/{id}":{"get":{"operationId":"medicationRequestsRead","summary":"Read a medication request","description":"One MedicationRequest by id.\n\nReturns a single `MedicationRequest` resource.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The MedicationRequest id.","schema":{"type":"string"},"example":"f9b1d3e5-7a9c-4e1b-8d3f-5a7c9e1b3d88"}],"responses":{"200":{"description":"The MedicationRequest.","content":{"application/fhir+json":{"example":{"resourceType":"MedicationRequest","id":"f9b1d3e5-7a9c-4e1b-8d3f-5a7c9e1b3d88","status":"active","intent":"order","groupIdentifier":{"value":"RX-000412"},"medicationCodeableConcept":{"coding":[{"system":"https://fhir.clinicview.co.za/codesystem/nappi","code":"700123001"}],"text":"Amlodipine 5 mg tablets"},"subject":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},"encounter":{"reference":"Encounter/e1b3d5f7-2a4c-4e6b-8d0f-1a3c5e7b9d44"},"authoredOn":"2026-11-24T09:55:10+02:00","requester":{"reference":"Practitioner/3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22"},"dosageInstruction":[{"text":"5 mg oral once daily for 30 days Take in the morning","route":{"text":"oral"}}],"dispenseRequest":{"quantity":{"value":30},"numberOfRepeatsAllowed":5},"substitution":{"allowedBoolean":true}}}}},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"MedicationRequest/f9b1d3e5-7a9c-4e1b-8d3f-5a7c9e1b3d88 not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/AllergyIntolerance":{"get":{"operationId":"allergiesSearch","summary":"Search allergies","description":"Find allergies with search parameters; returns a FHIR Bundle (searchset).\n\nReturns allergies of your practice as a `Bundle` of type `searchset`. Records of restricted (VIP) patients and confidential notes are never returned.\n\nThe patient's recorded allergies.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"patient","in":"query","required":true,"description":"The Patient id (or Patient/<id>). `subject` is accepted as an alias.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"},{"name":"_count","in":"query","required":false,"description":"Results to return: 1–200, default 50.","schema":{"type":"integer"},"example":"20"}],"responses":{"200":{"description":"A Bundle of matching resources.","content":{"application/fhir+json":{"example":{"resourceType":"Bundle","type":"searchset","total":1,"link":[{"relation":"self","url":"https://system.clinicview.co.za/api/fhir/AllergyIntolerance?patient=8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"}],"entry":[{"fullUrl":"https://system.clinicview.co.za/api/fhir/AllergyIntolerance/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11-0","resource":{"resourceType":"AllergyIntolerance","id":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11-0","clinicalStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical","code":"active"}]},"verificationStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification","code":"confirmed"}]},"code":{"text":"Penicillin"},"patient":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"}},"search":{"mode":"match"}}]}}}},"400":{"description":"AllergyIntolerance search requires the patient parameter"},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"Patient not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/fhir/AllergyIntolerance/{id}":{"get":{"operationId":"allergiesRead","summary":"Read an allergy","description":"One AllergyIntolerance by id.\n\nReturns a single `AllergyIntolerance` resource.","tags":["Getting data (FHIR)"],"security":[{"apiKey":["fhir.read"]}],"parameters":[{"name":"id","in":"path","required":true,"description":"The AllergyIntolerance id: `<patient id>-<n>`.","schema":{"type":"string"},"example":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11-0"}],"responses":{"200":{"description":"The AllergyIntolerance.","content":{"application/fhir+json":{"example":{"resourceType":"AllergyIntolerance","id":"8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11-0","clinicalStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical","code":"active"}]},"verificationStatus":{"coding":[{"system":"http://terminology.hl7.org/CodeSystem/allergyintolerance-verification","code":"confirmed"}]},"code":{"text":"Penicillin"},"patient":{"reference":"Patient/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11"}}}}},"401":{"description":"Missing or malformed API key"},"403":{"description":"API key lacks the fhir.read scope"},"404":{"description":"AllergyIntolerance/8f2c6a1e-4b7d-4c1a-9e3f-2d5b7a9c0e11-0 not found"},"429":{"description":"Rate limit exceeded: 300 requests per minute per key"}}}},"/api/hl7":{"post":{"operationId":"hl7Results","summary":"Send lab results (ORU^R01)","description":"Laboratories post results; ClinicView files them on the patient and alerts the clinician.\n\nPost one HL7 v2 ORU^R01 message per request, segments separated by carriage returns (`\\r`). The answer is an HL7 ACK.\n\n**Matching the patient:** put our order id in OBR-2 (it is in every order we send), or our patient number in PID-3; a unique South African ID number (`^^^ZAF^NI`) also works.\n\n**Corrections:** a result with the same filler order, set id and test replaces the earlier one and asks the clinician to acknowledge it again. OBX-11 `P` is stored as pending (not shown to patients); `F`/`C` as final.","tags":["Laboratories (HL7 v2)"],"security":[{"apiKey":["hl7.write"]}],"parameters":[],"requestBody":{"required":true,"content":{"x-application/hl7-v2+er7":{"schema":{"type":"string"},"example":"MSH|^~\\&|LABSYS|LANCET|CLINICVIEW|PRACTICE|20261122114200||ORU^R01^ORU_R01|MSG00042|P|2.5.1\rPID|1||P000123^^^CLINICVIEW^MR~9004120123081^^^ZAF^NI||Mokoena^Thandi||19900412|F|||||+27821234567\rOBR|1|2b4d6f8a-0c2e-4a6c-9e8b-7d9f1b3d5f99^CLINICVIEW|LAB778|4548-4^Hemoglobin A1c^LN|||20261122071000\rOBX|1|NM|4548-4^Hemoglobin A1c^LN||6.9|%|4.0-6.0|H|||F|||20261122114200\rNTE|1||Repeat in 3 months"}}},"responses":{"200":{"description":"Accepted: ACK with MSA-1 `AA`.","content":{"x-application/hl7-v2+er7":{"example":"MSH|^~\\&|CLINICVIEW|CLINICVIEW|LABSYS|LANCET|20261122114203||ACK^R01^ACK|ACK1764063723000|P|2.5.1\rMSA|AA|MSG00042|Accepted 1 new, 0 updated results"}}},"400":{"description":"Unparseable message: ACK `AR`."},"401":{"description":"Missing or invalid key: ACK `AR`."},"422":{"description":"Not processed (unknown patient, no OBX…): ACK `AE` with an ERR segment explaining why.","content":{"x-application/hl7-v2+er7":{"example":"MSH|^~\\&|CLINICVIEW|CLINICVIEW|LABSYS|LANCET|20261122114203||ACK^R01^ACK|ACK1764063723001|P|2.5.1\rMSA|AE|MSG00042|Patient not found: send our order number in OBR-2 or our patient number in PID-3\rERR|||207^Application internal error^HL70357|E||||Patient not found: send our order number in OBR-2 or our patient number in PID-3"}}},"429":{"description":"Rate limit: ACK `AR`; retry after `Retry-After` seconds."}}}},"/api/hl7/orders":{"get":{"operationId":"hl7Orders","summary":"Collect lab orders (ORM^O01)","description":"Laboratories fetch new orders as HL7 ORM^O01 messages.\n\nReturns every open laboratory order as an ORM^O01 message (separated by a blank line), oldest first, up to 200. The `X-Order-Count` header gives the number.\n\nPoll every few minutes with `mark_sent=1`: the orders you receive are marked as sent, so the next call only returns new ones.","tags":["Laboratories (HL7 v2)"],"security":[{"apiKey":["hl7.read"]}],"parameters":[{"name":"status","in":"query","required":false,"description":"Comma-separated: `ordered`, `collected` (default both).","schema":{"type":"string"},"example":"ordered"},{"name":"mark_sent","in":"query","required":false,"description":"`1` marks the returned orders as sent.","schema":{"type":"string"},"example":"1"}],"responses":{"200":{"description":"The orders (empty body when there are none).","content":{"x-application/hl7-v2+er7":{"example":"MSH|^~\\&|CLINICVIEW|0123456|LANCET|LANCET|20261124211053+0200||ORM^O01^ORM_O01|ORM2b4d6f8a0c2e4a6c|P|2.5.1\rPID|1||P000123^^^CLINICVIEW^MR~9004120123081^^^ZAF^NI||Mokoena^Thandi||19900412|F\rORC|NW|2b4d6f8a-0c2e-4a6c-9e8b-7d9f1b3d5f99^CLINICVIEW||||||||||3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22^Dr Naledi Dlamini\rOBR|1|2b4d6f8a-0c2e-4a6c-9e8b-7d9f1b3d5f99^CLINICVIEW||^HbA1c|R|20261124095700+0200|||||||Known hypertensive||||3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22^Dr Naledi Dlamini\rOBR|2|2b4d6f8a-0c2e-4a6c-9e8b-7d9f1b3d5f99^CLINICVIEW||^Lipid panel|R|20261124095700+0200|||||||Known hypertensive||||3a9d2f4b-6c1e-4f8a-b2d7-5e0c9a1b3d22^Dr Naledi Dlamini"}}},"401":{"description":"Missing or invalid key (plain text)."},"403":{"description":"Key lacks hl7.read, or API access is not in the plan."},"429":{"description":"Rate limit; see Retry-After."}}}}}}