{"openapi":"3.1.0","info":{"title":"A2Z Guardian","description":"Self-hosted ambient clinical scribe. The /v1 endpoints are the integration surface for any application; /api is the browser UI's own session-authenticated surface. Send an API key as 'Authorization: Bearer gk_...'.","version":"1.0.0"},"paths":{"/v1/health":{"get":{"tags":["guardian"],"summary":"Liveness and model status","operationId":"health_v1_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/templates":{"get":{"tags":["guardian"],"summary":"List note templates","operationId":"templates_v1_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/templates/{key}":{"get":{"tags":["guardian"],"summary":"One template, with its headings","operationId":"template_detail_v1_templates__key__get","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/transcribe":{"post":{"tags":["guardian"],"summary":"Audio in, transcript out — nothing stored","operationId":"transcribe_v1_transcribe_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_transcribe_v1_transcribe_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/notes":{"post":{"tags":["guardian"],"summary":"Transcript in, finished note out — nothing stored","operationId":"draft_note_v1_notes_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranscriptIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NoteOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/notes/evaluate":{"post":{"tags":["guardian"],"summary":"Audit a note you produced anywhere, against its transcript","operationId":"evaluate_note_v1_notes_evaluate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluateIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/checks":{"post":{"tags":["guardian"],"summary":"Deterministic checks only — no model call, no cost, instant","operationId":"run_checks_v1_checks_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluateIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/encounters":{"post":{"tags":["guardian"],"summary":"Queue an encounter from audio (multipart) and get a webhook when it is ready","operationId":"create_from_audio_v1_encounters_post","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_from_audio_v1_encounters_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["guardian"],"summary":"List encounters","operationId":"list_encounters_v1_encounters_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"","title":"Status"}},{"name":"include_transcript","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Transcript"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/encounters/from-transcript":{"post":{"tags":["guardian"],"summary":"Queue an encounter from a transcript you already have","operationId":"create_from_transcript_v1_encounters_from_transcript_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranscriptIn"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/encounters/{eid}":{"get":{"tags":["guardian"],"summary":"One encounter in full","operationId":"get_encounter_v1_encounters__eid__get","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["guardian"],"summary":"Edit the note or the reference","operationId":"patch_encounter_v1_encounters__eid__patch","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatchIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["guardian"],"summary":"Delete an encounter and its audio","operationId":"delete_encounter_v1_encounters__eid__delete","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/encounters/{eid}/sign":{"post":{"tags":["guardian"],"summary":"Clinician sign-off — this is what turns a draft into a record","operationId":"sign_encounter_v1_encounters__eid__sign_post","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/encounters/{eid}/redraft":{"post":{"tags":["guardian"],"summary":"Re-run the pipeline on the stored transcript","operationId":"redraft_encounter_v1_encounters__eid__redraft_post","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}},{"name":"template","in":"query","required":false,"schema":{"type":"string","default":"","title":"Template"}},{"name":"context_note","in":"query","required":false,"schema":{"type":"string","default":"","title":"Context Note"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/encounters/{eid}/note":{"get":{"tags":["guardian"],"summary":"The note as plain Markdown","operationId":"note_markdown_v1_encounters__eid__note_get","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/encounters/{eid}/audio":{"get":{"tags":["guardian"],"summary":"The stored audio, while retention holds it","operationId":"encounter_audio_v1_encounters__eid__audio_get","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks":{"get":{"tags":["guardian"],"summary":"List registered endpoints","operationId":"list_webhooks_v1_webhooks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["guardian"],"summary":"Register an endpoint for encounter events","operationId":"add_webhook_v1_webhooks_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HookIn"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/{hid}":{"delete":{"tags":["guardian"],"summary":"Remove an endpoint","operationId":"delete_webhook_v1_webhooks__hid__delete","parameters":[{"name":"hid","in":"path","required":true,"schema":{"type":"string","title":"Hid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/ping":{"get":{"summary":"Ping","operationId":"ping_api_ping_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/me":{"get":{"summary":"Me","operationId":"me_api_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/login/code":{"post":{"summary":"Login Code","description":"Email a sign-in code to a staff address. The answer is the same for any address.","operationId":"login_code_api_login_code_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/login/verify":{"post":{"summary":"Login Verify","operationId":"login_verify_api_login_verify_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/login":{"post":{"summary":"Login","operationId":"login_api_login_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/logout":{"post":{"summary":"Logout","operationId":"logout_api_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/templates":{"get":{"summary":"Templates","operationId":"templates_api_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/health":{"get":{"summary":"Health","operationId":"health_api_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/carestack/today":{"get":{"summary":"Carestack Today","operationId":"carestack_today_api_carestack_today_get","parameters":[{"name":"refresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Refresh"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/carestack/search":{"get":{"summary":"Carestack Search","operationId":"carestack_search_api_carestack_search_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","default":"","title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/carestack/patients/{pid}":{"get":{"summary":"Carestack Patient","operationId":"carestack_patient_api_carestack_patients__pid__get","parameters":[{"name":"pid","in":"path","required":true,"schema":{"type":"integer","title":"Pid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/encounters":{"post":{"summary":"Create Encounter","operationId":"create_encounter_api_encounters_post","requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_encounter_api_encounters_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Encounters","operationId":"list_encounters_api_encounters_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":60,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/encounters/{eid}":{"get":{"summary":"Get Encounter","operationId":"get_encounter_api_encounters__eid__get","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"summary":"Save Encounter","operationId":"save_encounter_api_encounters__eid__put","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Remove","operationId":"remove_api_encounters__eid__delete","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/encounters/{eid}/redraft":{"post":{"summary":"Redraft","operationId":"redraft_api_encounters__eid__redraft_post","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/encounters/{eid}/sign":{"post":{"summary":"Sign","operationId":"sign_api_encounters__eid__sign_post","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/encounters/{eid}/requeue":{"post":{"summary":"Requeue","operationId":"requeue_api_encounters__eid__requeue_post","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/encounters/{eid}/audio":{"get":{"summary":"Audio","operationId":"audio_api_encounters__eid__audio_get","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/encounters/{eid}/export.md":{"get":{"summary":"Export Md","operationId":"export_md_api_encounters__eid__export_md_get","parameters":[{"name":"eid","in":"path","required":true,"schema":{"type":"string","title":"Eid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/retention/sweep":{"post":{"summary":"Sweep Now","operationId":"sweep_now_api_retention_sweep_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/keys":{"get":{"summary":"List Keys","operationId":"list_keys_api_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"summary":"Create Key","operationId":"create_key_api_keys_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/keys/{kid}":{"delete":{"summary":"Revoke Key","operationId":"revoke_key_api_keys__kid__delete","parameters":[{"name":"kid","in":"path","required":true,"schema":{"type":"string","title":"Kid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks":{"get":{"summary":"Ui List Webhooks","operationId":"ui_list_webhooks_api_webhooks_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"Body_create_encounter_api_encounters_post":{"properties":{"audio":{"type":"string","format":"binary","title":"Audio"},"template":{"type":"string","title":"Template","default":"periodic_exam"},"mode":{"type":"string","title":"Mode","default":""},"patient_ref":{"type":"string","title":"Patient Ref","default":""},"patient_label":{"type":"string","title":"Patient Label","default":""},"context_note":{"type":"string","title":"Context Note","default":""}},"type":"object","required":["audio"],"title":"Body_create_encounter_api_encounters_post"},"Body_create_from_audio_v1_encounters_post":{"properties":{"audio":{"type":"string","format":"binary","title":"Audio"},"template":{"type":"string","title":"Template","default":"periodic_exam"},"mode":{"type":"string","title":"Mode","default":""},"patient_ref":{"type":"string","title":"Patient Ref","default":""},"context_note":{"type":"string","title":"Context Note","default":""},"clinician":{"type":"string","title":"Clinician","default":""}},"type":"object","required":["audio"],"title":"Body_create_from_audio_v1_encounters_post"},"Body_transcribe_v1_transcribe_post":{"properties":{"audio":{"type":"string","format":"binary","title":"Audio"}},"type":"object","required":["audio"],"title":"Body_transcribe_v1_transcribe_post"},"EvaluateIn":{"properties":{"transcript":{"type":"string","minLength":1,"title":"Transcript"},"note":{"type":"string","minLength":1,"title":"Note","description":"The note to audit."},"template":{"type":"string","title":"Template","default":"periodic_exam"},"context_note":{"type":"string","title":"Context Note","default":""},"patient_ref":{"type":"string","title":"Patient Ref","default":""}},"type":"object","required":["transcript","note"],"title":"EvaluateIn"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HookIn":{"properties":{"url":{"type":"string","title":"Url","description":"HTTPS endpoint Guardian will POST to."},"events":{"type":"string","title":"Events","description":"Comma-separated. Available: encounter.queued, encounter.ready, encounter.signed, encounter.error","default":"encounter.ready,encounter.signed,encounter.error"}},"type":"object","required":["url"],"title":"HookIn"},"NoteOut":{"properties":{"note":{"type":"string","title":"Note"},"first_draft":{"type":"string","title":"First Draft"},"audit":{"additionalProperties":true,"type":"object","title":"Audit"},"code_findings":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Code Findings"},"trace":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Trace"},"total_ms":{"type":"integer","title":"Total Ms"},"model":{"type":"string","title":"Model"}},"type":"object","required":["note","first_draft","audit","code_findings","trace","total_ms","model"],"title":"NoteOut"},"PatchIn":{"properties":{"note_final":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note Final"},"patient_ref":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Ref"}},"type":"object","title":"PatchIn"},"SignIn":{"properties":{"note_final":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note Final"},"signed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signed By"}},"type":"object","title":"SignIn"},"TranscriptIn":{"properties":{"transcript":{"type":"string","minLength":1,"title":"Transcript","description":"The appointment transcript."},"template":{"type":"string","title":"Template","description":"Template key from GET /v1/templates.","default":"periodic_exam"},"mode":{"type":"string","title":"Mode","description":"'ambient' (conversation) or 'dictation'. Defaults per template.","default":""},"patient_ref":{"type":"string","title":"Patient Ref","description":"Your own identifier. Held against the record, kept out of the note body.","default":""},"context_note":{"type":"string","title":"Context Note","description":"Anything the recording did not capture. Treated as clinician-stated.","default":""},"clinician":{"type":"string","title":"Clinician","description":"Overrides CLINICIAN_NAME for this note.","default":""}},"type":"object","required":["transcript"],"title":"TranscriptIn"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}