Clinic
Patients, episodes, medical history, consents and clinical files, with the GDPR obligations for health data and the audit of every access.
The clinic module manages medical records: patients, episodes (visits), allergies, medical history, vital signs, diagnoses, treatments, informed consents and clinical files. It uses the plan's cases module (if missing, 403 module_not_available).
Scopes: clinica:read / clinica:write. All routes live under /clinica/.
Health data (GDPR art. 9)
Clinical data is a special category of personal data. Before integrating it:
- Grant
clinica:*only to the integration that needs it, with a dedicated key and, if possible, an expiry date. No other scope gives access to the clinic. - Your integration processes health data on behalf of the controller (the clinic): you need a legal basis, a data processing agreement and appropriate security measures (encryption, access control, records of processing).
- Request only what you need (data minimization): filter lists and don't copy entire records unless necessary.
- Don't store clinical data in logs, queues or third-party tools that are not GDPR compliant.
Audit and GDPR
Every API key request to /clinica/ is recorded in the organization's audit log: reads as action=ACCESS and writes as CREATE, UPDATE or DELETE. Each entry stores the key prefix and name (username: "API key blr_xxx…"), the IP, the method, the path, the status code, the affected patient or episode and the number of results. The request and response content is never stored.
The clinic can review those accesses with GET /auditlog/?action=ACCESS&model=Patient (scope audit:read, see Account and usage).
Other safeguards:
- Clinic webhooks only carry identifiers and must be subscribed to explicitly (the
*wildcard does not include them). - In
/agenda/bookings/,patient_nameisnullif the key lacksclinica:read. - Generating patient documents requires
templates:readandclinica:read.
Patients
/api/v1/clinica/patients/clinica:write{
"first_name": "Andrés",
"last_name": "Molina Ruiz",
"date_of_birth": "1984-03-17",
"gender": "male",
"id_document_type": "dni",
"id_document_number": "12345678Z",
"phone": "+34600111222",
"email": "andres.molina@example.com",
"customer": 318
}customer links the patient to the billing customer. Billora assigns reference using the numbering in the clinic settings (GET /clinica/settings/). The list accepts search, is_active, customer, insurance_provider and the incremental sync filters.
| Operation | Endpoint |
|---|---|
| Full medical history | GET /clinica/patients/{id}/history/ |
| Export the history as PDF | GET /clinica/patients/{patient_id}/export-pdf/ |
| Allergies, medical history and vitals | /clinica/patients/{patient_id}/allergies/ · …/backgrounds/ · …/vitals/ |
| Sync with the cloud (Drive/Dropbox) | POST /clinica/patients/{id}/cloud-sync/ |
Episodes
/api/v1/clinica/patients/{patient_id}/episodes/clinica:write{
"practitioner": 5,
"date": "2026-11-04T09:30:00+01:00",
"episode_type": "follow_up",
"status": "completed",
"chief_complaint": "Treatment review",
"treatment_plan": "Keep the regimen for 4 weeks",
"duration_minutes": 30
}episode_type: first_visit, follow_up, emergency, review, discharge. status: scheduled, in_progress, completed, cancelled, no_show. They are also available at /clinica/episodes/ (all patients) and GET /clinica/calendar/?from=&to=.
| Operation | Endpoint |
|---|---|
| Sign (closes the episode) | POST /clinica/episodes/{id}/sign/ |
| Reopen | POST /clinica/episodes/{id}/reopen/ |
| Diagnoses (ICD-11), treatments and vitals | /clinica/episodes/{episode_id}/diagnoses/ · …/treatments/ · …/vitals/ |
| Search ICD-11 codes | GET /clinica/icd11/?q= · GET /clinica/icd11/{code}/ |
| Practitioners and specialties | /clinica/practitioners/ · /clinica/specialties/ |
Consents
/clinica/patients/{patient_id}/consents/ records informed consents (from a template in /clinica/consent-templates/). Sign them with POST …/{id}/sign/ and revoke them with POST …/{id}/revoke/. To generate the consent document from a Word template, see templates.
Clinical files
/api/v1/clinica/patients/{patient_id}/files/clinica:writeUpload with multipart/form-data: file and name (required), document_type (report, lab_result, imaging, referral, prescription, consent, other), episode, folder and notes. The episode and the folder must belong to the same patient. To download, GET …/files/{id}/download/ returns a temporary signed URL (url). Folders live in /clinica/patients/{patient_id}/folders/.
Events
patient.created, patient.deleted, episode.created and episode.completed, with explicit subscription and identifiers only. See webhooks.
