{"openapi":"3.0.3","info":{"title":"Remote Epilepsy Monitoring API","version":"1.0.0","description":"REST API of the remote epilepsy monitoring system: EEG goes to the coordinator agent, which runs\nthe ANN seizure model, double-checks, alerts the caregivers and the clinician and shows every step on the dashboards.\n\n**Log in for remote servers:** make an API key on the website (My profile, API keys) or with\n`POST /api/v1/keys` and the username and password, then send it with every call as `X-API-Key: <key>`\nor `Authorization: Bearer <key>`. A key acts as its account (patient, caregiver or clinician) and sees the same patients.\nThe website itself uses a session cookie.\n\n**EEG input:** see `GET /api/v1/eeg/formats`. EEG can be simulated, a held-out Bonn test recording, a list of samples,\na list of 178-sample windows, or a file (txt, csv, json, edf, npy) sent as JSON (base64 or text), as a multipart\nupload or as the raw request body. Other sampling rates are resampled to 173.61 Hz.\n\n**Live results:** `POST /api/v1/patients/{patient_id}/analyses` starts an agent run and answers at once with its id\n(202). Follow it with `GET /api/v1/runs/{run_id}/events` (server-sent events), read it with `GET /api/v1/runs/{run_id}`,\nor add `?wait=true` to get the finished run in the answer. Every open dashboard of the patient shows the run live.\n`GET /api/v1/live` sends all runs, changes and notifications of the caller's patients."},"servers":[{"url":"https://epilepsyaiagent.com"}],"tags":[{"name":"System"},{"name":"Accounts"},{"name":"API keys"},{"name":"Patients"},{"name":"EEG data","description":"Sources, formats, datasets, example files and the ANN alone"},{"name":"Agent runs","description":"Checks by the coordinator agent, shown live on the dashboards"},{"name":"EEG stream","description":"Continuous monitoring: small parts of EEG from a wearable or a server"},{"name":"Live"},{"name":"History"},{"name":"Alerts"},{"name":"Notifications"},{"name":"Location"},{"name":"Memory"},{"name":"Reports"}],"security":[{"ApiKey":[]},{"Bearer":[]},{"Session":[]}],"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"X-API-Key"},"Bearer":{"type":"http","scheme":"bearer","description":"the API key as a bearer token"},"Session":{"type":"apiKey","in":"cookie","name":"session","description":"website log-in"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"},"field":{"type":"string","nullable":true},"detail":{"type":"string"}},"required":["error","code"],"example":{"error":"not_your_patient","code":"not_your_patient","field":null}},"User":{"type":"object","properties":{"username":{"type":"string"},"role":{"type":"string","enum":["patient","caregiver","clinician"]},"profile_id":{"type":"string"},"status":{"type":"string"}}},"Login":{"type":"object","properties":{"username":{"type":"string"},"password":{"type":"string"},"role":{"type":"string","enum":["patient","caregiver","clinician"]}},"required":["username","password"],"example":{"username":"clinician1","password":"Clinician1@2026"}},"Signup":{"type":"object","properties":{"role":{"type":"string","enum":["patient","caregiver","clinician"]},"username":{"type":"string"},"password":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"age":{"type":"integer"},"gender":{"type":"string","enum":["male","female"]},"language":{"type":"string","enum":["Arabic","English"]},"clinician_id":{"type":"string"},"relation":{"type":"string"},"specialty":{"type":"string"},"link_code":{"type":"string"},"emergency_phone":{"type":"string"},"name_en":{"type":"string"},"name_ar":{"type":"string"},"clinic_en":{"type":"string","nullable":true},"clinic_ar":{"type":"string","nullable":true},"emergency_name_en":{"type":"string","nullable":true},"emergency_name_ar":{"type":"string","nullable":true}},"required":["role","username","password"],"example":{"role":"caregiver","username":"helper7","password":"Helper123","name_en":"Sara Ali","name_ar":"سارة علي","phone":"+965 0000 7001","link_code":"AHMAD1"}},"PasswordChange":{"type":"object","properties":{"old_password":{"type":"string"},"password":{"type":"string"}},"required":["old_password","password"]},"PasswordForgot":{"type":"object","properties":{"username":{"type":"string"},"contact":{"type":"string","description":"phone or e-mail of the profile"}},"required":["username","contact"],"example":{"username":"patient1","contact":"+965 0000 1101"}},"PasswordReset":{"type":"object","properties":{"username":{"type":"string"},"code":{"type":"string"},"password":{"type":"string"}},"required":["username","code","password"]},"Status":{"type":"object","properties":{"status":{"type":"string"}}},"Clinician":{"type":"object","properties":{"clinician_id":{"type":"string"},"specialty":{"type":"string"},"name_en":{"type":"string","nullable":true},"name_ar":{"type":"string","nullable":true}}},"Settings":{"type":"object","properties":{"prob_threshold":{"type":"number","minimum":0.3,"maximum":0.9},"double_check_windows":{"type":"integer","minimum":3,"maximum":8},"cluster_count":{"type":"integer","minimum":2,"maximum":10},"cluster_hours":{"type":"integer","minimum":1,"maximum":168},"use_location":{"type":"boolean"},"notify_patient":{"type":"boolean"},"sms_caregiver":{"type":"boolean"},"auto_emergency":{"type":"boolean"}},"example":{"prob_threshold":0.6,"double_check_windows":5,"auto_emergency":false}},"Caregiver":{"type":"object","properties":{"caregiver_id":{"type":"string"},"relation":{"type":"string"},"phone":{"type":"string"},"language":{"type":"string"},"name_en":{"type":"string","nullable":true},"name_ar":{"type":"string","nullable":true}}},"Patient":{"type":"object","properties":{"patient_id":{"type":"string"},"age":{"type":"integer","nullable":true},"gender":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"email":{"type":"string","nullable":true},"language":{"type":"string","nullable":true},"diagnosis":{"type":"string","nullable":true},"medications":{"type":"string","nullable":true},"clinician_id":{"type":"string","nullable":true},"emergency_phone":{"type":"string","nullable":true},"notes":{"type":"string","nullable":true},"link_code":{"type":"string","nullable":true},"home_lat":{"type":"number","nullable":true},"home_lon":{"type":"number","nullable":true},"caregivers":{"type":"array","items":{"$ref":"#/components/schemas/Caregiver"}},"settings":{"$ref":"#/components/schemas/Settings"},"last_result":{"type":"object","nullable":true,"properties":{"time":{"type":"string"},"label":{"type":"string"},"risk":{"type":"string"}}},"open_alerts":{"type":"integer"},"name_en":{"type":"string","nullable":true},"name_ar":{"type":"string","nullable":true},"emergency_name_en":{"type":"string","nullable":true},"emergency_name_ar":{"type":"string","nullable":true},"clinician_name_en":{"type":"string","nullable":true},"clinician_name_ar":{"type":"string","nullable":true}}},"PatientUpdate":{"type":"object","properties":{"age":{"type":"integer"},"gender":{"type":"string"},"diagnosis":{"type":"string","enum":["focal","generalized","unknown"]},"medications":{"type":"string"},"notes":{"type":"string"},"home_lat":{"type":"number"},"home_lon":{"type":"number"}},"example":{"medications":"Levetiracetam 500 mg","notes":"Seizures mostly at night"}},"ProfileUpdate":{"type":"object","properties":{"phone":{"type":"string"},"email":{"type":"string"},"language":{"type":"string"},"relation":{"type":"string"},"specialty":{"type":"string"},"emergency_phone":{"type":"string"},"name_en":{"type":"string","nullable":true},"name_ar":{"type":"string","nullable":true},"clinic_en":{"type":"string","nullable":true},"clinic_ar":{"type":"string","nullable":true},"emergency_name_en":{"type":"string","nullable":true},"emergency_name_ar":{"type":"string","nullable":true}},"description":"Fields each role may change: patient (names, phone, email, language, emergency contact), caregiver (names, relation, phone, email, language), clinician (names, specialty, clinic, phone, email)."},"Me":{"type":"object","properties":{"user":{"$ref":"#/components/schemas/User"},"profile":{"type":"object"},"auth":{"type":"string","enum":["session","api_key"]},"client":{"type":"string","nullable":true}}},"LinkCode":{"type":"object","properties":{"link_code":{"type":"string"}},"required":["link_code"],"example":{"link_code":"AHMAD1"}},"ApiKey":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"prefix":{"type":"string"},"created":{"type":"string"},"last_used":{"type":"string","nullable":true},"revoked":{"type":"string","nullable":true}}},"ApiKeyCreated":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"prefix":{"type":"string"},"created":{"type":"string"},"last_used":{"type":"string","nullable":true},"revoked":{"type":"string","nullable":true},"key":{"type":"string","description":"the full key, shown only in this answer"}}},"ApiKeyCreate":{"type":"object","properties":{"name":{"type":"string"},"username":{"type":"string"},"password":{"type":"string"}},"description":"username and password are only needed without a session or an API key","example":{"name":"hospital server","username":"clinician1","password":"Clinician1@2026"}},"Location":{"type":"object","properties":{"lat":{"type":"number"},"lon":{"type":"number"},"accuracy_m":{"type":"number"},"time":{"type":"string"},"source":{"type":"string"},"area_en":{"type":"string","nullable":true},"area_ar":{"type":"string","nullable":true}}},"MemoryNote":{"type":"object","properties":{"id":{"type":"integer"},"patient_id":{"type":"string"},"time":{"type":"string"},"kind":{"type":"string"},"source":{"type":"string"},"author":{"type":"string"},"event_id":{"type":"string","nullable":true},"text_en":{"type":"string","nullable":true},"text_ar":{"type":"string","nullable":true}}},"Memory":{"type":"object","properties":{"facts":{"type":"object"},"notes":{"type":"array","items":{"$ref":"#/components/schemas/MemoryNote"}},"settings":{"$ref":"#/components/schemas/Settings"}}},"MemoryAdd":{"type":"object","properties":{"text_en":{"type":"string"},"text_ar":{"type":"string"}},"example":{"text_en":"Check the double check result at night carefully.","text_ar":"راجع نتيجة الفحص المزدوج ليلاً بعناية."}},"Event":{"type":"object","properties":{"id":{"type":"string"},"time":{"type":"string"},"patient_id":{"type":"string"},"recording":{"type":"string"},"source":{"type":"string"},"label":{"type":"string","enum":["seizure","non-seizure","false-alarm"]},"risk":{"type":"string"},"seizure_windows":{"type":"integer"},"total_windows":{"type":"integer"},"double_seizure":{"type":"integer","nullable":true},"double_total":{"type":"integer","nullable":true},"alert_time":{"type":"string","nullable":true},"acknowledged":{"type":"string","nullable":true},"acknowledged_by":{"type":"string","nullable":true},"response_time_s":{"type":"number","nullable":true},"lat":{"type":"number","nullable":true},"lon":{"type":"number","nullable":true},"emergency_called":{"type":"boolean"},"agent_type":{"type":"string","nullable":true},"ground_truth":{"type":"string","nullable":true},"notes_en":{"type":"string","nullable":true},"notes_ar":{"type":"string","nullable":true},"area_en":{"type":"string","nullable":true},"area_ar":{"type":"string","nullable":true},"ack_name_en":{"type":"string","nullable":true},"ack_name_ar":{"type":"string","nullable":true}}},"Notification":{"type":"object","properties":{"id":{"type":"integer"},"time":{"type":"string"},"recipient":{"type":"string","nullable":true},"recipient_role":{"type":"string"},"channel":{"type":"string"},"address":{"type":"string","nullable":true},"kind":{"type":"string"},"patient_id":{"type":"string","nullable":true},"event_id":{"type":"string","nullable":true},"status":{"type":"string"},"read_at":{"type":"string","nullable":true},"title_en":{"type":"string","nullable":true},"title_ar":{"type":"string","nullable":true},"body_en":{"type":"string","nullable":true},"body_ar":{"type":"string","nullable":true},"recipient_name_en":{"type":"string","nullable":true},"recipient_name_ar":{"type":"string","nullable":true}}},"NotificationList":{"type":"object","properties":{"unread":{"type":"integer"},"items":{"type":"array","items":{"$ref":"#/components/schemas/Notification"}}}},"NotificationsRead":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"integer"}}},"description":"leave out ids to mark every notification as read"},"Report":{"type":"object","properties":{"patient":{"type":"object"},"summary":{"type":"object"},"per_day":{"type":"array","items":{"type":"object"}},"locations":{"type":"array","items":{"type":"object"}},"events":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"memory":{"type":"array","items":{"$ref":"#/components/schemas/MemoryNote"}}}},"EEGRequest":{"type":"object","properties":{"source":{"type":"string","enum":["simulated","dataset","samples","windows","file"],"description":"left out: found from the other fields"},"kind":{"type":"string","enum":["seizure","normal","random"],"description":"simulated EEG only"},"recording":{"type":"string","description":"dataset recording id, e.g. E_S058"},"samples":{"type":"array","items":{"type":"number","nullable":true}},"windows":{"type":"array","items":{"type":"array","items":{"type":"number","nullable":true}}},"content_base64":{"type":"string","description":"file content in base64 (any format)"},"content":{"type":"string","description":"file content as text (txt, csv, json)"},"file_name":{"type":"string"},"format":{"type":"string","enum":["txt","csv","json","edf","npy"]},"channel":{"type":"string","description":"channel name or number from 0 (multi-channel data)"},"sampling_rate":{"type":"number","description":"Hz; resampled to 173.61 Hz"},"wait":{"type":"boolean","description":"answer with the finished run (analyses only)"}}},"RunEvent":{"type":"object","properties":{"seq":{"type":"integer"},"type":{"type":"string","enum":["request","tool_call","tool_result","display","agent_note","done","error"]},"data":{"type":"object"}}},"Run":{"type":"object","properties":{"id":{"type":"string"},"patient_id":{"type":"string"},"user":{"type":"string"},"origin":{"type":"string","enum":["web","api"]},"client":{"type":"string","nullable":true},"request":{"type":"object"},"status":{"type":"string","enum":["running","done","error"]},"started":{"type":"string"},"finished":{"type":"string","nullable":true},"events":{"oneOf":[{"type":"integer"},{"type":"array","items":{"$ref":"#/components/schemas/RunEvent"}}],"description":"number of events, or the events themselves"},"result":{"type":"object","nullable":true,"description":"the 'done' event: decision {label, decision, reasoning}, agent_type, total_ms, event_id"},"links":{"type":"object"}}},"WindowResult":{"type":"object","properties":{"window_index":{"type":"integer"},"label":{"type":"string","nullable":true},"seizure_probability":{"type":"number","nullable":true},"problem":{"type":"string"}}},"ClassifyResult":{"type":"object","properties":{"model":{"type":"string"},"threshold":{"type":"number"},"recording":{"type":"string"},"info":{"type":"object"},"windows":{"type":"integer"},"seizure_windows":{"type":"integer"},"seizure_fraction":{"type":"number"},"label":{"type":"string"},"true_label":{"type":"string","nullable":true},"ann_time_ms":{"type":"number"},"results":{"type":"array","items":{"$ref":"#/components/schemas/WindowResult"}}}},"StreamStatus":{"type":"object","properties":{"patient_id":{"type":"string"},"buffered_samples":{"type":"integer"},"needed_samples":{"type":"integer"},"buffered_s":{"type":"number"},"chunks":{"type":"integer"},"checks_started":{"type":"integer"},"last_run_id":{"type":"string","nullable":true},"updated":{"type":"string","nullable":true},"run_id":{"type":"string","nullable":true},"chunk":{"type":"object"}}},"Dataset":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"recordings":{"type":"integer"},"windows":{"type":"integer"},"sets":{"type":"object"}}},"Recording":{"type":"object","properties":{"id":{"type":"string"},"set":{"type":"string"},"set_description":{"type":"string"},"label":{"type":"string"},"windows":{"type":"integer"}}},"RecordingData":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"windows":{"type":"integer"},"sampling_rate":{"type":"number"},"samples":{"type":"array","items":{"type":"number","nullable":true}}}},"SampleFile":{"type":"object","properties":{"name":{"type":"string"},"format":{"type":"string"},"bytes":{"type":"integer"},"url":{"type":"string"}}},"Info":{"type":"object","properties":{"model":{"type":"string"},"model_folder":{"type":"string"},"sampling_rate":{"type":"number"},"window_length":{"type":"integer"},"agent_model":{"type":"string"},"agent_mode":{"type":"string"},"database":{"type":"string"},"api_version":{"type":"string"},"docs":{"type":"string"},"openapi":{"type":"string"}}},"Health":{"type":"object","properties":{"status":{"type":"string"},"database":{"type":"string"},"time":{"type":"string"},"active_runs":{"type":"integer"},"live_clients":{"type":"integer"}}},"Formats":{"type":"object","properties":{"sampling_rate":{"type":"number"},"window_length":{"type":"integer"},"max_run_windows":{"type":"integer"},"max_classify_samples":{"type":"integer"},"max_upload_bytes":{"type":"integer"},"file_formats":{"type":"object"},"sources":{"type":"object"},"options":{"type":"object"}}}},"responses":{"Error":{"description":"Error with a code (and the field when one value is wrong)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/v1/info":{"get":{"tags":["System"],"summary":"Model, sampling rate, agent and API version","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Info"}}}}},"security":[]}},"/api/v1/health":{"get":{"tags":["System"],"summary":"Health check of the server and database","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}},"security":[]}},"/api/v1/openapi.json":{"get":{"tags":["System"],"summary":"This OpenAPI description","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}}},"security":[]}},"/api/v1/docs":{"get":{"tags":["System"],"summary":"Swagger UI page","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"text/html":{"schema":{"type":"string"}}}}},"security":[]}},"/api/v1/eeg/formats":{"get":{"tags":["EEG data"],"summary":"Supported EEG sources, file formats and limits","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Formats"}}}}},"security":[]}},"/api/v1/auth/login":{"post":{"tags":["Accounts"],"summary":"Log in (website session cookie)","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Login"}}}},"security":[]}},"/api/v1/auth/logout":{"post":{"tags":["Accounts"],"summary":"Log out","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}}},"security":[]}},"/api/v1/auth/signup":{"post":{"tags":["Accounts"],"summary":"Create a patient, caregiver or clinician account","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Signup"}}}},"security":[]}},"/api/v1/auth/password/forgot":{"post":{"tags":["Accounts"],"summary":"Send a password reset code (simulated SMS or e-mail)","description":"Demo accounts get the code in the answer as demo_code while DEMO_MODE=1.\n\n**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"sent":{"type":"string"},"demo_code":{"type":"string"}}}}}},"400":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordForgot"}}}},"security":[]}},"/api/v1/auth/password/reset":{"post":{"tags":["Accounts"],"summary":"Set a new password with the reset code","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"400":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordReset"}}}},"security":[]}},"/api/v1/auth/password/change":{"post":{"tags":["Accounts"],"summary":"Change the password (other sessions end)","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordChange"}}}}}},"/api/v1/clinicians":{"get":{"tags":["Accounts"],"summary":"Clinicians to choose at sign-up","description":"**Access:** No log-in needed.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Clinician"}}}}}},"security":[]}},"/api/v1/me":{"get":{"tags":["Accounts"],"summary":"Own account and profile","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Me"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}}},"put":{"tags":["Accounts"],"summary":"Change own profile","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileUpdate"}}}}}},"/api/v1/me/link":{"post":{"tags":["Accounts"],"summary":"Caregiver: link to a patient with the patient's link code","description":"Caregiver accounts only.\n\n**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkCode"}}}}}},"/api/v1/me/link-code":{"post":{"tags":["Accounts"],"summary":"Patient: make a new link code","description":"Patient accounts only.\n\n**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/v1/me/caregivers/{caregiver_id}":{"delete":{"tags":["Accounts"],"summary":"Patient: remove a caregiver (a new link code is made)","description":"Patient accounts only.\n\n**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"caregiver_id","in":"path","required":true,"schema":{"type":"string"},"example":"G-001"}]}},"/api/v1/keys":{"get":{"tags":["API keys"],"summary":"Own API keys (without the keys themselves)","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKey"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}}},"post":{"tags":["API keys"],"summary":"Make an API key","description":"With a session or an API key; or without, with the username and password in the body. The full key is in this answer only.\n\n**Access:** No log-in needed.","responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"400":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreate"}}}},"security":[]}},"/api/v1/keys/{key_id}":{"delete":{"tags":["API keys"],"summary":"Revoke an API key","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"integer"},"example":1}]}},"/api/v1/patients":{"get":{"tags":["Patients"],"summary":"Patients this account may see","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Patient"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/v1/patients/{patient_id}":{"get":{"tags":["Patients"],"summary":"One patient with caregivers, settings and last result","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Patient"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}]},"put":{"tags":["Patients"],"summary":"Change the medical part of the profile","description":"**Access:** Clinician of the patient only.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Patient"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientUpdate"}}}}}},"/api/v1/patients/{patient_id}/settings":{"get":{"tags":["Patients"],"summary":"Monitoring settings (thresholds and the agent tools turned on)","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Settings"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}]},"put":{"tags":["Patients"],"summary":"Change monitoring settings","description":"**Access:** Clinician of the patient only.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Settings"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Settings"}}}}}},"/api/v1/patients/{patient_id}/location":{"get":{"tags":["Location"],"summary":"Current position (simulated GPS)","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Location"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}]}},"/api/v1/patients/{patient_id}/track":{"get":{"tags":["Location"],"summary":"Positions of the last hours","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Location"}}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"},{"name":"hours","in":"query","required":false,"schema":{"type":"integer"},"description":"1 to 720, default 6"}]}},"/api/v1/patients/{patient_id}/memory":{"get":{"tags":["Memory"],"summary":"Agent memory: facts, notes and settings","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Memory"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}]},"post":{"tags":["Memory"],"summary":"Add an instruction for the agent","description":"**Access:** Clinician of the patient only.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryAdd"}}}}}},"/api/v1/patients/{patient_id}/memory/{note_id}":{"delete":{"tags":["Memory"],"summary":"Delete a memory note","description":"**Access:** Clinician of the patient only.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"},{"name":"note_id","in":"path","required":true,"schema":{"type":"integer"},"example":1}]}},"/api/v1/patients/{patient_id}/report":{"get":{"tags":["Reports"],"summary":"Report data for a period","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Report"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"},{"name":"days","in":"query","required":false,"schema":{"type":"integer"},"description":"7, 30, 90 ... or 0 for all records"}]}},"/api/v1/patients/{patient_id}/report.pdf":{"get":{"tags":["Reports"],"summary":"Report as a PDF file","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"},{"name":"days","in":"query","required":false,"schema":{"type":"integer"}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","enum":["en","ar"]}}]}},"/api/v1/patients/{patient_id}/analyses":{"post":{"tags":["Agent runs"],"summary":"Send EEG to the agent (starts a check)","description":"Starts the coordinator agent on the EEG and answers 202 with the run. The run is shown live on every open dashboard of the patient. Add `?wait=true` (and `timeout`, up to 300 s) to get the finished run instead. At most 120 windows (about 2 minutes) per check.\n\n**Access:** The patient or the patient's clinician.","responses":{"202":{"description":"Run started","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Run"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"},{"name":"wait","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"timeout","in":"query","required":false,"schema":{"type":"number"}},{"name":"format","in":"query","required":false,"schema":{"type":"string"},"description":"file format for a raw body: txt, csv, json, edf, npy"},{"name":"file_name","in":"query","required":false,"schema":{"type":"string"},"description":"file name for a raw body (the extension gives the format)"},{"name":"channel","in":"query","required":false,"schema":{"type":"string"},"description":"channel name or number from 0"},{"name":"sampling_rate","in":"query","required":false,"schema":{"type":"number"},"description":"sampling rate of the data in Hz"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EEGRequest"},"examples":{"simulated":{"summary":"Simulated seizure EEG","value":{"source":"simulated","kind":"seizure"}},"dataset":{"summary":"Bonn test recording (set E, seizure)","value":{"source":"dataset","recording":"E_S058"}},"samples":{"summary":"Samples at 256 Hz (resampled)","value":{"source":"samples","sampling_rate":256,"samples":[12.5,14.1,null,9.8,"..."]}},"windows":{"summary":"Windows of 178 samples","value":{"source":"windows","windows":[[0.1,0.2,"... 178 values"]]}},"csv_text":{"summary":"CSV file as text, channel picked","value":{"source":"file","file_name":"eeg.csv","channel":"Fp1","sampling_rate":256,"content":"time,Fp1,Fp2\n0,12.1,8.4\n..."}},"edf_base64":{"summary":"EDF file in base64","value":{"source":"file","file_name":"record.edf","content_base64":"MCAgICAgIC..."}}}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"format":{"type":"string","enum":["txt","csv","json","edf","npy"]},"channel":{"type":"string"},"sampling_rate":{"type":"number"}},"required":["file"]}},"text/plain":{"schema":{"type":"string"},"example":"-985\n-594\n-120\n308\n620"},"text/csv":{"schema":{"type":"string"},"example":"time,Fp1\n0,12.1\n0.0039,13.4"},"application/x-edf":{"schema":{"type":"string","format":"binary"}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"description":"JSON (see EEGRequest), a multipart upload with the field 'file', or the raw file as the body (text/plain, text/csv, application/x-edf or application/octet-stream with ?format= or ?file_name=)."}}},"/api/v1/patients/{patient_id}/stream":{"post":{"tags":["EEG stream"],"summary":"Send the next part of a continuous EEG stream","description":"Parts are added to the patient's buffer. When (12 + double_check_windows) windows have arrived, a check starts by itself (answer 202 with run_id). Small parts (for example one second) are fine.\n\n**Access:** The patient or the patient's clinician.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StreamStatus"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"},{"name":"format","in":"query","required":false,"schema":{"type":"string"},"description":"file format for a raw body: txt, csv, json, edf, npy"},{"name":"file_name","in":"query","required":false,"schema":{"type":"string"},"description":"file name for a raw body (the extension gives the format)"},{"name":"channel","in":"query","required":false,"schema":{"type":"string"},"description":"channel name or number from 0"},{"name":"sampling_rate","in":"query","required":false,"schema":{"type":"number"},"description":"sampling rate of the data in Hz"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EEGRequest"},"examples":{"part":{"summary":"One second at 256 Hz","value":{"samples":[10.2,11.0,9.4,"..."],"sampling_rate":256}}}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"format":{"type":"string","enum":["txt","csv","json","edf","npy"]},"channel":{"type":"string"},"sampling_rate":{"type":"number"}},"required":["file"]}},"text/plain":{"schema":{"type":"string"},"example":"-985\n-594\n-120\n308\n620"},"text/csv":{"schema":{"type":"string"},"example":"time,Fp1\n0,12.1\n0.0039,13.4"},"application/x-edf":{"schema":{"type":"string","format":"binary"}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"description":"JSON (see EEGRequest), a multipart upload with the field 'file', or the raw file as the body (text/plain, text/csv, application/x-edf or application/octet-stream with ?format= or ?file_name=)."}},"get":{"tags":["EEG stream"],"summary":"Buffer of the stream","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StreamStatus"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}]},"delete":{"tags":["EEG stream"],"summary":"Empty the buffer","description":"**Access:** The patient or the patient's clinician.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StreamStatus"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string"},"description":"patient id, e.g. P-001","example":"P-001"}]}},"/api/v1/runs":{"get":{"tags":["Agent runs"],"summary":"Recent runs of the caller's patients (kept for one hour)","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Run"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"active","in":"query","required":false,"schema":{"type":"boolean"},"description":"only runs still working"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}]}},"/api/v1/runs/{run_id}":{"get":{"tags":["Agent runs"],"summary":"One run with its events and result","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Run"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","required":false,"schema":{"type":"integer"},"description":"first event number"},{"name":"events","in":"query","required":false,"schema":{"type":"string","enum":["0","1"]},"description":"0 leaves the events out"}]}},"/api/v1/runs/{run_id}/events":{"get":{"tags":["Agent runs"],"summary":"Follow a run live (server-sent events)","description":"Each message is a RunEvent. The stream ends after the 'done' or 'error' event.\n\n**Access:** Any logged-in account.","responses":{"200":{"description":"server-sent events (text/event-stream); each `data:` line is one JSON message","content":{"text/event-stream":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"from","in":"query","required":false,"schema":{"type":"integer"}}]}},"/api/v1/live":{"get":{"tags":["Live"],"summary":"All live updates of the caller's patients (server-sent events)","description":"Messages: hello, run_started, run_event, run_finished, changed (settings, memory, profile, alerts, caregivers) and notification. The dashboard uses this stream to show commands from the API at once.\n\n**Access:** Any logged-in account.","responses":{"200":{"description":"server-sent events (text/event-stream); each `data:` line is one JSON message","content":{"text/event-stream":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"timeout","in":"query","required":false,"schema":{"type":"integer"},"description":"seconds before the server closes the stream (default 300); clients reconnect"}]}},"/api/v1/classify":{"post":{"tags":["EEG data"],"summary":"ANN only: classify EEG windows (no agent, nothing saved)","description":"Any EEG source or file format; long recordings are fine (up to 500,000 samples).\n\n**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClassifyResult"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"threshold","in":"query","required":false,"schema":{"type":"number"}},{"name":"patient_id","in":"query","required":false,"schema":{"type":"string"},"description":"use this patient's threshold"},{"name":"format","in":"query","required":false,"schema":{"type":"string"},"description":"file format for a raw body: txt, csv, json, edf, npy"},{"name":"file_name","in":"query","required":false,"schema":{"type":"string"},"description":"file name for a raw body (the extension gives the format)"},{"name":"channel","in":"query","required":false,"schema":{"type":"string"},"description":"channel name or number from 0"},{"name":"sampling_rate","in":"query","required":false,"schema":{"type":"number"},"description":"sampling rate of the data in Hz"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EEGRequest"},"examples":{"dataset":{"summary":"Bonn test recording (set E, seizure)","value":{"source":"dataset","recording":"E_S058"}},"simulated":{"summary":"Simulated seizure EEG","value":{"source":"simulated","kind":"seizure"}}}},"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"},"format":{"type":"string","enum":["txt","csv","json","edf","npy"]},"channel":{"type":"string"},"sampling_rate":{"type":"number"}},"required":["file"]}},"text/plain":{"schema":{"type":"string"},"example":"-985\n-594\n-120\n308\n620"},"text/csv":{"schema":{"type":"string"},"example":"time,Fp1\n0,12.1\n0.0039,13.4"},"application/x-edf":{"schema":{"type":"string","format":"binary"}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"description":"JSON (see EEGRequest), a multipart upload with the field 'file', or the raw file as the body (text/plain, text/csv, application/x-edf or application/octet-stream with ?format= or ?file_name=)."}}},"/api/v1/datasets":{"get":{"tags":["EEG data"],"summary":"Datasets on the server","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Dataset"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/v1/datasets/{dataset_id}/recordings":{"get":{"tags":["EEG data"],"summary":"Recordings of a dataset","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Recording"}}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"dataset_id","in":"path","required":true,"schema":{"type":"string"},"example":"bonn-test"},{"name":"label","in":"query","required":false,"schema":{"type":"string","enum":["seizure","non-seizure"]}}]}},"/api/v1/datasets/{dataset_id}/recordings/{rec_id}":{"get":{"tags":["EEG data"],"summary":"Samples of one recording","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordingData"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"dataset_id","in":"path","required":true,"schema":{"type":"string"},"example":"bonn-test"},{"name":"rec_id","in":"path","required":true,"schema":{"type":"string"},"example":"E_S058"}]}},"/api/v1/samples":{"get":{"tags":["EEG data"],"summary":"Example EEG files in every supported format","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SampleFile"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}}}},"/api/v1/samples/{name}":{"get":{"tags":["EEG data"],"summary":"Download an example file","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"},"example":"E_S076.txt"}]}},"/api/v1/events":{"get":{"tags":["History"],"summary":"Monitoring history (oldest first)","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"patient_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"},"description":"1 to 500, default 30"}]}},"/api/v1/events/{event_id}":{"get":{"tags":["History"],"summary":"One result with its ANN window results","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"401":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/alerts":{"get":{"tags":["Alerts"],"summary":"Seizure alerts, newest first","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Event"}}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}]}},"/api/v1/alerts/{event_id}/ack":{"post":{"tags":["Alerts"],"summary":"Acknowledge an alert (saves the response time)","description":"**Access:** Caregiver or clinician of the patient.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string"}}]}},"/api/v1/notifications":{"get":{"tags":["Notifications"],"summary":"Own notifications and the unread count","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationList"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}]}},"/api/v1/notifications/read":{"post":{"tags":["Notifications"],"summary":"Mark notifications as read","description":"**Access:** Any logged-in account.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsRead"}}}}}}}}
