{"openapi":"3.1.0","info":{"title":"Intera API","version":"0.0.1"},"paths":{"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/assets/hold-music.mp3":{"get":{"tags":["assets"],"summary":"Hold Music","description":"The audio a patient hears while a warm transfer is being set up.\n\n80 seconds, mono, 32 kHz, 64 kbps — sized for a phone line, which is\nnarrowband and mono anyway, and trimmed to just over the 75-second transfer\ncap so it never runs out before the patient is spoken to again. Mastered\nabout 15 dB under speech so it reads as hold music rather than drowning the\ncoordinator when the bridge connects.","operationId":"hold_music_api_v1_assets_hold_music_mp3_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/assets/{filename}":{"get":{"tags":["assets"],"summary":"Hold Track","description":"A hold track with spoken updates, one per agent voice (HOLD_TRACKS).","operationId":"hold_track_api_v1_assets__filename__get","parameters":[{"name":"filename","in":"path","required":true,"schema":{"type":"string","title":"Filename"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit":{"get":{"tags":["audit"],"summary":"List Audit Events","description":"Query audit events for the current org.","operationId":"list_audit_events_api_v1_audit_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"}},{"name":"actor_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Type"}},{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date YYYY-MM-DD","title":"Date From"},"description":"ISO date YYYY-MM-DD"},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date YYYY-MM-DD","title":"Date To"},"description":"ISO date YYYY-MM-DD"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/audit/patient/{patient_id}":{"get":{"tags":["audit"],"summary":"List Patient Audit Events","description":"Query audit events for a specific patient in the current org.","operationId":"list_patient_audit_events_api_v1_audit_patient__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"}},{"name":"actor_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Type"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date YYYY-MM-DD","title":"Date From"},"description":"ISO date YYYY-MM-DD"},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date YYYY-MM-DD","title":"Date To"},"description":"ISO date YYYY-MM-DD"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/me":{"get":{"tags":["auth"],"summary":"Get Me","description":"Return current user profile with org info.\n\nOn first login, auto-creates the user record in the shared DB\nfrom the Auth0 profile. Fetches email/name from Auth0 /userinfo\nsince access tokens for API audiences don't include these claims.\n\nThe active org is the X-Org-Id header's org when the user is a member of\nit. Otherwise (no header, or an org they're no longer in) it's their first\norg by name, and ``requested_org_refused`` is true when a header was sent:\nthe frontend then drops its stored org and pins the one returned, so the\npage and every later request agree on one org.","operationId":"get_me_api_v1_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/switch-org":{"post":{"tags":["auth"],"summary":"Switch Org","description":"Verify the user belongs to the target org and return its details.\n\nFrontend calls this before committing an org switch to validate\nmembership. Also verifies the org has a provisioned client database\nso the user doesn't switch into a broken state.\n\nAccess control:\n- Authenticated users only (JWT required via get_current_user)\n- Must be an active member of the target org (membership JOIN)\n- Non-members get 403 — no org existence leakage\n- Target org must have an active client DB (503 if not)","operationId":"switch_org_api_v1_auth_switch_org_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwitchOrgRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/studies":{"get":{"tags":["studies"],"summary":"List Studies","description":"List all studies for this client.","operationId":"list_studies_api_v1_studies_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["studies"],"summary":"Create Study","description":"Create a new study.","operationId":"create_study_api_v1_studies_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateStudyRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/studies/stats/all":{"get":{"tags":["studies"],"summary":"Get All Study Stats","description":"Batch screening stats for ALL studies in one query (replaces N+1 per-study calls).","operationId":"get_all_study_stats_api_v1_studies_stats_all_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/studies/{study_id}":{"get":{"tags":["studies"],"summary":"Get Study","description":"Get a study by ID.","operationId":"get_study_api_v1_studies__study_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["studies"],"summary":"Update Study","description":"Update a study. Only provided fields are changed.","operationId":"update_study_api_v1_studies__study_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateStudyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["studies"],"summary":"Delete Study","description":"Soft-delete a study: mark as 'archived', tear down agents, mark subjects.","operationId":"delete_study_api_v1_studies__study_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/operations":{"get":{"tags":["studies"],"summary":"Get Operations","description":"What this study does around a call or text (wrong number, busy backoff, failed\nhandoff, inbound call, SMS cooldown, post-call texts), with what changed here and\nthe recent history.","operationId":"get_operations_api_v1_studies__study_id__operations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Operations","description":"Change some operations settings; each save is a new version (#1053).","operationId":"set_operations_api_v1_studies__study_id__operations_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperationsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/missed-call-sms":{"get":{"tags":["studies"],"summary":"Get Missed Call Sms","description":"Whether this study texts a patient after a call that did not connect.","operationId":"get_missed_call_sms_api_v1_studies__study_id__missed_call_sms_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Missed Call Sms","description":"Turn the post-call follow-up text on or off for this study (a new version of\nits operations settings).","operationId":"set_missed_call_sms_api_v1_studies__study_id__missed_call_sms_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissedCallSmsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/closed-days":{"get":{"tags":["studies"],"summary":"Get Closed Days","description":"Days the site is closed (#822): where it is, that place's public holidays\n(removed ones flagged), the team's own days off, and the weekdays office hours\nleave out. The same data the booking check uses.","operationId":"get_closed_days_api_v1_studies__study_id__closed_days_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"year","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Year"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Closed Days","description":"Save the site's location, removed holidays and team days off (#822).\n\nIts own endpoint, like missed-call-sms: the Build editor autosaves its whole\ncopy of config, and these keys are endpoint-owned so that copy can't revert them.","operationId":"set_closed_days_api_v1_studies__study_id__closed_days_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClosedDaysRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/scheduling-restrictions":{"get":{"tags":["studies"],"summary":"Get Scheduling Restrictions","description":"The study team's booking restrictions and how they were read (#822).","operationId":"get_scheduling_restrictions_api_v1_studies__study_id__scheduling_restrictions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Scheduling Restrictions","description":"Save the restriction text and the rules parsed from it, together (#822).\n\nIts own endpoint: the Build editor autosaves its whole copy of config every few\nseconds, and a stale copy would put old text back and re-parse it. Here the\nmodel is asked only on a real save, and again after a failed parse.","operationId":"set_scheduling_restrictions_api_v1_studies__study_id__scheduling_restrictions_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchedulingRestrictionsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/contact-list":{"get":{"tags":["studies"],"summary":"Get Contact List Setting","description":"Which stages and tags put this study's patients on To contact (#1012).","operationId":"get_contact_list_setting_api_v1_studies__study_id__contact_list_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Contact List Setting","description":"Save the To contact setting. Its own endpoint: the Build editor autosaves its\nwhole copy of config, and a stale copy would put the old setting back.","operationId":"set_contact_list_setting_api_v1_studies__study_id__contact_list_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactListRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/close":{"get":{"tags":["studies"],"summary":"Get Close Setting","description":"What the Close study dialog shows: the saved front desk number (``setting``),\nand the study's agents' handoff number to fill it in with (``suggested``).","operationId":"get_close_setting_api_v1_studies__study_id__close_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Close Study","description":"Close the study (status 'completed') with the front desk number its patients\nare given on another study's line, or none (\"Don't give callers a number\"). Also\n\"Change\" on a closed study. One write; its own endpoint, so the Build editor's\nautosave never puts an old value back. Org admins only, like notifications: the\nnumber is what every patient of the study is given.","operationId":"close_study_api_v1_studies__study_id__close_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseStudyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/notifications":{"get":{"tags":["studies"],"summary":"Get Notification Setting","description":"Who hears about each stage and tag reason on this study, and how (#1040): the\nfull matrix, defaults filled in from the study's email lists.","operationId":"get_notification_setting_api_v1_studies__study_id__notifications_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Notification Setting","description":"Save the rows a body names (send only what changed: a whole stale copy would\nfreeze the list switches and overwrite a colleague's edits). Only rows that differ\nfrom the defaults are stored. Org admins only: custom addresses receive patient\ndetails (#1045 review). Its own endpoint, like contact-list: the Build editor's\nautosave can't put an old copy back.","operationId":"set_notification_setting_api_v1_studies__study_id__notifications_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/crio-availability":{"get":{"tags":["studies"],"summary":"Get Crio Availability","description":"The study's \"Check CRIO availability before booking\" settings (#871).","operationId":"get_crio_availability_api_v1_studies__study_id__crio_availability_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Crio Availability","description":"Save the CRIO availability toggle and its two numbers (#871).\n\nIts own endpoint, like the restrictions: the Build editor autosaves its whole\ncopy of config, and a stale copy would switch the check back. The toggle needs\na calendar to check, and the numbers have hard limits. The study's cached slots\nare dropped so the next call uses the new settings.","operationId":"set_crio_availability_api_v1_studies__study_id__crio_availability_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrioAvailabilityRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/hangup-sms":{"get":{"tags":["studies"],"summary":"Get Hangup Sms","description":"Whether this study sends the early-hang-up rescue text.","operationId":"get_hangup_sms_api_v1_studies__study_id__hangup_sms_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Hangup Sms","description":"Turn the early-hang-up rescue text on or off, independently of the\nvoicemail / no-answer text (a new version of its operations settings).","operationId":"set_hangup_sms_api_v1_studies__study_id__hangup_sms_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissedCallSmsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/handoff-script":{"get":{"tags":["studies"],"summary":"Get Handoff Script","description":"The warm-transfer wording and Failed Handoff behaviour, with defaults, the\n(read-only) voice and a preview of what the patient will hear.","operationId":"get_handoff_script_api_v1_studies__study_id__handoff_script_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"agent_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["studies"],"summary":"Set Handoff Script","description":"Save the warm-transfer wording and Failed Handoff behaviour. Blank lines\ngo back to the default. The voice is not set here — the hold voice follows\nVera's call voice, set in Build → Basics. Checked here with the same rules deploy enforces, so a line that\nwould fail to compile is refused now rather than at the next deploy.\n\nSingle-key updates, like missed-call-sms: the general config PATCH replaces\nthe whole object, so a caller changing three fields would have to send back\nevery other key untouched.","operationId":"set_handoff_script_api_v1_studies__study_id__handoff_script_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"agent_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HandoffScriptRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/documents":{"post":{"tags":["studies"],"summary":"Upload Document","description":"Upload a protocol document (PDF, DOCX, TXT) for a study.","operationId":"upload_document_api_v1_studies__study_id__documents_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_document_api_v1_studies__study_id__documents_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["studies"],"summary":"List Documents","description":"List all uploaded documents for a study.","operationId":"list_documents_api_v1_studies__study_id__documents_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/documents/{doc_id}":{"patch":{"tags":["studies"],"summary":"Update Document Type","description":"Re-file a document under a different type and queue it for re-extraction.\n\nThe type is a routing decision, not a label: changing it changes which passes\nread the file. So changing it resets the document to 'pending' — the coordinator\nre-extracts to apply it, and the button to do that is already on the row.","operationId":"update_document_type_api_v1_studies__study_id__documents__doc_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentTypeUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["studies"],"summary":"Delete Document","description":"Delete an uploaded document.","operationId":"delete_document_api_v1_studies__study_id__documents__doc_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/documents/{doc_id}/cancel":{"post":{"tags":["studies"],"summary":"Cancel Extraction","description":"Cancel a stuck extraction — resets status to 'failed'.","operationId":"cancel_extraction_api_v1_studies__study_id__documents__doc_id__cancel_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/documents/{doc_id}/extract":{"post":{"tags":["studies"],"summary":"Extract From Document","description":"Extract a StudySpec draft from an uploaded document via vera-compiler.","operationId":"extract_from_document_api_v1_studies__study_id__documents__doc_id__extract_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/documents/{doc_id}/spec":{"get":{"tags":["studies"],"summary":"Get Extracted Spec","description":"Get the AI-extracted StudySpec from a document.","operationId":"get_extracted_spec_api_v1_studies__study_id__documents__doc_id__spec_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/documents/{doc_id}/changes":{"get":{"tags":["studies"],"summary":"Get Extraction Changes","description":"Get the extraction diff (what changed) for a document.","operationId":"get_extraction_changes_api_v1_studies__study_id__documents__doc_id__changes_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/apply-spec":{"post":{"tags":["studies"],"summary":"Apply Spec","description":"Apply a reviewed StudySpec to the study. Updates metadata + stores full spec in config.","operationId":"apply_spec_api_v1_studies__study_id__apply_spec_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplySpecRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/stats":{"get":{"tags":["studies"],"summary":"Get Study Stats","description":"Get patient/subject counts and agent status for a study.","operationId":"get_study_stats_api_v1_studies__study_id__stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/sites":{"get":{"tags":["studies"],"summary":"Get Study Sites","description":"Get all sites for a study, including CRIO config (coordinators, address).","operationId":"get_study_sites_api_v1_studies__study_id__sites_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/ctms-stats":{"get":{"tags":["studies"],"summary":"Get Ctms Stats","description":"Get CTMS sync stats for a study — how many patients synced to CRIO.","operationId":"get_ctms_stats_api_v1_studies__study_id__ctms_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/kill-ai":{"post":{"tags":["studies"],"summary":"Kill Study Ai","description":"Immediately cancel all pending/queued AI operations for a study.","operationId":"kill_study_ai_api_v1_studies__study_id__kill_ai_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/crio/discover":{"post":{"tags":["studies"],"summary":"Discover Crio Studies","description":"Trigger CRIO study discovery — fetches all sites + studies from CRIO.\n\nDispatches a background Celery task and returns immediately.\nAvailable only to orgs with active CRIO configuration.","operationId":"discover_crio_studies_api_v1_studies_crio_discover_post","responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/studies/{study_id}/crio/sync":{"post":{"tags":["studies"],"summary":"Sync Crio Study","description":"Trigger subject sync for a CRIO-linked study.\n\nDispatches a background Celery task with ~10s delay between API calls.\n5-minute cooldown per study to prevent hammering CRIO.","operationId":"sync_crio_study_api_v1_studies__study_id__crio_sync_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/crio/studies":{"get":{"tags":["studies"],"summary":"List Crio Studies","description":"List all studies with a CRIO study ID for the destination dropdown.","operationId":"list_crio_studies_api_v1_studies_crio_studies_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/studies/{study_id}/script-performance":{"get":{"tags":["script-performance"],"summary":"Script Performance","description":"Funnel per (script, lead-temperature segment) for one study.","operationId":"script_performance_api_v1_studies__study_id__script_performance_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/reach":{"get":{"tags":["script-performance"],"summary":"Study Reach","description":"How far outreach got on this study, and when people pick up.\n\nSame SQL as the campaign report the team sends clients — see\nmodules/studies/reach.py for why that matters.","operationId":"study_reach_api_v1_studies__study_id__reach_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/reach/detail":{"get":{"tags":["script-performance"],"summary":"Reach Detail","description":"The rows behind one bar on the Activity charts.\n\nA chart that asserts \"10 of 266\" and cannot be opened asks to be taken on\nfaith. Same timezone and same definitions as the bar itself (reach.py), so\nwhat opens cannot disagree with what was clicked.","operationId":"reach_detail_api_v1_studies__study_id__reach_detail_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"channel","in":"query","required":true,"schema":{"type":"string","title":"Channel"}},{"name":"bucket","in":"query","required":true,"schema":{"type":"string","title":"Bucket"}},{"name":"value","in":"query","required":true,"schema":{"type":"string","title":"Value"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/experiments":{"get":{"tags":["experiments"],"summary":"List Experiments","description":"Experiments newest-first with per-variant funnels, plus the study's\ncurrent opener (variant A's text) so the UI can render the comparison.","operationId":"list_experiments_api_v1_studies__study_id__experiments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["experiments"],"summary":"Create Experiment","operationId":"create_experiment_api_v1_studies__study_id__experiments_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateExperiment"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/experiments/{experiment_id}/pause":{"post":{"tags":["experiments"],"summary":"Pause Experiment","description":"Pause: all traffic reverts to variant A (send-time resolution only\nmatches status='running'). Assignments persist — resuming keeps arms\nconsistent.","operationId":"pause_experiment_api_v1_studies__study_id__experiments__experiment_id__pause_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Experiment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/experiments/{experiment_id}/resume":{"post":{"tags":["experiments"],"summary":"Resume Experiment","operationId":"resume_experiment_api_v1_studies__study_id__experiments__experiment_id__resume_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Experiment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/experiments/{experiment_id}/end":{"post":{"tags":["experiments"],"summary":"End Experiment","description":"End the test with no winner (#1216): the study's scripts and default agent\nstay exactly as they are, and the study's one test slot is free again.\n\nPromoting a winner was the only way to end a test, and that also makes the\nwinning script the study's active script and default agent: far too big a step\njust to start a new campaign. Pausing doesn't free the slot\n(uq_experiments_one_active counts every status but 'completed').","operationId":"end_experiment_api_v1_studies__study_id__experiments__experiment_id__end_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Experiment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/experiments/{experiment_id}/promote":{"post":{"tags":["experiments"],"summary":"Promote Winner","description":"End the experiment — the study KEEPS the chosen script/opener.\n\nOpener-mode: winner B's text becomes config.sms_opening_line (live after\nre-launch). Script-mode: the winning script becomes the study's active\nscript in Build, the winning agent becomes the study default (canonical\nfor every 'deployed LIMIT 1' resolution via updated_at), and outreach\nthat is queued but NOT yet executed — cadences, pending scheduled calls,\npending dial tasks — switches to the winner.","operationId":"promote_winner_api_v1_studies__study_id__experiments__experiment_id__promote_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"experiment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Experiment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoteBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients":{"get":{"tags":["patients"],"summary":"List Patients","description":"List patients with optional filters.\n\nSingle CTE query that JOINs outreach data inline. Sorting and paging are by\npatient (``page_ids``), not by patient-study row, so a patient in two studies\nis never split across a page boundary and ``limit`` means patients.","operationId":"list_patients_api_v1_patients_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"source_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Source Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"screening_result","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Screening Result"}},{"name":"source_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by source type: csv, crio, manual","title":"Source Type"},"description":"Filter by source type: csv, crio, manual"},{"name":"pipeline_status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma list of pipeline statuses","title":"Pipeline Status"},"description":"Comma list of pipeline statuses"},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"quick_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"stage:<key>, tag:<key>, ai:off, ai:paused, or an Inbox link (needs_attention, human_handoff, follow_up_due, needs_review, new, scheduled, sms_sent, handoff_done, to_contact, unreachable, voicemail, link_sent, not_attempted, inbound_calls)","title":"Quick Filter"},"description":"stage:<key>, tag:<key>, ai:off, ai:paused, or an Inbox link (needs_attention, human_handoff, follow_up_due, needs_review, new, scheduled, sms_sent, handoff_done, to_contact, unreachable, voicemail, link_sent, not_attempted, inbound_calls)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"sort","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"One of: needs, attention, name, source_name, stage, pipeline_status, screening, last_contacted_at, created_at. Omit for most recently contacted first.","title":"Sort"},"description":"One of: needs, attention, name, source_name, stage, pipeline_status, screening, last_contacted_at, created_at. Omit for most recently contacted first."},{"name":"dir","in":"query","required":false,"schema":{"type":"string","pattern":"^(asc|desc)$","default":"asc","title":"Dir"}},{"name":"tz","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Viewer's IANA timezone — what 'today' means for the attention sort","title":"Tz"},"description":"Viewer's IANA timezone — what 'today' means for the attention sort"},{"name":"view","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Inbox tab: one of needs_action, calls_due, handoffs, replied, needs_review, new_leads, scheduled. Omit for all patients.","title":"View"},"description":"Inbox tab: one of needs_action, calls_due, handoffs, replied, needs_review, new_leads, scheduled. Omit for all patients."},{"name":"contact","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma list, any of: replied, no_reply, undelivered, inbound_call, do_not_contact","title":"Contact"},"description":"Comma list, any of: replied, no_reply, undelivered, inbound_call, do_not_contact"},{"name":"activity","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Last touch on any channel: today, 7d, 30d, stale","title":"Activity"},"description":"Last touch on any channel: today, 7d, 30d, stale"},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma list of the patient's stage (#930): scheduled, transferred, eligible, contacted, new, not_interested, not_eligible, or none","title":"State"},"description":"Comma list of the patient's stage (#930): scheduled, transferred, eligible, contacted, new, not_interested, not_eligible, or none"},{"name":"date_field","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Which date date_from/date_to apply to: added, contacted, visit","title":"Date Field"},"description":"Which date date_from/date_to apply to: added, contacted, visit"},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD, inclusive, viewer's timezone","title":"Date From"},"description":"YYYY-MM-DD, inclusive, viewer's timezone"},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD, inclusive, viewer's timezone","title":"Date To"},"description":"YYYY-MM-DD, inclusive, viewer's timezone"},{"name":"hide_mock","in":"query","required":false,"schema":{"type":"boolean","description":"Leave out test patients (is_mock)","default":false,"title":"Hide Mock"},"description":"Leave out test patients (is_mock)"},{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Just this patient: the Inbox row for a patient page","title":"Patient Id"},"description":"Just this patient: the Inbox row for a patient page"},{"name":"ids","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Just these patients, comma-separated (up to 200): Needs you's rows, which come from the contact list","title":"Ids"},"description":"Just these patients, comma-separated (up to 200): Needs you's rows, which come from the contact list"},{"name":"assigned","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Who's handling them: me, none, or a team member's id","title":"Assigned"},"description":"Who's handling them: me, none, or a team member's id"},{"name":"tag","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"An open tag (kernel/tags), on top of quick_filter: the Inbox's Tag menu, which mustn't replace a link's filter","title":"Tag"},"description":"An open tag (kernel/tags), on top of quick_filter: the Inbox's Tag menu, which mustn't replace a link's filter"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["patients"],"summary":"Create Patient","description":"Create a single patient manually.","operationId":"create_patient_api_v1_patients_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePatientRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/stats":{"get":{"tags":["patients"],"summary":"Patient Stats","description":"Inbox KPI counts aggregated across ALL patients.","operationId":"patient_stats_api_v1_patients_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/study/{study_id}/add-patient":{"post":{"tags":["patients"],"summary":"Add Patient To Study","description":"Add an existing or new patient to a study. No agent required, no CRIO sync.\n\nIf patient_id is provided, links the existing patient.\nIf name + phone is provided, creates a new patient and links them.","operationId":"add_patient_to_study_api_v1_patients_study__study_id__add_patient_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddPatientToStudyRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/bulk/preview":{"post":{"tags":["patients"],"summary":"Preview Bulk","description":"What the action would do to each patient. Nothing is written.","operationId":"preview_bulk_api_v1_patients_bulk_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/patients/bulk/batches":{"post":{"tags":["patients"],"summary":"Start Bulk","description":"Record a confirmed bulk action. Its patients are applied in chunks after.","operationId":"start_bulk_api_v1_patients_bulk_batches_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["patients"],"summary":"List Bulk","description":"The organization's recent bulk actions, newest first, with whether each can\nstill be undone (by whom asks: its own author, or an admin).","operationId":"list_bulk_api_v1_patients_bulk_batches_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/bulk/batches/{batch_id}/apply":{"post":{"tags":["patients"],"summary":"Apply Bulk","description":"Apply one chunk: look at each patient again, then change the ones still due.","operationId":"apply_bulk_api_v1_patients_bulk_batches__batch_id__apply_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Batch Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__modules__patients__bulk__ApplyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/bulk/batches/{batch_id}/items":{"get":{"tags":["patients"],"summary":"Bulk Items","description":"Every patient a bulk action touched, and what happened.","operationId":"bulk_items_api_v1_patients_bulk_batches__batch_id__items_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Batch Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/bulk/batches/{batch_id}/undo/preview":{"post":{"tags":["patients"],"summary":"Preview Undo","description":"What an undo would put back, patient by patient. Nothing is written.","operationId":"preview_undo_api_v1_patients_bulk_batches__batch_id__undo_preview_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Batch Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/bulk/batches/{batch_id}/undo":{"post":{"tags":["patients"],"summary":"Undo Bulk","description":"Put back what the bulk action changed, for the patients still as it left them.\nRecorded as a bulk action of its own (undo_of), so it shows in the history and the\noriginal can't be undone twice.\n\nUp to UNDO_CHUNK patients per request; the reply's ``batch.finished`` says whether\nto call again. A call after the browser was closed part-way carries on the same\nundo.","operationId":"undo_bulk_api_v1_patients_bulk_batches__batch_id__undo_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"batch_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Batch Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/bulk/presets":{"get":{"tags":["patients"],"summary":"List Presets","description":"The ready-made bulk actions, with how many patients each would pick now.","operationId":"list_presets_api_v1_patients_bulk_presets_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/bulk/presets/{key}/targets":{"post":{"tags":["patients"],"summary":"Preset Targets","description":"The patients a preset picks (up to MAX_BATCH), for the bulk review.","operationId":"preset_targets_api_v1_patients_bulk_presets__key__targets_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PresetTargetsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/export/answers":{"post":{"tags":["patients"],"summary":"Export Answers","description":"Answers, screening result and age for these patients; see the module doc.","operationId":"export_answers_api_v1_patients_export_answers_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/patients/{patient_id}":{"get":{"tags":["patients"],"summary":"Get Patient","description":"Full patient detail with subjects, screening details.","operationId":"get_patient_api_v1_patients__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["patients"],"summary":"Update Patient","description":"Set contact-permission flags (do-not-call / do-not-text).\n\nAudited: every change records who flipped what, when — opt-out state\nchanges are exactly what a monitor asks about.","operationId":"update_patient_api_v1_patients__patient_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePatientFlagsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/screening":{"patch":{"tags":["patients"],"summary":"Override Screening","description":"A coordinator decides the screening: eligible, ineligible, or needs_review\n(Check eligibility, #992): the check_eligibility tag with their note, this study's\nAI paused and any waiting CRIO push cancelled, until they mark eligible or not.","operationId":"override_screening_api_v1_patients__patient_id__screening_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningOverrideRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/screening/reask":{"post":{"tags":["patients"],"summary":"Reask Screening","description":"Put the unclear questions back to the patient instead of guessing.\n\nA review hold left a coordinator three choices: qualify the patient on an\nanswer nobody could read, reject them on it, or re-run the judge over the\nsame words. The answer they actually want — \"ask him that again\" — did not\nexist, so the hold resolved as a guess either way.\n\nThis marks the chosen answers unanswered and lifts the hold. Vera asks an\nunanswered question on its next contact, so nothing is dialled here; the\ncadence picks them up as it would any unfinished screening. The old answer\nstays in that question's history.","operationId":"reask_screening_api_v1_patients__patient_id__screening_reask_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReaskRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/reevaluate":{"post":{"tags":["patients"],"summary":"Reevaluate Patient","description":"Rebuild this patient's screening for a study from every call and text.\n\nPreview first (what changes and what will happen), then apply. Never clears\ndo-not-call or a STOP; replaces a coordinator's decision only on apply.","operationId":"reevaluate_patient_api_v1_patients__patient_id__reevaluate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReevaluateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/next-calls":{"get":{"tags":["patients"],"summary":"Get Next Calls","description":"Get upcoming scheduled calls for a patient across all studies.\n\nEach call carries ``kind`` / ``source`` / ``patient_words`` when the patient\n(or the team) asked for it, so the detail page can say \"Callback requested\nby text — 'Tuesday afternoon'\" rather than a bare time. ``needs_time`` is set\nwhen their latest callback request could not be parsed and nothing has been\nscheduled since.","operationId":"get_next_calls_api_v1_patients__patient_id__next_calls_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/timezone":{"get":{"tags":["patients"],"summary":"Get Patient Timezone","description":"The patient's own timezone (#1145), if set, and each of their studies' default,\nwhich applies while it isn't: what the profile's timezone select shows.","operationId":"get_patient_timezone_api_v1_patients__patient_id__timezone_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["patients"],"summary":"Set Patient Timezone","description":"Set the patient's own timezone, or clear it to use the study's (#1145). Their\ncalls, texts and booking times use it from the next one on.","operationId":"set_patient_timezone_api_v1_patients__patient_id__timezone_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientTimezoneRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/schedulable-agents":{"get":{"tags":["patients"],"summary":"Get Schedulable Agents","description":"Deployed agents of the studies this patient is in, with the timezone a\nscheduled call's date/time is interpreted in.","operationId":"get_schedulable_agents_api_v1_patients__patient_id__schedulable_agents_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/schedule-call":{"post":{"tags":["patients"],"summary":"Schedule Patient Call","description":"Schedule an AI outbound call to this patient at a specific time.\n\nGoes through ``schedule_callback`` so it supersedes any pending call for\nthe agent and clears campaign touches up to it. If the patient's last call\non this study asked for a callback, it is a ``callback_requested`` call\n(Vera opens with \"you asked me to call you back\"); otherwise a\n``scheduled_follow_up``. No eligibility requirement — this is a call, not\na visit.","operationId":"schedule_patient_call_api_v1_patients__patient_id__schedule_call_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleCallRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/state":{"patch":{"tags":["patients"],"summary":"Transition State","description":"Transition a subject's status within a study.","operationId":"transition_state_api_v1_patients__patient_id__state_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StateTransitionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/studies/{study_id}/withdraw":{"post":{"tags":["patients"],"summary":"Withdraw From Study","description":"Withdraw a patient from a study. Preserves all data for audit.\n\nThe body may say why ({\"reason\": one of WITHDRAW_REASONS, \"note\": \"...\"}): it is\nkept on the subject (disposition_reason) and in the audit entry, so the team can\nlater see why someone was taken out (PCCRS, 2026-11-13: one was, and no one knew\nwhy).","operationId":"withdraw_from_study_api_v1_patients__patient_id__studies__study_id__withdraw_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/archive":{"post":{"tags":["patients"],"summary":"Archive Patient","description":"Archive a patient — soft delete. Hides from lists, stops all outreach.\nAll data preserved for audit. No hard delete available in the UI.","operationId":"archive_patient_api_v1_patients__patient_id__archive_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/link-crio":{"patch":{"tags":["patients"],"summary":"Link Crio Patient","description":"Link or update a patient's CRIO patient ID.\n\nVerifies the CRIO patient exists via the API, then updates the local\npatient record with the CRIO ID and pulls name/phone/email/address\nfrom CRIO to keep the local record in sync.","operationId":"link_crio_patient_api_v1_patients__patient_id__link_crio_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkCrioRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/appointment":{"get":{"tags":["patients"],"summary":"Get Patient Appointment","description":"Get the patient's latest appointment for a study.","operationId":"get_patient_appointment_api_v1_patients__patient_id__appointment_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/pending-crio-push":{"get":{"tags":["patients"],"summary":"Get Pending Crio Push","description":"Check if patient has a pending or recently failed CRIO push.","operationId":"get_pending_crio_push_api_v1_patients__patient_id__pending_crio_push_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/dismiss-crio-error":{"post":{"tags":["patients"],"summary":"Dismiss Crio Error","description":"Dismiss a failed CRIO push error so it stops showing on the patient profile.\nThat push's study only (K16, user 2026-10-27; ``task_id`` names it, else the\nnewest failure), audited.","operationId":"dismiss_crio_error_api_v1_patients__patient_id__dismiss_crio_error_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CrioTaskRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/cancel-crio-push":{"post":{"tags":["patients"],"summary":"Cancel Crio Push","description":"Cancel a pending timer-based CRIO push for this patient: that push's study only\n(K16, user 2026-10-27; it used to revoke every study's), and its visits are marked\nnot sent so they don't sit 'pending' with nothing behind them.","operationId":"cancel_crio_push_api_v1_patients__patient_id__cancel_crio_push_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CrioTaskRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/push-to-ctms":{"post":{"tags":["patients"],"summary":"Push Patient To Ctms","description":"Push a patient to CRIO — create patient + enroll in study + book appointment.\n\nIf a pending timer-based push exists, executes it immediately.\nOtherwise dispatches a new push.","operationId":"push_patient_to_ctms_api_v1_patients__patient_id__push_to_ctms_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushToCtmsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/import-from-ctms":{"post":{"tags":["patients"],"summary":"Import From Ctms","description":"Import a patient from an external CTMS into Intera.\n\nUsed after dedup detects a patient already exists in CRIO —\ncoordinator clicks \"Import from CRIO\" to pull their full record.","operationId":"import_from_ctms_api_v1_patients_import_from_ctms_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFromCtmsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/patients/{patient_id}/reschedule-visit":{"post":{"tags":["patients"],"summary":"Reschedule Visit","description":"Reschedule a patient's visit — update CRIO appointment + local record + send SMS.\n\nCoordinator provides new date/time and an optional SMS body (pre-generated\nby the frontend, editable). If SMS body is provided, sends it to the patient.","operationId":"reschedule_visit_api_v1_patients__patient_id__reschedule_visit_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RescheduleVisitRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/cancel-appointment":{"post":{"tags":["patients"],"summary":"Cancel Appointment","description":"Cancel an appointment locally and in CRIO if synced.","operationId":"cancel_appointment_api_v1_patients__patient_id__cancel_appointment_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelAppointmentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/appointments/{appointment_id}/outcome":{"post":{"tags":["patients"],"summary":"Set Appointment Outcome","description":"Mark a visit attended or no-show, by hand (#829).\n\nFor sites whose CRIO sends no visit webhook, this is the only way attendance is\nrecorded. A no-show also sets the study status to SCHEDULED_V1_NO_SHOW_CANCELLED.\nReminders still pending for the visit are cancelled. Nothing is sent to CRIO.","operationId":"set_appointment_outcome_api_v1_patients__patient_id__appointments__appointment_id__outcome_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}},{"name":"appointment_id","in":"path","required":true,"schema":{"type":"string","title":"Appointment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentOutcomeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/confirmation-preview":{"get":{"tags":["patients"],"summary":"Confirmation Preview","description":"The exact confirmation text Set Appointment would send (#944). Read only.","operationId":"confirmation_preview_api_v1_patients__patient_id__confirmation_preview_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}},{"name":"study_id","in":"query","required":true,"schema":{"type":"string","title":"Study Id"}},{"name":"date","in":"query","required":true,"schema":{"type":"string","maxLength":20,"title":"Date"}},{"name":"time","in":"query","required":true,"schema":{"type":"string","maxLength":20,"title":"Time"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/set-appointment":{"post":{"tags":["patients"],"summary":"Set Appointment","description":"Manually create an appointment in both Intera and CRIO.\n\nCreates a local appointment record, then immediately books it in CRIO\n(no timer delay). Optionally sends confirmation SMS. For testing and\nmanual booking by coordinators.","operationId":"set_appointment_api_v1_patients__patient_id__set_appointment_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetAppointmentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/interactions":{"post":{"tags":["patients"],"summary":"Log Interaction","description":"Log a manual interaction (call, SMS, email, note) for a patient.","operationId":"log_interaction_api_v1_patients__patient_id__interactions_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogInteractionRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["patients"],"summary":"List Interactions","description":"List all interactions for a patient, most recent first.","operationId":"list_interactions_api_v1_patients__patient_id__interactions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/interactions/{interaction_id}/analyze":{"post":{"tags":["patients"],"summary":"Analyze Interaction","description":"Trigger AI analysis on a manually logged interaction.","operationId":"analyze_interaction_api_v1_patients__patient_id__interactions__interaction_id__analyze_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"interaction_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Interaction Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/activity":{"get":{"tags":["patients"],"summary":"Get Patient Activity","description":"Activity feed for a patient: calls, texts and SMS conversation summaries.\n\nModes, newest first (#875):\n\n- no cursor: the newest ``limit`` items, plus ``next_cursor``\n- ``before=<cursor>``: the ``limit`` items older than the cursor (\"Load more\")\n- ``since=<cursor>``: every item at or after the cursor — the timeline's head,\n  which the client polls so new items appear and recent ones refresh without\n  anything being pushed off a page\n- ``item=<id>`` (first load only): every item from that one up, with\n  ``next_cursor`` for what's older, so a tag chip's link opens the exact call or\n  text however far back it is (#930); the newest ``limit`` when it isn't here\n- ``page=N``: the old OFFSET pages, kept for old clients and the page-1 cards;\n  stage and tag history isn't in them (those cards read the latest call)\n\nThe cursor modes are the profile's one stream of texts, calls and visits\n(#1004): they leave out the SMS conversation summaries, which only the\n``page=N`` cards read. ``filter`` and ``q`` apply to every mode and to\n``total``; ``total_all`` is the unfiltered count. The GET only reads: the Vapi pull for\ncalls without a webhook runs on the Beat tick (sync_open_calls_tick).\nWhen study_id is provided, only that study's items are returned.","operationId":"get_patient_activity_api_v1_patients__patient_id__activity_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"title":"Page"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Before"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Since"}},{"name":"filter","in":"query","required":false,"schema":{"type":"string","pattern":"^(all|calls|sms|risk|hesitant|scheduled|notes|booking_link)$","default":"all","title":"Filter"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Q"}},{"name":"item","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Item"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/interactions/{interaction_id}":{"get":{"tags":["patients"],"summary":"Get Interaction Detail","description":"Get full interaction detail including transcript + extraction data.","operationId":"get_interaction_detail_api_v1_patients__patient_id__interactions__interaction_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"interaction_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Interaction Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/sms":{"post":{"tags":["patients"],"summary":"Send Patient Sms","description":"Send an SMS to a patient from the coordinator dashboard.","operationId":"send_patient_sms_api_v1_patients__patient_id__sms_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendSmsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/upcoming-reminders":{"get":{"tags":["patients"],"summary":"Get Upcoming Reminders","description":"Pending appointment-reminder SMS for a patient, soonest first, plus the\nnext upcoming visit (the card offers Send Now only when there is one).","operationId":"get_upcoming_reminders_api_v1_patients__patient_id__upcoming_reminders_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/send-reminder":{"post":{"tags":["patients"],"summary":"Send Reminder","description":"Send the patient's next-appointment reminder SMS now.","operationId":"send_reminder_api_v1_patients__patient_id__send_reminder_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendReminderRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/reminder-preferences":{"patch":{"tags":["patients"],"summary":"Update Reminder Preferences","description":"Turn appointment reminders off (or back on) for one patient.\n\nTurning them off also cancels the reminders already scheduled. Their\ndedupe_key is cleared as they are cancelled: sync_reminder_touches skips any\nkey that already exists, so a kept key would block the reminder for good\nand turning reminders back on would bring nothing back. With it cleared, the\nnext scheduler tick re-creates whatever is still ahead.","operationId":"update_reminder_preferences_api_v1_patients__patient_id__reminder_preferences_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderPrefsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/memories":{"get":{"tags":["patients"],"summary":"Get Patient Memories","description":"Get accumulated memories for a patient.\n\nWhen study_id is provided, returns:\n- Subject-scope memories for that study (study_id = X)\n- Plus all patient-scope memories (scope = 'patient', always visible)\n\nWhen study_id is omitted, returns all memories (backward compat).","operationId":"get_patient_memories_api_v1_patients__patient_id__memories_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/call-tracking":{"get":{"tags":["patients"],"summary":"Get Call Tracking","description":"Get call response tracking summary for a patient.","operationId":"get_call_tracking_api_v1_patients__patient_id__call_tracking_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/export/pdf":{"get":{"tags":["patients"],"summary":"Export Patient Pdf","description":"Export full patient case file as PDF.","operationId":"export_patient_pdf_api_v1_patients__patient_id__export_pdf_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/interactions/{interaction_id}/export/pdf":{"get":{"tags":["patients"],"summary":"Export Call Pdf","description":"Export a single call analysis as PDF.","operationId":"export_call_pdf_api_v1_patients__patient_id__interactions__interaction_id__export_pdf_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"interaction_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Interaction Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/escalation/acknowledge":{"post":{"tags":["patients"],"summary":"Acknowledge Patient Escalation","description":"Mark an escalation as acknowledged by the current user.","operationId":"acknowledge_patient_escalation_api_v1_patients__patient_id__escalation_acknowledge_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationAcknowledgeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/escalation/resolve":{"post":{"tags":["patients"],"summary":"Resolve Patient Escalation","description":"Resolve an escalation with a note and optional visit details + SMS.","operationId":"resolve_patient_escalation_api_v1_patients__patient_id__escalation_resolve_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationResolveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/contacted":{"post":{"tags":["patients"],"summary":"Mark Patient Contacted","operationId":"mark_patient_contacted_api_v1_patients__patient_id__contacted_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactedRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/ai":{"post":{"tags":["patients"],"summary":"Set Patient Ai","description":"The profile's \"AI calls & texts\" switch (#943, #774; one switch since\n2026-10-23). Off: no AI call, text or campaign touch on any study. On: everything\nthat stopped it lifts (services/ai_pause.resume_ai): the no-AI opt-out and the\n\"Wants a person\" tags pausing it, and the steps the pause held are skipped. A reason\nis optional; it, who and when are kept in the audit log. 409 when it's already\nthat way.","operationId":"set_patient_ai_api_v1_patients__patient_id__ai_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AiRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/opt-out/lift":{"post":{"tags":["patients"],"summary":"Lift Patient Opt Out","description":"Lift an opt-out that was a misunderstanding (#1343 item 13): AI back on, Do not\ncall and Do not text cleared with the coordinator's note, the declined study\nreopened, then the qualified steps (the booking link, the CRIO push) for an\neligible study whose link never went. 409 for a carrier STOP (only the patient's\nSTART lifts it), CRIO's do-not-solicit, or nothing to lift.","operationId":"lift_patient_opt_out_api_v1_patients__patient_id__opt_out_lift_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptOutLiftRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/numbers":{"get":{"tags":["patients"],"summary":"Patient Number Blocks","description":"The channels stopped on this patient's numbers because they kept failing\n(#960): e.g. texts stopped on the cell, '30005 ×2 (10-17..10-19)'.","operationId":"patient_number_blocks_api_v1_patients__patient_id__numbers_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/numbers/try-again":{"post":{"tags":["patients"],"summary":"Try Patient Number Again","description":"A coordinator says try this channel on this number again (#960): its block\nlifts, the count starts over, and a patient closed out for it gets their paused\ncampaigns back. 409 when that channel isn't stopped on that number.","operationId":"try_patient_number_again_api_v1_patients__patient_id__numbers_try_again_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NumberRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/assignee":{"put":{"tags":["patients"],"summary":"Set Patient Assignee","description":"Who on the team is handling this patient (client 0053): \"Assign to me\" on a\nQueue row or the patient panel. Bulk \"Assign to…\" does many at once. Only a member\nof this organization's team can be assigned.","operationId":"set_patient_assignee_api_v1_patients__patient_id__assignee_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssigneeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/patients/{patient_id}/enrollments":{"get":{"tags":["patients"],"summary":"Patient Enrollments","description":"Return all campaign enrollments for a patient, optionally filtered by study.","operationId":"patient_enrollments_api_v1_patients__patient_id__enrollments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sources/csv-template":{"get":{"tags":["sources"],"summary":"Download Csv Template","description":"Download a CSV template with expected column headers + example rows.","operationId":"download_csv_template_api_v1_sources_csv_template_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/sources/upload":{"post":{"tags":["sources"],"summary":"Upload File","description":"Upload a CSV or XLSX file. Returns raw rows for header selection.","operationId":"upload_file_api_v1_sources_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_file_api_v1_sources_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RawUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/sources/{source_id}/set-header":{"post":{"tags":["sources"],"summary":"Set Header Row","description":"Select which row is the header. Returns preview with auto-mapped columns.","operationId":"set_header_row_api_v1_sources__source_id__set_header_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetHeaderRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetHeaderResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sources/{source_id}/column-mapping":{"post":{"tags":["sources"],"summary":"Set User Column Mapping","description":"Save the user's column mapping overrides (source_col -> target_field).","operationId":"set_user_column_mapping_api_v1_sources__source_id__column_mapping_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ColumnMappingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ColumnMappingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sources/{source_id}/mapping":{"post":{"tags":["sources"],"summary":"Set Study Mapping","description":"Set study link + inclusion/exclusion criteria for a source.","operationId":"set_study_mapping_api_v1_sources__source_id__mapping_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sources/{source_id}/import":{"post":{"tags":["sources"],"summary":"Run Import","description":"Start (or resume) importing the uploaded file in the background (#1152).\n\nThe rows are checked, deduped (Intera's own patients, then CRIO) and created by a\nCelery job, ``tasks/source_import.import_source``, so a large file never runs\ninto the request timeout. Progress is kept on the source (``config.import``:\nrows done, counts, heartbeat, the run id). A stopped import (CRIO down, a worker\nkilled) resumes from the last saved batch; ``restart`` starts over. One import\nat a time per org, so imports never fill the worker calls share. 202 at once.","operationId":"run_import_api_v1_sources__source_id__import_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/RestartRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sources/{source_id}/validate":{"post":{"tags":["sources"],"summary":"Validate Source","description":"Run full validation against all rows. Returns errors, warnings, and duplicates.","operationId":"validate_source_api_v1_sources__source_id__validate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sources/{source_id}/screen":{"post":{"tags":["sources"],"summary":"Run Screening","description":"Screen imported patients against study inclusion/exclusion criteria.","operationId":"run_screening_api_v1_sources__source_id__screen_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sources":{"get":{"tags":["sources"],"summary":"List Sources","description":"List all patient data sources for this client.","operationId":"list_sources_api_v1_sources_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/sources/{source_id}/temperature":{"patch":{"tags":["sources"],"summary":"Set Source Temperature","description":"Tag a source's lead temperature — cold vs warm.","operationId":"set_source_temperature_api_v1_sources__source_id__temperature_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sources/{source_id}":{"get":{"tags":["sources"],"summary":"Get Source","description":"Get source detail including mapping and errors.","operationId":"get_source_api_v1_sources__source_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["sources"],"summary":"Delete Source","description":"Delete a patient source and its associated data.","operationId":"delete_source_api_v1_sources__source_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/calls/create":{"post":{"tags":["calls"],"summary":"Create Call","description":"Initiate an outbound call to a patient via Vapi.\n\nSupports two modes:\n- With patient_id: looks up patient phone, logs interaction\n- Without patient_id (test call): requires phone_number, skips interaction logging","operationId":"create_call_api_v1_calls_create_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCallRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCallResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/agents":{"get":{"tags":["compiler"],"summary":"List Agents","description":"List agents from the client DB. Optionally filter by study_id.\n\ntorn_down agents are hidden — they're soft-deleted (audit rows are\nappend-only, so deployed agents can never be hard-deleted).\n\nWith a study: ``in_use`` marks THE agent of each script (kernel.phones.\nscript_agent, #1227), the one calls, tests and Start use; any other deployed\ncopy is an old copy, kept (never torn down automatically) and listed after.","operationId":"list_agents_api_v1_compiler_agents_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["compiler"],"summary":"Create Agent","description":"Compile a StudySpec via vera-compiler and store the result.","operationId":"create_agent_api_v1_compiler_agents_post","security":[{"HTTPBearer":[]}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/compiler/agents/{agent_id}":{"get":{"tags":["compiler"],"summary":"Get Agent","description":"Get full agent detail from client DB.","operationId":"get_agent_api_v1_compiler_agents__agent_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["compiler"],"summary":"Delete Agent","description":"Tear down Vapi resources and delete agent.","operationId":"delete_agent_api_v1_compiler_agents__agent_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/draft":{"post":{"tags":["compiler"],"summary":"Create Draft Agent","description":"Create a draft agent from an extracted or manually built StudySpec.\nNo validation or compilation — just saves the spec for editing.","operationId":"create_draft_agent_api_v1_compiler_agents_draft_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/agents/from-study/{study_id}":{"post":{"tags":["compiler"],"summary":"Create Agent From Study","description":"The agent of a study's script: the existing one, or a new one compiled from the\nstudy's StudySpec config (#1227).\n\nOne agent per study + script, re-used. When the study already has an agent built\nfrom this script (``script_variant_id``, or the active script), that agent is\nreturned (``reused``) and the caller deploys it, which recompiles it in place\nfrom the study's current config (deploy.build_deploy_spec) and updates its Vapi\nassistant: same id, same coordinator numbers, phone line and call settings.\nEvery campaign Start used to insert a new copy with none of those, and the\nnewest copy took the study's calls over (Palm Beach, 2026-11-19: qualified\npatients got a callback, not a transfer).\n\nOnly a script that has never been launched gets a new agent; it starts with the\nstudy agent's coordinator numbers, inbound mode and call settings.\n\nAccepts optional JSON body: {\"agent_label\": \"Custom Name\", \"script_variant_id\": ...}.\nThe label defaults to the script's or the study's name (with a suffix if taken).","operationId":"create_agent_from_study_api_v1_compiler_agents_from_study__study_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/draft":{"post":{"tags":["compiler"],"summary":"Save Draft","description":"Save work-in-progress StudySpec without validation (autosave target).","operationId":"save_draft_api_v1_compiler_agents__agent_id__draft_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/handoff-number":{"patch":{"tags":["compiler"],"summary":"Update Handoff Number","description":"Retired: the single-number setter.\n\nIt wrote the legacy column, skipped the line-type and extension checks (so\n\"…ext 12\" saved as one wrong number), and PATCHed a transferCall tool straight\nto Vapi with no extension, hold audio or study lines — overwriting an office\nline's tool. Nothing calls it; PATCH /handoff-numbers is the one setter.","operationId":"update_handoff_number_api_v1_compiler_agents__agent_id__handoff_number_patch","parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/handoff-numbers":{"patch":{"tags":["compiler"],"summary":"Update Handoff Numbers","description":"Set the ordered list of coordinator numbers for sequential warm handoff.\n\nBody: {\"handoff_numbers\": [{\"number\": \"+1...\", \"name\": \"Daniela\", \"priority\": 1,\n                            \"line_type\": \"extension\", \"keys\": \"679\"}, ...]}\nMax 5 entries. Each must have `number` (E.164) and `name`. ``line_type`` is\n\"direct\" (default) or \"extension\"; an extension line needs ``keys``, the\ndigits pressed once the line answers (phones.clean_handoff_line).","operationId":"update_handoff_numbers_api_v1_compiler_agents__agent_id__handoff_numbers_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/handoff-stats":{"get":{"tags":["compiler"],"summary":"Get Handoff Stats","description":"Aggregate transfer event stats for this agent.","operationId":"get_handoff_stats_api_v1_compiler_agents__agent_id__handoff_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/vapi-registry":{"get":{"tags":["compiler"],"summary":"List Vapi Registry","description":"List all Vapi resources registered for this org.","operationId":"list_vapi_registry_api_v1_compiler_vapi_registry_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/agents/{agent_id}/deploy":{"post":{"tags":["compiler"],"summary":"Deploy Agent","description":"Compile + deploy to Vapi via vera-compiler service.\n\nReads Vapi credentials from agent_config.providers, passes them\nto the service, and persists Vapi IDs + deployment record.","operationId":"deploy_agent_api_v1_compiler_agents__agent_id__deploy_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/pending-changes":{"get":{"tags":["compiler"],"summary":"Pending Changes","description":"What a redeploy would change: the study settings edited since this agent\nwas last deployed.\n\nCompares the spec a deploy would send NOW (build_deploy_spec — the same\nfunction deploy uses) with the snapshot the last deploy stored on the agent.\nEdits to the study only reach patients on redeploy, and nothing used to say\nso — a coordinator could save, see \"saved\", and assume it was live.\n\nNot covered: the warm-handoff number (stored on the agent, not the spec — its\npanel already says to redeploy) and platform changes shipped in code, which\n/handoff-check and the deploy itself pick up.","operationId":"pending_changes_api_v1_compiler_agents__agent_id__pending_changes_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/versions":{"get":{"tags":["compiler"],"summary":"Get Versions","description":"Get deployment history for an agent.","operationId":"get_versions_api_v1_compiler_agents__agent_id__versions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/quick-create":{"post":{"tags":["compiler"],"summary":"Quick Create Agent","description":"One-click: auto-generate script flow -> create agent -> compile -> deploy.\n\nCreates a minimal screener agent with only confirm_appointment + endCall tools.\nReturns the agent ID and script flow for optional editing.","operationId":"quick_create_agent_api_v1_compiler_agents_quick_create_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuickCreateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/compile":{"post":{"tags":["compiler"],"summary":"Compile Studyspec","description":"Compile a StudySpec (validate + compile + eval gate). No Vapi, no DB write.","operationId":"compile_studyspec_api_v1_compiler_compile_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/estimate":{"post":{"tags":["compiler"],"summary":"Estimate Script","description":"How long the script takes run to the end (#1069): seconds, words, answers. For\nthe Build tab, on the draft as it's edited; no DB, no compile.","operationId":"estimate_script_api_v1_compiler_estimate_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/extract":{"post":{"tags":["compiler"],"summary":"Extract From Docs","description":"Extract a draft StudySpec from uploaded protocol documents.","operationId":"extract_from_docs_api_v1_compiler_extract_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/refine-criteria":{"post":{"tags":["compiler"],"summary":"Refine Criteria Endpoint","description":"AI-polish exclusion criteria wording.","operationId":"refine_criteria_endpoint_api_v1_compiler_refine_criteria_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/refine-step":{"post":{"tags":["compiler"],"summary":"Refine Step Endpoint","description":"AI-polish one script-flow step.","operationId":"refine_step_endpoint_api_v1_compiler_refine_step_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/keyterms":{"post":{"tags":["compiler"],"summary":"Keyterms Preview","description":"The transcriber vocabulary this config would compile to — read-only preview\nfor the builder UI. Duck-typed over the raw config so drafts work.","operationId":"keyterms_preview_api_v1_compiler_keyterms_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/compensation-preview":{"post":{"tags":["compiler"],"summary":"Compensation Preview","description":"The builder's pay panel, rendered by the compiler itself so it can't drift:\n``spoken`` is the exact sentence Vera will say (null when pay isn't discussed) and\n``problems`` the same pay check compile runs. Works over raw draft values.","operationId":"compensation_preview_api_v1_compiler_compensation_preview_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/default-flow":{"post":{"tags":["compiler"],"summary":"Default Flow","description":"Build default script-flow from a section-based spec.","operationId":"default_flow_api_v1_compiler_default_flow_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/browser-call":{"post":{"tags":["compiler"],"summary":"Browser Call","description":"Browser test call — uses deployed agent if available (full tool support),\notherwise falls back to transient compilation (conversation-only).\n\n``transient: true`` forces the reference vera-compiler behavior: compile on\nthe fly, no test patient, no memories — the caller's typed variableValues\nare the only identity the agent sees.","operationId":"browser_call_api_v1_compiler_browser_call_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/agents/from-intent":{"post":{"tags":["compiler"],"summary":"Create Agent From Intent","description":"Create a draft agent from study config + user intent.\n\n1. Loads study.config as the base StudySpec\n2. Uses LLM to interpret intent and generate agent-specific fields\n   (opening_line, agent_name, script_flow hints)\n3. Merges study config (base) + LLM output -> draft agent\n4. Auto-links patient sources if provided\n5. Creates outreach config if call window provided","operationId":"create_agent_from_intent_api_v1_compiler_agents_from_intent_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FromIntentRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/phone-numbers":{"get":{"tags":["compiler"],"summary":"List Org Phone Numbers","description":"List phone numbers assigned to my org. Read-only.","operationId":"list_org_phone_numbers_api_v1_compiler_phone_numbers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/agents/{agent_id}/phone-number":{"get":{"tags":["compiler"],"summary":"Get Agent Phone","description":"The agent's currently attached line (display number), or null.","operationId":"get_agent_phone_api_v1_compiler_agents__agent_id__phone_number_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["compiler"],"summary":"Attach Phone To Agent","description":"Attach an org-assigned phone number to an agent.\n\nCreates a lightweight inbound greeting assistant on Vapi so inbound\ncallers hear a static message with the coordinator number instead of\nreaching the full AI assistant.","operationId":"attach_phone_to_agent_api_v1_compiler_agents__agent_id__phone_number_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/phone-number/{vapi_number_id}":{"delete":{"tags":["compiler"],"summary":"Detach Phone From Agent","description":"Detach a phone number from an agent (and clear Vapi inbound routing).","operationId":"detach_phone_from_agent_api_v1_compiler_agents__agent_id__phone_number__vapi_number_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"vapi_number_id","in":"path","required":true,"schema":{"type":"string","title":"Vapi Number Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/inbound-mode":{"get":{"tags":["compiler"],"summary":"Get Inbound Mode","description":"What happens when someone calls this agent's line.","operationId":"get_inbound_mode_api_v1_compiler_agents__agent_id__inbound_mode_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["compiler"],"summary":"Set Inbound Mode","description":"Switch the line between the recorded greeting, live screening and\ntransfer-first (#828).\n\nWrites the agent's own mode (compiler.agents.inbound_mode, #828 — it used to\nbe the study config, which every agent on the study shared) and re-points the\nVapi number in the same request. Doing only the first would leave the setting\nreading \"screening\" while every caller still heard the greeting — the stored\nmode is not what routes the call.","operationId":"set_inbound_mode_api_v1_compiler_agents__agent_id__inbound_mode_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/sources":{"get":{"tags":["compiler"],"summary":"Get Agent Sources","description":"List patient sources linked to this agent.","operationId":"get_agent_sources_api_v1_compiler_agents__agent_id__sources_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["compiler"],"summary":"Link Agent Sources","description":"Link one or more patient sources to an agent.\n\nAlso creates ctms.subjects records for all patients from those sources,\nlinking them to the agent's study with source_id and agent_id tracking.","operationId":"link_agent_sources_api_v1_compiler_agents__agent_id__sources_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkSourcesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/sources/{source_id}":{"delete":{"tags":["compiler"],"summary":"Unlink Agent Source","description":"Unlink a patient source from an agent.","operationId":"unlink_agent_source_api_v1_compiler_agents__agent_id__sources__source_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/patients":{"get":{"tags":["compiler"],"summary":"Get Agent Patients","description":"Get eligible patients from this agent's linked sources.\n\nReturns patients that are:\n- From a linked source (via agent_sources)\n- Screened as 'eligible' for the agent's study\n- Not flagged do_not_call\n- Have a phone number\n- Don't have an active scheduled call for this agent\n- Haven't already connected (completed) for this agent","operationId":"get_agent_patients_api_v1_compiler_agents__agent_id__patients_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/patients/{patient_id}":{"delete":{"tags":["compiler"],"summary":"Remove Patient From Agent","description":"Remove a patient from agent's outreach pool by setting screening to 'removed'.","operationId":"remove_patient_from_agent_api_v1_compiler_agents__agent_id__patients__patient_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/add-patient":{"post":{"tags":["compiler"],"summary":"Add Patient To Agent","description":"Add a patient to an agent's outreach pool.\n\nTwo modes:\n- patient_id: link existing patient to agent's study\n- first_name + phone: create new patient + link","operationId":"add_patient_to_agent_api_v1_compiler_agents__agent_id__add_patient_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddPatientRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/outreach":{"get":{"tags":["compiler"],"summary":"Get Outreach Config","description":"Get outreach config for an agent. Returns defaults if none exists.","operationId":"get_outreach_config_api_v1_compiler_agents__agent_id__outreach_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["compiler"],"summary":"Upsert Outreach Config","description":"Create or update outreach config for an agent.","operationId":"upsert_outreach_config_api_v1_compiler_agents__agent_id__outreach_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutreachConfigRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notifications":{"get":{"tags":["compiler","notifications"],"summary":"List Notifications","description":"This user's notices, newest first. ``tab``: all (every notify event, ops\nincluded: only org admins receive those) | urgent | action | fyi | earlier (the old\nrows).","operationId":"list_notifications_api_v1_compiler_notifications_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tab","in":"query","required":false,"schema":{"type":"string","default":"all","title":"Tab"}},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}},{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Unread Only"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"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/v1/compiler/notifications/unread-count":{"get":{"tags":["compiler","notifications"],"summary":"Unread Count","description":"The badge: this user's unhandled group items and unread FYI, per tab. The old\nrows (Earlier) don't count.","operationId":"unread_count_api_v1_compiler_notifications_unread_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/notifications/{notification_id}/read":{"post":{"tags":["compiler","notifications"],"summary":"Mark Read","description":"Read, for this user only.","operationId":"mark_read_api_v1_compiler_notifications__notification_id__read_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notifications/{notification_id}/handled":{"post":{"tags":["compiler","notifications"],"summary":"Mark Handled","description":"Mark handled: a group item clears for everyone who has it, with who and when;\nan FYI is just read for this user.","operationId":"mark_handled_api_v1_compiler_notifications__notification_id__handled_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notifications/read-all":{"post":{"tags":["compiler","notifications"],"summary":"Mark All Read","description":"Everything read for this user (handled state is untouched).","operationId":"mark_all_read_api_v1_compiler_notifications_read_all_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/notifications/{notification_id}":{"delete":{"tags":["compiler","notifications"],"summary":"Dismiss Notification","description":"Remove it from this user's bell (a current notice stays on record, read).","operationId":"dismiss_notification_api_v1_compiler_notifications__notification_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notifications/held-email/{patient_id}":{"get":{"tags":["compiler","notifications"],"summary":"Held Email For Patient","description":"The held qualified-patient email for this patient, if there is one, so the\npatient page can offer Send where the reviewer reads the answers.","operationId":"held_email_for_patient_api_v1_compiler_notifications_held_email__patient_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notifications/{notification_id}/send-provider-email":{"post":{"tags":["compiler","notifications"],"summary":"Send Held Provider Email","description":"Send a qualified-patient email that was held for review: exactly the stored\npayload, through kernel/notify's outbox (``qualified.released``, at least once).\nIdempotent: a second click reports the first send (the held item is locked while\none send is recorded, so a double click can't queue it twice). Says so when the\nemail couldn't be queued, and keeps it held. Marks the held notice handled for the\ngroup.","operationId":"send_held_provider_email_api_v1_compiler_notifications__notification_id__send_provider_email_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SendHeldEmailRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notifications/{notification_id}/send-booking-link":{"post":{"tags":["compiler","notifications"],"summary":"Send Held Booking Link","description":"The coordinator's approval on a \"Scheduling link ready\" notice: text the patient\nthe study's booking link, through kernel/link_gate (``approved``: the Send link and\nits queued 8am send are the only callers that pass it), so it is saved, marked and\nsent once. The gate still refuses an opt-out, a lost eligibility or a link already\nsent, and says why (409, nothing texted).\n\n- One send per patient and study: kernel/link_gate's lock, then every review\n  notice for them is stamped in the same transaction as the saved text, so a\n  second press (on this notice or another) reports the first.\n- In the patient's quiet hours (before 8:00 or from 21:00 their time, #1104) it\n  doesn't text: it queues the send for their 8am (tasks/sms.send_scheduling_sms,\n  which asks the gate again then) and the notice says when.\n- The org's or study's AI switched off: refused, like every automated text.\n- Twilio is called with no transaction open (#923). When it refuses the text, the\n  saved text keeps its failure (a dead number counts it, #960) and the notice\n  comes back open with the reason, so Send link can be pressed again.\n- A Test Center notice texts the tester's handset as a test text.","operationId":"send_held_booking_link_api_v1_compiler_notifications__notification_id__send_booking_link_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notification-groups":{"get":{"tags":["compiler","notifications"],"summary":"List Groups","description":"The org's group per category (source \"none\" until saved), and its members.","operationId":"list_groups_api_v1_compiler_notification_groups_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/notification-groups/{category}":{"put":{"tags":["compiler","notifications"],"summary":"Save Group","description":"Save the fields a body names (send only what changed).","operationId":"save_group_api_v1_compiler_notification_groups__category__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"category","in":"path","required":true,"schema":{"type":"string","title":"Category"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notification-groups/studies/{study_id}":{"get":{"tags":["compiler","notifications"],"summary":"Study Groups","description":"Per category: the study's override (or null) and what applies now.","operationId":"study_groups_api_v1_compiler_notification_groups_studies__study_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notification-groups/studies/{study_id}/{category}":{"put":{"tags":["compiler","notifications"],"summary":"Save Study Override","operationId":"save_study_override_api_v1_compiler_notification_groups_studies__study_id___category__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"category","in":"path","required":true,"schema":{"type":"string","title":"Category"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["compiler","notifications"],"summary":"Remove Study Override","description":"Back to the org group.","operationId":"remove_study_override_api_v1_compiler_notification_groups_studies__study_id___category__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"category","in":"path","required":true,"schema":{"type":"string","title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/notification-groups/test":{"post":{"tags":["compiler","notifications"],"summary":"Send Test","description":"Send a test message to a Slack or Teams webhook before saving it.","operationId":"send_test_api_v1_compiler_notification_groups_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compiler/notification-groups/failures":{"get":{"tags":["compiler","notifications"],"summary":"Delivery Failures","description":"Recent email / Slack / Teams sends that failed or are still retrying.","operationId":"delivery_failures_api_v1_compiler_notification_groups_failures_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/start-calls":{"post":{"tags":["compiler"],"summary":"Start Calls","description":"Batch-schedule calls for eligible patients linked to this agent.\n\nCreates scheduled_calls + task_queue rows. The scheduler worker\npicks up pending calls and dispatches place_call tasks.","operationId":"start_calls_api_v1_compiler_agents__agent_id__start_calls_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartCallsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/calls":{"get":{"tags":["compiler"],"summary":"Get Agent Calls","description":"List call records for an agent.","operationId":"get_agent_calls_api_v1_compiler_agents__agent_id__calls_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/calls/scheduled":{"get":{"tags":["compiler"],"summary":"Get Scheduled Calls","description":"List scheduled calls for an agent (pending, queued, dialing).","operationId":"get_scheduled_calls_api_v1_compiler_agents__agent_id__calls_scheduled_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"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"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/calls/{call_id}/cancel":{"post":{"tags":["compiler"],"summary":"Cancel Call","description":"Cancel a pending, queued, or dialing scheduled call.\n\nDialing cancel stops further outreach tracking; it does not hang up Vapi mid-call.","operationId":"cancel_call_api_v1_compiler_calls__call_id__cancel_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/calls/{call_id}/reschedule":{"post":{"tags":["compiler"],"summary":"Reschedule Call","description":"Reschedule a pending or queued call to a new time.","operationId":"reschedule_call_api_v1_compiler_calls__call_id__reschedule_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RescheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/calls/{call_id}/retry":{"post":{"tags":["compiler"],"summary":"Retry Call","description":"Retry a failed scheduled call. Resets to pending with run_at=NOW().","operationId":"retry_call_api_v1_compiler_calls__call_id__retry_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/analytics":{"get":{"tags":["compiler"],"summary":"Get Call Analytics","description":"Aggregate call stats for an agent.","operationId":"get_call_analytics_api_v1_compiler_agents__agent_id__analytics_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/needs-a-call":{"get":{"tags":["compiler"],"summary":"List Needs A Call","description":"Patients who need a call but have no time booked (Upcoming Calls page).","operationId":"list_needs_a_call_api_v1_compiler_needs_a_call_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/scheduled-calls":{"get":{"tags":["compiler"],"summary":"List Scheduled Calls","description":"List scheduled calls across all agents for the org (dashboard view).","operationId":"list_scheduled_calls_api_v1_compiler_scheduled_calls_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"pending,queued","title":"Status"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}},{"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"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/campaign-timeline":{"get":{"tags":["compiler"],"summary":"Campaign Timeline","description":"List scheduled touches across all campaigns, grouped by date.","operationId":"campaign_timeline_api_v1_compiler_campaign_timeline_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"pending","title":"Status"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/calls/{call_id}/audio":{"get":{"tags":["compiler"],"summary":"Call Recording Audio","description":"One call's audio, streamed through this API to a logged-in user.\n\nNo link to the recording ever leaves the server: the browser fetches these\nbytes with its own login and plays them from memory, so there is nothing a\nperson could copy out and open elsewhere. The row holds an object key,\nnever a URL.\n\nOrg isolation, in order: the org comes from the caller's login (membership\nis checked in get_request_context); the call is looked up in that org's own\ndatabase; and the bucket on the row must be this org's bucket, which is\nworked out from the org itself. Only then is S3 read. Every read is\naudited: it is access to a patient's recorded conversation.\n\n404 rather than 403 for a call with no recording: whether a particular\npatient's call was recorded is itself something not worth confirming to a\ncaller who should not be asking.\n\nA plain ``def`` so FastAPI runs the blocking S3 calls in its threadpool.","operationId":"call_recording_audio_api_v1_compiler_calls__call_id__audio_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}},{"name":"part","in":"query","required":false,"schema":{"type":"string","default":"call","title":"Part"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/appointments":{"get":{"tags":["compiler"],"summary":"List Appointments","description":"List appointments for an agent's study.","operationId":"list_appointments_api_v1_compiler_agents__agent_id__appointments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["compiler"],"summary":"Create Appointment","description":"Manually create an appointment (coordinator action).","operationId":"create_appointment_api_v1_compiler_agents__agent_id__appointments_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAppointmentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/appointments/{appointment_id}":{"delete":{"tags":["compiler"],"summary":"Cancel Appointment","description":"Cancel an appointment.","operationId":"cancel_appointment_api_v1_compiler_appointments__appointment_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"appointment_id","in":"path","required":true,"schema":{"type":"string","title":"Appointment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/slots":{"get":{"tags":["compiler"],"summary":"Get Available Slots","description":"Get available appointment slots for an agent's study sites.","operationId":"get_available_slots_api_v1_compiler_agents__agent_id__slots_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"site","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Site"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date To"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/site-schedules":{"get":{"tags":["compiler"],"summary":"List Site Schedules","description":"List configured slot templates for an agent's study.","operationId":"list_site_schedules_api_v1_compiler_agents__agent_id__site_schedules_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["compiler"],"summary":"Create Site Schedule","description":"Add a single slot template.","operationId":"create_site_schedule_api_v1_compiler_agents__agent_id__site_schedules_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSlotRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/agents/{agent_id}/site-schedules/bulk":{"post":{"tags":["compiler"],"summary":"Bulk Create Site Schedules","description":"Bulk create slot templates (e.g. Mon-Fri 9am-5pm hourly).","operationId":"bulk_create_site_schedules_api_v1_compiler_agents__agent_id__site_schedules_bulk_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkCreateSlotsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/site-schedules/{schedule_id}":{"delete":{"tags":["compiler"],"summary":"Delete Site Schedule","description":"Deactivate a slot template.","operationId":"delete_site_schedule_api_v1_compiler_site_schedules__schedule_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"schedule_id","in":"path","required":true,"schema":{"type":"string","title":"Schedule Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compiler/health":{"get":{"tags":["compiler"],"summary":"Compiler Health","description":"Check if vera-compiler service is running.","operationId":"compiler_health_api_v1_compiler_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/integrations/vapi":{"get":{"tags":["integrations"],"summary":"Get Vapi Credentials","description":"Get Vapi config (key masked).","operationId":"get_vapi_credentials_api_v1_integrations_vapi_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["integrations"],"summary":"Store Vapi Credentials","description":"Store encrypted Vapi API key for this client.","operationId":"store_vapi_credentials_api_v1_integrations_vapi_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VapiCredentialRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]},"patch":{"tags":["integrations"],"summary":"Rotate Vapi Credentials","description":"Rotate Vapi API key.","operationId":"rotate_vapi_credentials_api_v1_integrations_vapi_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VapiCredentialRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/integrations/crio":{"get":{"tags":["integrations"],"summary":"Get Crio Status","description":"Get CRIO connection status for this org (masked token).","operationId":"get_crio_status_api_v1_integrations_crio_get","security":[{"HTTPBearer":[]}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["integrations"],"summary":"Connect Crio","description":"Connect org to CRIO — validates credentials, then encrypts and stores them in\nthe org's own client DB.","operationId":"connect_crio_api_v1_integrations_crio_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrioCredentialRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["integrations"],"summary":"Rotate Crio Token","description":"Rotate CRIO bearer token — validates the new credentials first.","operationId":"rotate_crio_token_api_v1_integrations_crio_patch","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrioCredentialRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["integrations"],"summary":"Disconnect Crio","description":"Disconnect CRIO — sets is_active=false (keeps the row for re-enable).\n\n``remove=true`` deletes the connection itself (token, client ID, webhook secret),\nactive or not (#1138). Studies, sites, patients and appointments are untouched;\nconnecting again starts a fresh row.","operationId":"disconnect_crio_api_v1_integrations_crio_delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"remove","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Remove"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/crio/sites":{"get":{"tags":["integrations"],"summary":"List Crio Sites","description":"The org's CRIO sites (#1142): every site its token can see, with what the\nadmin chose for each (checked, timezone).","operationId":"list_crio_sites_api_v1_integrations_crio_sites_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/integrations/crio/sites/{site_id}":{"patch":{"tags":["integrations"],"summary":"Update Crio Site","description":"Check / uncheck a site, or set its timezone. Org admins only. Unchecked means\nno new activity at that site; history stays.","operationId":"update_crio_site_api_v1_integrations_crio_sites__site_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrioSiteUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations":{"get":{"tags":["organizations"],"summary":"List Organizations","description":"List organizations the current user belongs to.","operationId":"list_organizations_api_v1_organizations_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/organizations/{org_id}":{"get":{"tags":["organizations"],"summary":"Get Organization","description":"Get organization detail with members.","operationId":"get_organization_api_v1_organizations__org_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["organizations"],"summary":"Update Organization","description":"Update organization details (name, slug, domain).","operationId":"update_organization_api_v1_organizations__org_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__modules__organizations__UpdateOrgRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{org_id}/invite":{"post":{"tags":["organizations"],"summary":"Invite Member","description":"Invite a user to the organization. Creates user if needed.","operationId":"invite_member_api_v1_organizations__org_id__invite_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/organizations/{org_id}/members/{user_id}":{"delete":{"tags":["organizations"],"summary":"Remove Member","description":"Remove a member from the organization.","operationId":"remove_member_api_v1_organizations__org_id__members__user_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reports/campaign-reports":{"get":{"tags":["reports"],"summary":"List Campaign Reports","description":"List shared campaign reports for the current user's org.","operationId":"list_campaign_reports_api_v1_reports_campaign_reports_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/reports/campaign-reports/{report_id}":{"get":{"tags":["reports"],"summary":"Get Campaign Report","description":"Get a single campaign report. Must be shared (or user is super admin).","operationId":"get_campaign_report_api_v1_reports_campaign_reports__report_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reports/interactions":{"get":{"tags":["reports"],"summary":"Interaction Log","description":"List all interactions with patient names, filterable.","operationId":"interaction_log_api_v1_reports_interactions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"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/v1/reports/interaction-stats":{"get":{"tags":["reports"],"summary":"Interaction Stats","description":"Server-side aggregation of interaction outcomes and channels.\n\nUnlike the interactions list (which loads 50-100 rows for a table),\nthis counts ALL interactions for accurate distribution charts.","operationId":"interaction_stats_api_v1_reports_interaction_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reports/call-stats":{"get":{"tags":["reports"],"summary":"Call Stats","description":"Call dashboard stats: funnel, calls by hour, inbound callers.\n\nReuses the same SQL patterns as campaign_reports.py but scoped by\nstudy (not cadence), so it works as a live dashboard.","operationId":"call_stats_api_v1_reports_call_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/reports/channel-funnel":{"get":{"tags":["reports"],"summary":"Channel Funnel","description":"Where the qualified patients actually came from.\n\nThe analytics page reports \"Eligible: N\" without saying which channel\nproduced them, so the one question worth asking of a campaign — is it the\ncalls or the texts that work — could only be answered by hand.\n\nA patient is attributed to the channel of the interaction that QUALIFIED\nthem, not the first or last time they were touched. Nearly everyone here is\ncalled before they are texted, so first-touch would credit voice for every\nconversion and last-touch would credit whichever channel happened to run\nmost recently.\n\nA plain `def`: every query below is blocking psycopg, and an `async def`\nruns those on the event loop.","operationId":"channel_funnel_api_v1_reports_channel_funnel_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/study-templates":{"get":{"tags":["templates"],"summary":"List Templates","description":"List active study templates available to all orgs.","operationId":"list_templates_api_v1_study_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/test-center/{study_id}/browser-call-log":{"post":{"tags":["test-center"],"summary":"Log Browser Call","description":"Persist a browser test call's transcript as an is_test interaction.","operationId":"log_browser_call_api_v1_test_center__study_id__browser_call_log_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrowserCallLog"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/test-center/{study_id}/activity":{"get":{"tags":["test-center"],"summary":"Get Test Activity","description":"Everything the Test tab produced for this study, newest first.","operationId":"get_test_activity_api_v1_test_center__study_id__activity_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":25,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/test-center/{study_id}/pronunciation-flags":{"get":{"tags":["test-center"],"summary":"List Pronunciation Flags","description":"Open mispronunciation candidates for a study, worst-first. ``resolved``\nmeans a pronunciation row for the term already exists in the study config —\nkept in the list so the admin sees the fix registered.","operationId":"list_pronunciation_flags_api_v1_test_center__study_id__pronunciation_flags_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/test-center/{study_id}/interactions/{interaction_id}/transcript":{"get":{"tags":["test-center"],"summary":"Get Interaction Transcript","description":"Full transcript of one call — the evidence view for a pronunciation\nflag ('where did this come from?').","operationId":"get_interaction_transcript_api_v1_test_center__study_id__interactions__interaction_id__transcript_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"interaction_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Interaction Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/test-center/{study_id}/pronunciation-flags/{flag_id}/dismiss":{"post":{"tags":["test-center"],"summary":"Dismiss Pronunciation Flag","description":"Hide a flag the admin judged fine (false positive). A future detection\nof the same term un-dismisses it (see the upsert).","operationId":"dismiss_pronunciation_flag_api_v1_test_center__study_id__pronunciation_flags__flag_id__dismiss_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"flag_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Flag Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/handoff-check":{"get":{"tags":["handoff-check"],"summary":"Handoff Check","description":"What patients hear on a transfer, per deployed agent, and how the org's\nrecent transfers went.","operationId":"handoff_check_api_v1_handoff_check_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":180,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/handoff-check/readiness":{"get":{"tags":["handoff-check"],"summary":"Handoff Readiness","description":"The readiness checks for one study's agents, for the study page. Skips\nthe org-wide transfer statistics that only /handoff-check shows.","operationId":"handoff_readiness_api_v1_handoff_check_readiness_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/vapi":{"post":{"tags":["webhooks"],"summary":"Vapi Webhook","description":"Receive Vapi webhook events (end-of-call-report, status updates).\n\nNo user auth — webhooks come from Vapi. Every request must carry an\n``x-intera-token`` we signed (#881, #952, kernel/vapi_secret.py), and each handler\nchecks it names the org the request is about: the number's owner for\nassistant-request, the call's org for end-of-call. Without one: 401 (the\nassistant-request gets the spoken refusal instead, as the caller is waiting).","operationId":"vapi_webhook_api_v1_webhooks_vapi_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/tools/available":{"get":{"tags":["tools"],"summary":"List Available Tools","description":"List active tool definitions for the current org. Read-only for client users.","operationId":"list_available_tools_api_v1_tools_available_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tools/":{"post":{"tags":["tools"],"summary":"Handle Tool Calls","description":"Receive and dispatch Vapi tool calls.\n\nThe patient is mid-sentence while this runs, so the shape matters as much as\nthe result: read the body on the loop, do the blocking work in a thread, and\nkeep audit writes off the response path entirely.\n\nBoth were wrong here. The handlers below are synchronous psycopg calls and\nthis endpoint was `async def`, so every tool call ran ON the event loop and\nblocked every other request the process was serving. A campaign batch dials\ntwenty patients at once; their tool calls queued behind each other.\ncheck_handoff_availability, whose database work is ~250ms, was measured at\n3.5s alone and 17.6s inside the 09:35 batch on the PCCRS SLE campaign.\n\nThen each call wrote two audit rows — tool_audit_log and the agent action —\nand committed both BEFORE returning, so observability the patient does not\nbenefit from sat directly in the silence they were listening to.","operationId":"handle_tool_calls_api_v1_tools__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/schedule/{token}":{"get":{"tags":["schedule"],"summary":"Get Scheduling Form","description":"Public endpoint: return booking form data for a scheduling token.\n\nNo auth required — token itself is the credential.","operationId":"get_scheduling_form_api_v1_schedule__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["schedule"],"summary":"Submit Booking","description":"Public endpoint: submit appointment booking via scheduling token.\n\nCreates appointment in the patient's org database.\nMarks token as used.","operationId":"submit_booking_api_v1_schedule__token__post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/escalations":{"get":{"tags":["escalations"],"summary":"List Escalations","description":"List all escalations across studies with patient and study info.","operationId":"list_escalations_api_v1_escalations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated: requested,acknowledged,resolved","title":"Status"},"description":"Comma-separated: requested,acknowledged,resolved"},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"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/v1/contact-list":{"get":{"tags":["contact-list"],"summary":"Get Contact List","description":"Patients + studies to contact: their listed stage / tags (reason, quote,\nsource, when, newest first), and the last Contacted (when, who, note).\nNot-contacted rows first, then newest.","operationId":"get_contact_list_api_v1_contact_list_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"key","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"stage:<key> or tag:<key>","title":"Key"},"description":"stage:<key> or tag:<key>"},{"name":"within","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(7d|30d|custom)$"},{"type":"null"}],"title":"Within"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Since"}},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Until"}},{"name":"show","in":"query","required":false,"schema":{"type":"string","pattern":"^(to_contact|contacted|all)$","default":"to_contact","title":"Show"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"assigned","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"me, none, or a team member's id","title":"Assigned"},"description":"me, none, or a team member's id"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/contact-list/count":{"get":{"tags":["contact-list"],"summary":"Count To Contact","description":"How many patients + studies are waiting to be contacted (the sidebar badge).","operationId":"count_to_contact_api_v1_contact_list_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/assistant/apply":{"post":{"tags":["assistant"],"summary":"Apply Change","description":"Make a change the assistant prepared, on the coordinator's click (changes.py): the\nsealed proposal, re-checked against the setting now, through the same endpoint the\nsettings screen uses, as the coordinator.","operationId":"apply_change_api_v1_assistant_apply_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__modules__assistant__ApplyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/assistant/apply-files":{"post":{"tags":["assistant"],"summary":"Apply Change With Files","description":"Apply for a card that uses attached files (files.py): the same check and Apply, with\nthe files themselves. Only the exact files the card previewed (by sha256) go through.","operationId":"apply_change_with_files_api_v1_assistant_apply_files_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_apply_change_with_files_api_v1_assistant_apply_files_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/assistant/files/read":{"post":{"tags":["assistant"],"summary":"Read File","description":"A document attached in the panel, read as an uploaded protocol is read: its text\ngoes back to the panel, and nothing is stored (files.py).","operationId":"read_file_api_v1_assistant_files_read_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_read_file_api_v1_assistant_files_read_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/assistant/chats":{"get":{"tags":["assistant"],"summary":"List Chats","description":"Your saved chats with Pip, newest first; ``everyone`` (admins): the team's.","operationId":"list_chats_api_v1_assistant_chats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"everyone","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Everyone"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/assistant/chats/{chat_id}":{"get":{"tags":["assistant"],"summary":"Read Chat","operationId":"read_chat_api_v1_assistant_chats__chat_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"chat_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Chat Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/assistant/changes":{"get":{"tags":["assistant"],"summary":"List Changes","description":"Changes made through Pip in the last 30 days, and whether Undo is offered.","operationId":"list_changes_api_v1_assistant_changes_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/assistant/changes/{change_id}/undo":{"post":{"tags":["assistant"],"summary":"Undo Change","operationId":"undo_change_api_v1_assistant_changes__change_id__undo_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"change_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Change Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/assistant/dropoff/{study_id}":{"get":{"tags":["assistant"],"summary":"Dropoff Graph","description":"The Drop-off page: where a study's patients leave the conversation with Vera and the\nreasons they give, as a flow with every patient in it (dropoff.build). Conversations\nalready sorted come from ctms.conversation_dropoff; new ones are sorted and saved.","operationId":"dropoff_graph_api_v1_assistant_dropoff__study_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":7,"default":90,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/assistant/dropoff/{study_id}/flow":{"get":{"tags":["assistant"],"summary":"Dropoff Flow View","description":"The Drop-off page: how far each conversation got, about how far into the call, how it\nended and what Vera was saying when patients left (dropoff_flow.build_flow). The same\nconversations and saved reasons as the legacy view (GET /dropoff/{study_id}).","operationId":"dropoff_flow_view_api_v1_assistant_dropoff__study_id__flow_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":7,"default":90,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/assistant/dropoff/{study_id}/conversation":{"get":{"tags":["assistant"],"summary":"Dropoff Conversation","description":"The whole conversation a Drop-off reason came from: the audit trail behind a quote.\nOnly a conversation on this study; each view is in the audit log.","operationId":"dropoff_conversation_api_v1_assistant_dropoff__study_id__conversation_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}},{"name":"key","in":"query","required":true,"schema":{"type":"string","maxLength":200,"title":"Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/assistant/chat":{"post":{"tags":["assistant"],"summary":"Chat","operationId":"chat_api_v1_assistant_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/semper/suggestions":{"get":{"tags":["semper"],"summary":"List Suggestions","operationId":"list_suggestions_api_v1_semper_suggestions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Patient Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/suggestions/{fact_id}/confirm":{"post":{"tags":["semper"],"summary":"Confirm Suggestion","description":"Write it, as Semper would have, signed by this coordinator.","operationId":"confirm_suggestion_api_v1_semper_suggestions__fact_id__confirm_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"fact_id","in":"path","required":true,"schema":{"type":"integer","title":"Fact Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DecisionRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/suggestions/{fact_id}/dismiss":{"post":{"tags":["semper"],"summary":"Dismiss Suggestion","operationId":"dismiss_suggestion_api_v1_semper_suggestions__fact_id__dismiss_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"fact_id","in":"path","required":true,"schema":{"type":"integer","title":"Fact Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/DecisionRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/owed":{"get":{"tags":["semper"],"summary":"List Owed","description":"Open obligations and call-backs that closed unmet, overdue first (``ids``:\nexactly these, for To contact's rows), and how many there are in all.","operationId":"list_owed_api_v1_semper_owed_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Patient Id"}},{"name":"ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"title":"Ids"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/owed/{obligation_id}/done":{"post":{"tags":["semper"],"summary":"Owed Done","operationId":"owed_done_api_v1_semper_owed__obligation_id__done_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"obligation_id","in":"path","required":true,"schema":{"type":"integer","title":"Obligation Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/OwedAction"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/owed/{obligation_id}/snooze":{"post":{"tags":["semper"],"summary":"Owed Snooze","operationId":"owed_snooze_api_v1_semper_owed__obligation_id__snooze_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"obligation_id","in":"path","required":true,"schema":{"type":"integer","title":"Obligation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwedAction"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/owed/{obligation_id}/not-needed":{"post":{"tags":["semper"],"summary":"Owed Not Needed","operationId":"owed_not_needed_api_v1_semper_owed__obligation_id__not_needed_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"obligation_id","in":"path","required":true,"schema":{"type":"integer","title":"Obligation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwedAction"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/owed/{obligation_id}/study-options":{"get":{"tags":["semper"],"summary":"Unassigned Study Options","description":"The studies a coordinator may move this Unassigned lead into.","operationId":"unassigned_study_options_api_v1_semper_owed__obligation_id__study_options_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"obligation_id","in":"path","required":true,"schema":{"type":"integer","title":"Obligation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/owed/{obligation_id}/assign":{"post":{"tags":["semper"],"summary":"Assign Unassigned Lead","description":"Approve Vera's suggestion, or pick another study: the lead moves there and gets\nthat study's partner default routing (an approved campaign, else its queue).","operationId":"assign_unassigned_lead_api_v1_semper_owed__obligation_id__assign_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"obligation_id","in":"path","required":true,"schema":{"type":"integer","title":"Obligation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignStudyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/owed/{obligation_id}/no-study-fits":{"post":{"tags":["semper"],"summary":"Unassigned No Study Fits","description":"No study fits: the lead stays stored in Unassigned leads; nobody contacts it.","operationId":"unassigned_no_study_fits_api_v1_semper_owed__obligation_id__no_study_fits_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"obligation_id","in":"path","required":true,"schema":{"type":"integer","title":"Obligation Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NoStudyRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/patients/{patient_id}/next-step":{"post":{"tags":["semper"],"summary":"Pick Next Step","description":"What happens after a no-show (or a cancel): the agent re-books, a person\nfollows up, or stop.","operationId":"pick_next_step_api_v1_semper_patients__patient_id__next_step_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NextStepRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/patients/{patient_id}/facts":{"get":{"tags":["semper"],"summary":"Patient Facts","description":"What Semper read about the patient, with its quotes (the facts panel).","operationId":"patient_facts_api_v1_semper_patients__patient_id__facts_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Patient Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/semper/owed-kinds":{"get":{"tags":["semper"],"summary":"Owed Kinds","description":"What we can owe a patient, with its label: the To contact filter.","operationId":"owed_kinds_api_v1_semper_owed_kinds_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/studies/{study_id}/cadences":{"get":{"tags":["cadence"],"summary":"List Cadences","operationId":"list_cadences_api_v1_studies__study_id__cadences_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/cadences/propose":{"post":{"tags":["cadence"],"summary":"Propose Cadence","description":"Draft a cadence + audience snapshot. Contacts NOTHING until approved.","operationId":"propose_cadence_api_v1_studies__study_id__cadences_propose_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/cadences/propose-channel-test":{"post":{"tags":["cadence"],"summary":"Propose Channel Test","description":"Draft a call-first vs text-first test: two campaigns, one audience (#826).\n\nEach patient lands in exactly one arm when the test is approved; approving\neither draft approves both. Contacts nobody until then.","operationId":"propose_channel_test_api_v1_studies__study_id__cadences_propose_channel_test_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelTestRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/channel-test":{"get":{"tags":["cadence"],"summary":"Channel Test Results","description":"Both arms side by side, or {\"experiment_id\": null} for an ordinary campaign.","operationId":"channel_test_results_api_v1_cadences__cadence_id__channel_test_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}":{"patch":{"tags":["cadence"],"summary":"Update Cadence","description":"Edit a PROPOSED cadence: plan steps, name, and who's included.\n\nAudience is recomputed live so the review list always matches what\napproval would enroll. Armed cadences are immutable — pause/cancel and\ndraft a new one instead.","operationId":"update_cadence_api_v1_cadences__cadence_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["cadence"],"summary":"Get Cadence","operationId":"get_cadence_api_v1_cadences__cadence_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["cadence"],"summary":"Delete Cadence","description":"Delete a draft outright.\n\nCancelling is right for a campaign that already contacted someone — the record\nis the audit trail. A draft has contacted nobody, so cancelling it leaves a\nghost in the finished list that the coordinator has to read past forever.\nDiscarding a draft should discard it.","operationId":"delete_cadence_api_v1_cadences__cadence_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/spec":{"patch":{"tags":["cadence"],"summary":"Patch Cadence Spec","description":"Hot-patch policies and step messages on an armed or paused campaign.\n\nStructural changes (adding/removing steps, changing channels or timing)\nare rejected — they would break step_index semantics for in-flight\nenrollments. Safe changes take effect on the next scheduler tick.","operationId":"patch_cadence_spec_api_v1_cadences__cadence_id__spec_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpecPatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/add-patients":{"post":{"tags":["cadence"],"summary":"Add Patients To Campaign","description":"Directly add specific patients or a whole source to a running campaign.\n\nCompliance checks still apply — DNC, no phone, declined, ineligible\npatients are excluded. Already-enrolled patients are silently skipped\nvia ON CONFLICT DO NOTHING.","operationId":"add_patients_to_campaign_api_v1_cadences__cadence_id__add_patients_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddPatientsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/refresh-audience":{"post":{"tags":["cadence"],"summary":"Refresh Audience","description":"Re-run audience filters and enroll newly-eligible patients.\n\nExisting enrollments are untouched (ON CONFLICT DO NOTHING). New patients\nrespect start_per_day drip rate, staggered relative to each other. The\ncampaign's stored audience snapshot is NOT overwritten — it is the\nhistorical record of who was included at approval time.","operationId":"refresh_audience_api_v1_cadences__cadence_id__refresh_audience_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshAudienceRequest","default":{}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/approve/check":{"post":{"tags":["cadence"],"summary":"Approve Check","description":"Would Start succeed? Runs the refusals approve gives, changes nothing (#1216).","operationId":"approve_check_api_v1_cadences__cadence_id__approve_check_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/approve":{"post":{"tags":["cadence"],"summary":"Approve Cadence","description":"The authorization gate: enroll the audience and schedule every touch.","operationId":"approve_cadence_api_v1_cadences__cadence_id__approve_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/studies/{study_id}/reminders":{"get":{"tags":["cadence"],"summary":"Get Reminder Settings","description":"Appointment-reminder settings (a per-study singleton reminder cadence).","operationId":"get_reminder_settings_api_v1_studies__study_id__reminders_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["cadence"],"summary":"Update Reminder Settings","description":"Enable/disable appointment reminders and edit the message/timing.","operationId":"update_reminder_settings_api_v1_studies__study_id__reminders_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderSettings"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/results":{"get":{"tags":["cadence"],"summary":"Cadence Results","description":"Everything a coordinator needs to answer 'what happened?'","operationId":"cadence_results_api_v1_cadences__cadence_id__results_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/analyze":{"post":{"tags":["cadence"],"summary":"Analyze Campaign","description":"AI-powered campaign analysis — what's working, who's unresponsive,\nwhat to do next.","operationId":"analyze_campaign_api_v1_cadences__cadence_id__analyze_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/spin-off/preview":{"post":{"tags":["cadence"],"summary":"Spinoff Preview","description":"Preview which patients match the spin-off filters without creating anything.","operationId":"spinoff_preview_api_v1_cadences__cadence_id__spin_off_preview_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpinOffRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/spin-off":{"post":{"tags":["cadence"],"summary":"Spinoff Campaign","description":"Create a new draft campaign from the unresponsive patients of an existing one.","operationId":"spinoff_campaign_api_v1_cadences__cadence_id__spin_off_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpinOffRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/pause":{"post":{"tags":["cadence"],"summary":"Pause Cadence","operationId":"pause_cadence_api_v1_cadences__cadence_id__pause_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/resume":{"post":{"tags":["cadence"],"summary":"Resume Cadence","operationId":"resume_cadence_api_v1_cadences__cadence_id__resume_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/refresh/preview":{"post":{"tags":["cadence"],"summary":"Refresh Preview","description":"What Refresh schedule would do (#1107): per patient, what was sent and the next\ntouch before and after. Writes nothing.","operationId":"refresh_preview_api_v1_cadences__cadence_id__refresh_preview_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/refresh":{"post":{"tags":["cadence"],"summary":"Refresh Schedule","description":"Re-plan enrolled patients under the campaign's current settings (#1107):\nservices/cadence.refresh_campaign.","operationId":"refresh_schedule_api_v1_cadences__cadence_id__refresh_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/cancel":{"post":{"tags":["cadence"],"summary":"Cancel Cadence","operationId":"cancel_cadence_api_v1_cadences__cadence_id__cancel_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/enrollments/{enrollment_id}/pause":{"post":{"tags":["cadence"],"summary":"Pause Enrollment","description":"Coordinator manually pauses one enrollment. No auto-resume — stays paused until explicitly resumed or stopped.","operationId":"pause_enrollment_api_v1_cadences__cadence_id__enrollments__enrollment_id__pause_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}},{"name":"enrollment_id","in":"path","required":true,"schema":{"type":"string","title":"Enrollment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/enrollments/{enrollment_id}/resume":{"post":{"tags":["cadence"],"summary":"Resume Enrollment","description":"Resume a paused enrollment (reply-pause or coordinator-pause).","operationId":"resume_enrollment_api_v1_cadences__cadence_id__enrollments__enrollment_id__resume_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}},{"name":"enrollment_id","in":"path","required":true,"schema":{"type":"string","title":"Enrollment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/enrollments/{enrollment_id}/stop":{"post":{"tags":["cadence"],"summary":"Stop Enrollment","description":"Take one patient out of the cadence entirely.","operationId":"stop_enrollment_api_v1_cadences__cadence_id__enrollments__enrollment_id__stop_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}},{"name":"enrollment_id","in":"path","required":true,"schema":{"type":"string","title":"Enrollment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/enrollments/{enrollment_id}/handled":{"post":{"tags":["cadence"],"summary":"Mark Enrollment Handled","description":"Coordinator acknowledges a handoff — patient is now in human care.","operationId":"mark_enrollment_handled_api_v1_cadences__cadence_id__enrollments__enrollment_id__handled_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}},{"name":"enrollment_id","in":"path","required":true,"schema":{"type":"string","title":"Enrollment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/enrollments/{enrollment_id}/reenroll":{"post":{"tags":["cadence"],"summary":"Reenroll Patient","description":"Re-enroll a patient from a terminal enrollment back into the same campaign.\n\nCreates a new enrollment starting from step 0. The old enrollment is\npreserved for audit. Campaign must be armed and the patient must not\nalready have an active enrollment in this campaign.","operationId":"reenroll_patient_api_v1_cadences__cadence_id__enrollments__enrollment_id__reenroll_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}},{"name":"enrollment_id","in":"path","required":true,"schema":{"type":"string","title":"Enrollment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/{cadence_id}/plan-preview":{"post":{"tags":["cadence"],"summary":"Preview Campaign Plan","description":"When a patient enrolled now would be contacted, step by step, with what falls\noutside contact hours (the editor confirms those with the coordinator) or outside\nTCPA. Writes nothing.","operationId":"preview_campaign_plan_api_v1_cadences__cadence_id__plan_preview_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanPreviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/cadences/daily-cap":{"post":{"tags":["cadence"],"summary":"Daily Cap Preview","description":"Calls a day for these campaign settings (#1223): the campaign's own \"Most calls\nper day\", else what its lines can dial (lines × call hours ÷ typical call × 0.8).\nFor the editors' hint. Writes nothing.","operationId":"daily_cap_preview_api_v1_cadences_daily_cap_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyCapIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/cadences/{cadence_id}/load-preview":{"post":{"tags":["cadence"],"summary":"Load Preview Endpoint","description":"Calls per day (#1223): new starts, first calls, follow-ups and other dials per\ndate, against the cap and what the lines can dial; the peak day and the last start.\nA draft shows the placement approving it now would make. Writes nothing. A plain\n``def``: a large draft's simulated placement runs in the threadpool, not the loop.","operationId":"load_preview_endpoint_api_v1_cadences__cadence_id__load_preview_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/LoadPreviewIn"},{"type":"null"}],"title":"Req"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sms/sim":{"post":{"tags":["sms"],"summary":"Sms Simulator","description":"Run one SMS turn in the browser (no Twilio; transcript persists as test data).\n\nThe same turn as a real thread (#957: ``SmsAgent``), on a \"sim:\" thread that is\nsaved as test data and never sent: the same prompt, tools, link rules and\nsend-guard, so a red team that passes here passes on the line.","operationId":"sms_simulator_api_v1_sms_sim_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/sms/agent-name":{"get":{"tags":["sms"],"summary":"Sms Agent Name","description":"The name this study's texts go out as (#968): the SMS setting, else the Agent\nName its newest deployed agent was deployed with. What the dashboard labels the\nAI's texts with.","operationId":"sms_agent_name_api_v1_sms_agent_name_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sms/send-test":{"post":{"tags":["sms"],"summary":"Send Test Sms","description":"Send the study's SMS opener to a phone number + auto-configure webhook.","operationId":"send_test_sms_api_v1_sms_send_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendTestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/sms/threads":{"get":{"tags":["sms"],"summary":"List Sms Threads","description":"List SMS conversations grouped by phone number.\n\nOptional cadence_id narrows to threads that campaign touched.","operationId":"list_sms_threads_api_v1_sms_threads_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"study_id","in":"query","required":true,"schema":{"type":"string","title":"Study Id"}},{"name":"cadence_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cadence Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sms/threads/{phone}":{"get":{"tags":["sms"],"summary":"Get Sms Thread","description":"Get full SMS thread for a phone number.","operationId":"get_sms_thread_api_v1_sms_threads__phone__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone","in":"path","required":true,"schema":{"type":"string","title":"Phone"}},{"name":"study_id","in":"query","required":true,"schema":{"type":"string","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sms/outreach":{"post":{"tags":["sms"],"summary":"Sms Outreach","description":"Send SMS opener to all eligible patients (or specific IDs).","operationId":"sms_outreach_api_v1_sms_outreach_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutreachRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/twilio/sms":{"post":{"tags":["twilio"],"summary":"Twilio Inbound Sms Webhook","description":"The Twilio route: ``twilio_inbound_sms``, then the early drain.\n\nOpt-outs / opt-ins queued while this line's org couldn't be told are drained\nonly after this text has been handled and stored (#921 review): a START sent\nnow must be in the DB before a queued STOP is weighed against it.","operationId":"twilio_inbound_sms_webhook_twilio_sms_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_twilio_inbound_sms_webhook_twilio_sms_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/organizations":{"get":{"tags":["admin"],"summary":"List Organizations","description":"List all organizations with member counts and DB status.","operationId":"list_organizations_api_v1_admin_organizations_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["admin"],"summary":"Create Organization","description":"Create a new organization and trigger background DB provisioning.","operationId":"create_organization_api_v1_admin_organizations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrgRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/organizations/{org_id}/members":{"post":{"tags":["admin"],"summary":"Add Member","description":"Add a user to an organization. Seeds into client DB if active.","operationId":"add_member_api_v1_admin_organizations__org_id__members_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMemberRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/organizations/{org_id}":{"patch":{"tags":["admin"],"summary":"Update Organization","description":"Update organization settings. Currently supports max_active_studies.","operationId":"update_organization_api_v1_admin_organizations__org_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/api__modules__admin__organizations__UpdateOrgRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Delete Organization","description":"Permanently delete an organization, its Supabase project, and all records.\n\nRequires typing the org slug to confirm (like GitHub repo deletion).\nCleans up: memberships, client_databases, agent_registry, org record.","operationId":"delete_organization_api_v1_admin_organizations__org_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteOrgRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/organizations/{org_id}/crio/rotate-token":{"post":{"tags":["admin"],"summary":"Rotate Crio Token","description":"Rotate an org's CRIO bearer token. Validates the new token before storing.\n\n1. Checks the region is one the org may use (sandbox: internal orgs only)\n2. Tests the credentials against CRIO (GET /api/v1/sites)\n3. Encrypts and stores them in THAT org's own client DB (#881), re-enabling\n   the connection and resetting token_issued_at","operationId":"rotate_crio_token_api_v1_admin_organizations__org_id__crio_rotate_token_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateCrioTokenRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/users":{"get":{"tags":["admin"],"summary":"List Users","description":"List all platform users with org membership info.","operationId":"list_users_api_v1_admin_users_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search by name or email","title":"Search"},"description":"Search by name or email"},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter: pending or active","title":"Status"},"description":"Filter: pending or active"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/provision":{"post":{"tags":["admin"],"summary":"Provision Client Db Endpoint","description":"Create a new client database via Supabase Management API.","operationId":"provision_client_db_endpoint_api_v1_admin_provision_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/clients":{"get":{"tags":["admin"],"summary":"List Clients","description":"List all client databases and their status.","operationId":"list_clients_api_v1_admin_clients_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/clients/{org_id}/pause":{"post":{"tags":["admin"],"summary":"Pause Client","description":"Pause a client's Supabase project.","operationId":"pause_client_api_v1_admin_clients__org_id__pause_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/clients/{org_id}/restore":{"post":{"tags":["admin"],"summary":"Restore Client","description":"Restore a paused client's Supabase project.","operationId":"restore_client_api_v1_admin_clients__org_id__restore_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/clients/{org_id}/reprovision":{"post":{"tags":["admin"],"summary":"Reprovision Client Db","description":"Drop all tables and re-apply schema to an existing client DB.\n\nDESTRUCTIVE — requires typing the org slug to confirm.\nUse when schema is corrupted or needs a full reset.","operationId":"reprovision_client_db_api_v1_admin_clients__org_id__reprovision_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReprovisionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/tools":{"post":{"tags":["admin"],"summary":"Provision Tool","description":"Provision a tool definition for a client org. Admin only.","operationId":"provision_tool_api_v1_admin_tools_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionToolRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["admin"],"summary":"List Tools For Org","description":"List all tool definitions for a client org. Admin only.","operationId":"list_tools_for_org_api_v1_admin_tools_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/tools/{tool_id}":{"delete":{"tags":["admin"],"summary":"Deactivate Tool","description":"Deactivate a tool definition. Admin only.","operationId":"deactivate_tool_api_v1_admin_tools__tool_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tool_id","in":"path","required":true,"schema":{"type":"string","title":"Tool Id"}},{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/tools/platform":{"get":{"tags":["admin"],"summary":"List Platform Tools","description":"Return the canonical list of platform-level (Tier 1) tool definitions.","operationId":"list_platform_tools_api_v1_admin_tools_platform_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/tools/audit":{"get":{"tags":["admin"],"summary":"List Tool Audit Log","description":"Return recent tool call audit entries for an org's client DB.","operationId":"list_tool_audit_log_api_v1_admin_tools_audit_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"tool_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/tools/audit/summary":{"get":{"tags":["admin"],"summary":"Tool Audit Summary","description":"Aggregate tool call counts by tool_name for the last 7 days.","operationId":"tool_audit_summary_api_v1_admin_tools_audit_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-numbers":{"get":{"tags":["admin"],"summary":"List Phone Numbers","description":"List active phone numbers with org assignment.","operationId":"list_phone_numbers_api_v1_admin_phone_numbers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["admin"],"summary":"Register Phone Number","description":"Register a Vapi phone number and assign to an org.","operationId":"register_phone_number_api_v1_admin_phone_numbers_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterPhoneRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/phone-numbers/{phone_id}":{"patch":{"tags":["admin"],"summary":"Assign Phone Number","description":"Assign a phone number to an org.\n\nAuto-sets is_primary if the org has no existing primary number.\n\nMoving a number to another org is refused while the old org still has it attached\nto an agent: the old org's client DB would keep routing inbound calls and dialing\nfrom a line it no longer owns. Detach it in the old org first (that clears Vapi\nrouting and the registry), then reassign. Retired numbers are re-registered, not\nreassigned; \"unassign\" is retiring.","operationId":"assign_phone_number_api_v1_admin_phone_numbers__phone_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Phone Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignPhoneRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Retire Phone Number","description":"Retire a phone number — soft delete + clean up client DB assignments + Vapi routing.","operationId":"retire_phone_number_api_v1_admin_phone_numbers__phone_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Phone Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-numbers/{phone_id}/label":{"patch":{"tags":["admin"],"summary":"Update Phone Label","description":"Update the display label for a phone number.","operationId":"update_phone_label_api_v1_admin_phone_numbers__phone_id__label_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Phone Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateLabelRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/audit":{"get":{"tags":["admin"],"summary":"List Audit Events","description":"Query audit events from CloudWatch Logs for an org.","operationId":"list_audit_events_api_v1_admin_audit_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"}},{"name":"actor_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Type"}},{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date YYYY-MM-DD","title":"Date From"},"description":"ISO date YYYY-MM-DD"},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date YYYY-MM-DD","title":"Date To"},"description":"ISO date YYYY-MM-DD"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/webhooks/crio/test":{"post":{"tags":["admin"],"summary":"Test Crio Webhook","description":"Dry-run a CRIO webhook payload — validate and parse without DB operations.\n\nReturns the parsed model fields and mapped status values so you can\nverify the payload shape before configuring the real webhook.","operationId":"test_crio_webhook_api_v1_admin_webhooks_crio_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrioTestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/daily-report/orgs":{"get":{"tags":["admin"],"summary":"List Report Orgs","description":"List organizations available for daily report selection.","operationId":"list_report_orgs_api_v1_admin_daily_report_orgs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/daily-report":{"get":{"tags":["admin"],"summary":"Get Daily Report","description":"Daily or weekly activity summary for a single org. Super admin only.","operationId":"get_daily_report_api_v1_admin_daily_report_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","description":"Organization ID","title":"Org Id"},"description":"Organization ID"},{"name":"date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Target date YYYY-MM-DD","title":"Date"},"description":"Target date YYYY-MM-DD"},{"name":"mode","in":"query","required":false,"schema":{"type":"string","description":"Report mode: daily or weekly","default":"daily","title":"Mode"},"description":"Report mode: daily or weekly"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/daily-report/{org_id}/details":{"get":{"tags":["admin"],"summary":"Get Org Report Details","description":"Patient-level activity detail for a specific org within a window.","operationId":"get_org_report_details_api_v1_admin_daily_report__org_id__details_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"window_start","in":"query","required":true,"schema":{"type":"string","description":"ISO timestamp","title":"Window Start"},"description":"ISO timestamp"},{"name":"window_end","in":"query","required":true,"schema":{"type":"string","description":"ISO timestamp","title":"Window End"},"description":"ISO timestamp"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/organizations/{org_id}/eod-config":{"put":{"tags":["admin"],"summary":"Update Eod Config","description":"Update EOD report time and timezone for an org.","operationId":"update_eod_config_api_v1_admin_organizations__org_id__eod_config_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EodConfigRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/slack-config":{"get":{"tags":["admin"],"summary":"List Slack Configs","description":"List all Slack notification configs (global + per-org).","operationId":"list_slack_configs_api_v1_admin_slack_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/slack-config/global":{"put":{"tags":["admin"],"summary":"Upsert Global Slack Config","description":"Create or update the global default Slack and/or Teams webhook.","operationId":"upsert_global_slack_config_api_v1_admin_slack_config_global_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertGlobalRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/slack-config/{org_id}":{"put":{"tags":["admin"],"summary":"Upsert Org Slack Config","description":"Create or update per-org Slack notification config.","operationId":"upsert_org_slack_config_api_v1_admin_slack_config__org_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertOrgRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Delete Org Slack Config","description":"Remove per-org Slack override (falls back to global default).","operationId":"delete_org_slack_config_api_v1_admin_slack_config__org_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/slack-config/test":{"post":{"tags":["admin"],"summary":"Test Slack Webhook","description":"Send a test message to a Slack or Teams webhook URL.","operationId":"test_slack_webhook_api_v1_admin_slack_config_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestWebhookRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/notify-failures":{"get":{"tags":["admin"],"summary":"Notify Failures Across Orgs","description":"Every org's email / Slack / Teams sends that failed in the last 7 days (#890):\ncounts and the latest error, no patient details.","operationId":"notify_failures_across_orgs_api_v1_admin_notify_failures_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/campaign-reports/orgs/{org_id}/studies":{"get":{"tags":["admin"],"summary":"List Studies","operationId":"list_studies_api_v1_admin_campaign_reports_orgs__org_id__studies_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/campaign-reports/orgs/{org_id}/studies/{study_id}/cadences":{"get":{"tags":["admin"],"summary":"List Cadences","operationId":"list_cadences_api_v1_admin_campaign_reports_orgs__org_id__studies__study_id__cadences_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/campaign-reports/orgs/{org_id}/cadences/{cadence_id}":{"get":{"tags":["admin"],"summary":"Get Report Data","operationId":"get_report_data_api_v1_admin_campaign_reports_orgs__org_id__cadences__cadence_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}},{"name":"study_id","in":"query","required":true,"schema":{"type":"string","title":"Study Id"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date, e.g. 2026-09-08","title":"Date From"},"description":"ISO date, e.g. 2026-09-08"},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date, e.g. 2026-09-25","title":"Date To"},"description":"ISO date, e.g. 2026-09-25"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/campaign-reports/orgs/{org_id}/cadences/{cadence_id}/generate":{"post":{"tags":["admin"],"summary":"Generate Report","operationId":"generate_report_api_v1_admin_campaign_reports_orgs__org_id__cadences__cadence_id__generate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"cadence_id","in":"path","required":true,"schema":{"type":"string","title":"Cadence Id"}},{"name":"study_id","in":"query","required":true,"schema":{"type":"string","title":"Study Id"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date To"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/campaign-reports/orgs/{org_id}/reports":{"get":{"tags":["admin"],"summary":"List Saved Reports","operationId":"list_saved_reports_api_v1_admin_campaign_reports_orgs__org_id__reports_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/campaign-reports/orgs/{org_id}/reports/{report_id}":{"patch":{"tags":["admin"],"summary":"Toggle Report Shared","operationId":"toggle_report_shared_api_v1_admin_campaign_reports_orgs__org_id__reports__report_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToggleSharedRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Delete Report","operationId":"delete_report_api_v1_admin_campaign_reports_orgs__org_id__reports__report_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections/orgs/{org_id}/options":{"get":{"tags":["admin"],"summary":"Get Inbound Connection Options","description":"Studies (+ CRIO link), campaigns (+ patient counts) and mapping fields for one org.","operationId":"get_inbound_connection_options_api_v1_admin_inbound_connections_orgs__org_id__options_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections":{"post":{"tags":["admin"],"summary":"Create Inbound Connection","description":"Create a token (starts paused). The response carries the token; it can be shown\nagain later with GET /{id}/token (audited).","operationId":"create_inbound_connection_api_v1_admin_inbound_connections_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConnectionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["admin"],"summary":"List Inbound Connections","operationId":"list_inbound_connections_api_v1_admin_inbound_connections_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections/{connection_id}":{"get":{"tags":["admin"],"summary":"Get Inbound Connection","operationId":"get_inbound_connection_api_v1_admin_inbound_connections__connection_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Update Inbound Connection","operationId":"update_inbound_connection_api_v1_admin_inbound_connections__connection_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateConnectionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections/{connection_id}/script":{"get":{"tags":["admin"],"summary":"Get Inbound Connection Script","description":"The generated Apps Script for this token's sheet (no secrets; download any time).","operationId":"get_inbound_connection_script_api_v1_admin_inbound_connections__connection_id__script_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections/{connection_id}/pause":{"post":{"tags":["admin"],"summary":"Pause Inbound Connection","operationId":"pause_inbound_connection_api_v1_admin_inbound_connections__connection_id__pause_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections/{connection_id}/activate":{"post":{"tags":["admin"],"summary":"Activate Inbound Connection","operationId":"activate_inbound_connection_api_v1_admin_inbound_connections__connection_id__activate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections/{connection_id}/rotate":{"post":{"tags":["admin"],"summary":"Rotate Inbound Connection","description":"New secret; the old token stops working immediately. The response carries it.","operationId":"rotate_inbound_connection_api_v1_admin_inbound_connections__connection_id__rotate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections/{connection_id}/token":{"get":{"tags":["admin"],"summary":"Get Inbound Connection Token","description":"The token, to copy into the sheet again. Super admins only; every view is audited.","operationId":"get_inbound_connection_token_api_v1_admin_inbound_connections__connection_id__token_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/inbound-connections/{connection_id}/revoke":{"post":{"tags":["admin"],"summary":"Revoke Inbound Connection","description":"Final. Requests with this token get 401; config and events are kept.","operationId":"revoke_inbound_connection_api_v1_admin_inbound_connections__connection_id__revoke_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/partner-connections/formats":{"get":{"tags":["admin"],"summary":"List Partner Formats","description":"Lead formats, for the create form. Sites are free text and never route.","operationId":"list_partner_formats_api_v1_admin_partner_connections_formats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/partner-connections":{"post":{"tags":["admin"],"summary":"Create Partner Connection Route","description":"Create (paused). The response carries the API key and signing secret: shown once.","operationId":"create_partner_connection_route_api_v1_admin_partner_connections_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePartnerConnectionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/partner-connections/{connection_id}":{"get":{"tags":["admin"],"summary":"Get Partner Connection Route","operationId":"get_partner_connection_route_api_v1_admin_partner_connections__connection_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Update Partner Connection Route","operationId":"update_partner_connection_route_api_v1_admin_partner_connections__connection_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePartnerConnectionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/partner-connections/{connection_id}/seen-keys":{"get":{"tags":["admin"],"summary":"Get Seen Keys Route","description":"Partner study keys seen in this connection's leads (60 days), to map them.","operationId":"get_seen_keys_route_api_v1_admin_partner_connections__connection_id__seen_keys_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/partner-connections/{connection_id}/test-lead":{"post":{"tags":["admin"],"summary":"Send Test Lead Route","description":"Send a test lead (optionally the Sample lead panel's body, always as a test);\nreturns the request it sent and the exact response the partner would get.","operationId":"send_test_lead_route_api_v1_admin_partner_connections__connection_id__test_lead_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SampleLeadRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/partner-connections/{connection_id}/rotate":{"post":{"tags":["admin"],"summary":"Rotate Partner Connection Route","description":"New key and secret, shown once. No body or no overlap_hours: the old pair stops\nat once; ``{\"overlap_hours\": 24}`` keeps it working for up to 24 h.","operationId":"rotate_partner_connection_route_api_v1_admin_partner_connections__connection_id__rotate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/RotatePartnerRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/partner-connections/{connection_id}/expire-previous":{"post":{"tags":["admin"],"summary":"Expire Previous Route","description":"End the overlap: the old key and secret stop working now.","operationId":"expire_previous_route_api_v1_admin_partner_connections__connection_id__expire_previous_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/partner-connections/orgs/{org_id}/access":{"get":{"tags":["admin"],"summary":"Get Partner Access Route","operationId":"get_partner_access_route_api_v1_admin_partner_connections_orgs__org_id__access_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["admin"],"summary":"Set Partner Access Route","description":"Org admins can (or can't) manage the intake API; which lead formats they may use.","operationId":"set_partner_access_route_api_v1_admin_partner_connections_orgs__org_id__access_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerAccessRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/deployments":{"get":{"tags":["admin"],"summary":"Get Deployments","description":"``{staging: {ok, started_at}, prod: {ok, started_at}}``.","operationId":"get_deployments_api_v1_admin_deployments_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/calling-limits":{"get":{"tags":["admin"],"summary":"Get Calling Limits","description":"The account limit, the reserve, the outbound budget and live calls by kind.","operationId":"get_calling_limits_api_v1_admin_calling_limits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["admin"],"summary":"Put Calling Limits","description":"Save the account limit and the lines kept free for inbound and tests.","operationId":"put_calling_limits_api_v1_admin_calling_limits_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallingLimitsIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/calling-limits/orgs":{"get":{"tags":["admin"],"summary":"Get Org Lines","description":"Every org's own lines (none = a share of the account limit) and its live calls.","operationId":"get_org_lines_api_v1_admin_calling_limits_orgs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/calling-limits/orgs/{org_id}":{"put":{"tags":["admin"],"summary":"Put Org Lines","description":"Set or clear an org's own lines and the share campaign dials may use.","operationId":"put_org_lines_api_v1_admin_calling_limits_orgs__org_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgLinesIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/semper/orgs/{org_id}/studies":{"get":{"tags":["admin","admin-semper"],"summary":"Studies","operationId":"studies_api_v1_admin_semper_orgs__org_id__studies_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/semper/orgs/{org_id}/settings":{"get":{"tags":["admin","admin-semper"],"summary":"Get Settings","operationId":"get_settings_api_v1_admin_semper_orgs__org_id__settings_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["admin","admin-semper"],"summary":"Save Settings","operationId":"save_settings_api_v1_admin_semper_orgs__org_id__settings_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/semper/orgs/{org_id}/settings/history":{"get":{"tags":["admin","admin-semper"],"summary":"History","operationId":"history_api_v1_admin_semper_orgs__org_id__settings_history_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/semper/orgs/{org_id}/settings/restore":{"post":{"tags":["admin","admin-semper"],"summary":"Restore","operationId":"restore_api_v1_admin_semper_orgs__org_id__settings_restore_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/semper/orgs/{org_id}/try":{"post":{"tags":["admin","admin-semper"],"summary":"Try It","description":"A review of one patient with these settings (and the draft), as it would run\nnow, with nothing written: no run, no facts, no watermark, no stored summary.\nCalls the model.","operationId":"try_it_api_v1_admin_semper_orgs__org_id__try_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/semper/orgs/{org_id}/runs":{"get":{"tags":["admin","admin-semper"],"summary":"Runs","operationId":"runs_api_v1_admin_semper_orgs__org_id__runs_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"study_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},{"name":"patient_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Patient Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/semper/orgs/{org_id}/runs/{run_id}":{"get":{"tags":["admin","admin-semper"],"summary":"Run","operationId":"run_api_v1_admin_semper_orgs__org_id__runs__run_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"integer","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/{org_slug}/patients/{patient_id}":{"post":{"tags":["crio-webhooks"],"summary":"Patient Updates","operationId":"patient_updates_api_v1_webhooks_crio__org_slug__patients__patient_id__post","parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/{org_slug}/subjects/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Subject Study Updates","operationId":"subject_study_updates_api_v1_webhooks_crio__org_slug__subjects__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/{org_slug}/studies/{study_id}":{"post":{"tags":["crio-webhooks"],"summary":"Study Updates","operationId":"study_updates_api_v1_webhooks_crio__org_slug__studies__study_id__post","parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/{org_slug}/visits/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Visit Appointment Updates","operationId":"visit_appointment_updates_api_v1_webhooks_crio__org_slug__visits__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/{org_slug}/interactions/{patient_id}":{"post":{"tags":["crio-webhooks"],"summary":"Patient Interactions","operationId":"patient_interactions_api_v1_webhooks_crio__org_slug__interactions__patient_id__post","parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/{org_slug}/subject-created/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Subject Creation","operationId":"subject_creation_api_v1_webhooks_crio__org_slug__subject_created__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/{org_slug}/procedures/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Procedure Completion","operationId":"procedure_completion_api_v1_webhooks_crio__org_slug__procedures__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/{org_slug}/status-change/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Status Change","operationId":"status_change_api_v1_webhooks_crio__org_slug__status_change__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/patients/{patient_id}":{"post":{"tags":["crio-webhooks"],"summary":"Patient Updates Legacy Url","operationId":"patient_updates_legacy_url_api_v1_webhooks_crio_patients__patient_id__post","parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/subjects/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Subject Study Updates Legacy Url","operationId":"subject_study_updates_legacy_url_api_v1_webhooks_crio_subjects__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/studies/{study_id}":{"post":{"tags":["crio-webhooks"],"summary":"Study Updates Legacy Url","operationId":"study_updates_legacy_url_api_v1_webhooks_crio_studies__study_id__post","parameters":[{"name":"study_id","in":"path","required":true,"schema":{"type":"string","title":"Study Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/visits/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Visit Appointment Updates Legacy Url","operationId":"visit_appointment_updates_legacy_url_api_v1_webhooks_crio_visits__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/interactions/{patient_id}":{"post":{"tags":["crio-webhooks"],"summary":"Patient Interactions Legacy Url","operationId":"patient_interactions_legacy_url_api_v1_webhooks_crio_interactions__patient_id__post","parameters":[{"name":"patient_id","in":"path","required":true,"schema":{"type":"string","title":"Patient Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/subject-created/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Subject Creation Legacy Url","operationId":"subject_creation_legacy_url_api_v1_webhooks_crio_subject_created__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/procedures/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Procedure Completion Legacy Url","operationId":"procedure_completion_legacy_url_api_v1_webhooks_crio_procedures__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webhooks/crio/status-change/{subject_id}":{"post":{"tags":["crio-webhooks"],"summary":"Status Change Legacy Url","operationId":"status_change_legacy_url_api_v1_webhooks_crio_status_change__subject_id__post","parameters":[{"name":"subject_id","in":"path","required":true,"schema":{"type":"string","title":"Subject Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/inbound/leads/{connection_id}":{"post":{"tags":["inbound"],"summary":"Receive Lead","operationId":"receive_lead_api_v1_inbound_leads__connection_id__post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/inbound/leads/{connection_id}/status":{"post":{"tags":["inbound"],"summary":"Receive Status","operationId":"receive_status_api_v1_inbound_leads__connection_id__status_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/inbound":{"get":{"tags":["integrations"],"summary":"Get Inbound Status","operationId":"get_inbound_status_api_v1_integrations_inbound_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/integrations/inbound/{connection_id}/pause":{"post":{"tags":["integrations"],"summary":"Pause Inbound","description":"Stop new leads from being processed. They're still received and held.","operationId":"pause_inbound_api_v1_integrations_inbound__connection_id__pause_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/inbound/{connection_id}/activate":{"post":{"tags":["integrations"],"summary":"Activate Inbound","description":"Resume, choosing what happens to the leads held while paused (process or skip).","operationId":"activate_inbound_api_v1_integrations_inbound__connection_id__activate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/{connection_id}/leads":{"post":{"tags":["partner"],"summary":"Receive Lead","operationId":"receive_lead_api_v1_partner__connection_id__leads_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/{connection_id}/studies":{"get":{"tags":["partner"],"summary":"Get Studies","operationId":"get_studies_api_v1_partner__connection_id__studies_get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/{connection_id}/campaigns":{"get":{"tags":["partner"],"summary":"Get Campaigns","operationId":"get_campaigns_api_v1_partner__connection_id__campaigns_get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}},{"name":"studyId","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Studyid"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/{connection_id}/agents":{"get":{"tags":["partner"],"summary":"Get Agents","operationId":"get_agents_api_v1_partner__connection_id__agents_get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}},{"name":"studyId","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Studyid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/{connection_id}/requests":{"get":{"tags":["partner"],"summary":"Get Requests","operationId":"get_requests_api_v1_partner__connection_id__requests_get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Limit"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Before"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/{connection_id}/leads/{lead_id}":{"get":{"tags":["partner"],"summary":"Get Lead","operationId":"get_lead_api_v1_partner__connection_id__leads__lead_id__get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}},{"name":"lead_id","in":"path","required":true,"schema":{"type":"string","title":"Lead Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/intake-api":{"get":{"tags":["integrations"],"summary":"Get Intake Api","description":"The card's and the page's data. {\"enabled\": false} when the switch is off, so\nthe card hides itself; never an error for a plain member.","operationId":"get_intake_api_api_v1_integrations_intake_api_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["integrations"],"summary":"Create Intake Connection","description":"Create (paused). The key and secret are in this response only.","operationId":"create_intake_connection_api_v1_integrations_intake_api_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/integrations/intake-api/options":{"get":{"tags":["integrations"],"summary":"Get Intake Options","description":"The form's studies and campaigns: this org's only.","operationId":"get_intake_options_api_v1_integrations_intake_api_options_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/integrations/intake-api/{connection_id}":{"get":{"tags":["integrations"],"summary":"Get Intake Connection","description":"Settings, auth status and the request log (the last 50 leads).","operationId":"get_intake_connection_api_v1_integrations_intake_api__connection_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["integrations"],"summary":"Update Intake Connection","operationId":"update_intake_connection_api_v1_integrations_intake_api__connection_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePartnerConnectionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/intake-api/{connection_id}/seen-keys":{"get":{"tags":["integrations"],"summary":"Get Intake Seen Keys","description":"Partner study keys seen in this connection's leads (60 days). Read-only, so\nconsole-made connections can be read too. Only keys, never a lead.","operationId":"get_intake_seen_keys_api_v1_integrations_intake_api__connection_id__seen_keys_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/intake-api/{connection_id}/rotate":{"post":{"tags":["integrations"],"summary":"Rotate Intake Connection","description":"New key and secret, shown once. No body or no overlap_hours: the old pair stops\nat once; ``{\"overlap_hours\": 24}`` keeps it working for up to 24 h.","operationId":"rotate_intake_connection_api_v1_integrations_intake_api__connection_id__rotate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/RotatePartnerRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/intake-api/{connection_id}/expire-previous":{"post":{"tags":["integrations"],"summary":"Expire Intake Previous","description":"End the overlap now: the old key and secret get 401 from the next request.","operationId":"expire_intake_previous_api_v1_integrations_intake_api__connection_id__expire_previous_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/intake-api/{connection_id}/pause":{"post":{"tags":["integrations"],"summary":"Pause Intake Connection","description":"New leads are still received and answered, but held until it's activated.","operationId":"pause_intake_connection_api_v1_integrations_intake_api__connection_id__pause_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/intake-api/{connection_id}/activate":{"post":{"tags":["integrations"],"summary":"Activate Intake Connection","description":"Resume, choosing what happens to the leads held while paused (process or skip).","operationId":"activate_intake_connection_api_v1_integrations_intake_api__connection_id__activate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/intake-api/{connection_id}/revoke":{"post":{"tags":["integrations"],"summary":"Revoke Intake Connection","description":"Final: every request with these credentials is refused from now on.","operationId":"revoke_intake_connection_api_v1_integrations_intake_api__connection_id__revoke_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/intake-api/{connection_id}/test-lead":{"post":{"tags":["integrations"],"summary":"Send Intake Test Lead","description":"Send a test lead (optionally the Sample lead panel's body, always as a test);\nreturns the request it sent and the exact response.","operationId":"send_intake_test_lead_api_v1_integrations_intake_api__connection_id__test_lead_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Connection Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SampleLeadRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/vapi/webhook":{"post":{"summary":"Vapi Webhook Alias","description":"Alias for Vapi webhook — vera-compiler sets server.url which Vapi appends /vapi/webhook to.","operationId":"vapi_webhook_alias_vapi_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"ActivateRequest":{"properties":{"backlog":{"type":"string","enum":["process","skip"],"title":"Backlog"}},"type":"object","required":["backlog"],"title":"ActivateRequest"},"AddMemberRequest":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"role":{"type":"string","enum":["admin","member"],"title":"Role","default":"member"}},"type":"object","required":["user_id"],"title":"AddMemberRequest"},"AddPatientRequest":{"properties":{"patient_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"last_name":{"type":"string","title":"Last Name","default":""},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"screening_result":{"type":"string","title":"Screening Result","default":"not_screened"}},"type":"object","title":"AddPatientRequest"},"AddPatientToStudyRequest":{"properties":{"patient_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"},"first_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"First Name"},"last_name":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Last Name"},"cell_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cell Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"}},"type":"object","title":"AddPatientToStudyRequest"},"AddPatientsRequest":{"properties":{"patient_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Patient Ids"},"source_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"},"start_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start At"}},"type":"object","title":"AddPatientsRequest"},"AiRequest":{"properties":{"on":{"type":"boolean","title":"On"},"reason":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Reason"}},"type":"object","required":["on"],"title":"AiRequest"},"ApplySpecRequest":{"properties":{"spec":{"additionalProperties":true,"type":"object","title":"Spec"}},"type":"object","required":["spec"],"title":"ApplySpecRequest"},"AppointmentOutcomeRequest":{"properties":{"outcome":{"type":"string","pattern":"^(attended|no_show)$","title":"Outcome"}},"type":"object","required":["outcome"],"title":"AppointmentOutcomeRequest"},"ApproveRequest":{"properties":{"approved_by":{"type":"string","title":"Approved By"},"start_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start At"}},"type":"object","required":["approved_by"],"title":"ApproveRequest"},"AssignPhoneRequest":{"properties":{"org_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Org Id"},"is_primary":{"type":"boolean","title":"Is Primary","default":true}},"type":"object","title":"AssignPhoneRequest"},"AssignStudyRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","required":["study_id"],"title":"AssignStudyRequest"},"AssigneeRequest":{"properties":{"assignee_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Assignee Id"}},"type":"object","title":"AssigneeRequest"},"AttachedFile":{"properties":{"name":{"type":"string","maxLength":255,"title":"Name"},"kind":{"type":"string","pattern":"^(document|patient_list)$","title":"Kind"},"size":{"type":"integer","minimum":0.0,"title":"Size","default":0},"sha256":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Sha256"},"doc_type":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Doc Type"},"text":{"anyOf":[{"type":"string","maxLength":30200},{"type":"null"}],"title":"Text"},"cut":{"type":"boolean","title":"Cut","default":false},"source_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Source Id"},"rows":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rows"}},"type":"object","required":["name","kind"],"title":"AttachedFile","description":"What the panel knows about a file it holds (never the bytes)."},"Body_apply_change_with_files_api_v1_assistant_apply_files_post":{"properties":{"token":{"type":"string","maxLength":60000,"minLength":10,"title":"Token"},"confirmed":{"type":"boolean","title":"Confirmed","default":false},"chat_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Chat Id"},"files":{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"}},"type":"object","required":["token"],"title":"Body_apply_change_with_files_api_v1_assistant_apply_files_post"},"Body_read_file_api_v1_assistant_files_read_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_read_file_api_v1_assistant_files_read_post"},"Body_twilio_inbound_sms_webhook_twilio_sms_post":{"properties":{"From":{"type":"string","title":"From","default":""},"Body":{"type":"string","title":"Body","default":""},"To":{"type":"string","title":"To","default":""},"MessageSid":{"type":"string","title":"Messagesid","default":""}},"type":"object","title":"Body_twilio_inbound_sms_webhook_twilio_sms_post"},"Body_upload_document_api_v1_studies__study_id__documents_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"document_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Type"}},"type":"object","required":["file"],"title":"Body_upload_document_api_v1_studies__study_id__documents_post"},"Body_upload_file_api_v1_sources_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_file_api_v1_sources_upload_post"},"BookingRequest":{"properties":{"site":{"type":"string","title":"Site"},"date":{"type":"string","title":"Date"},"time":{"type":"string","title":"Time"},"day":{"type":"string","title":"Day","default":""}},"type":"object","required":["site","date","time"],"title":"BookingRequest"},"BrowserCallLog":{"properties":{"transcript":{"items":{"$ref":"#/components/schemas/BrowserCallTurn"},"type":"array","title":"Transcript"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"callback_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Number"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"external_call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Call Id"},"pronunciation_flags":{"items":{"$ref":"#/components/schemas/PronunciationFlagIn"},"type":"array","title":"Pronunciation Flags"}},"type":"object","title":"BrowserCallLog"},"BrowserCallTurn":{"properties":{"role":{"type":"string","title":"Role"},"text":{"type":"string","title":"Text"}},"type":"object","required":["role","text"],"title":"BrowserCallTurn"},"BulkCreateSlotsRequest":{"properties":{"site_name":{"type":"string","title":"Site Name"},"days":{"items":{"type":"integer"},"type":"array","title":"Days"},"start_hour":{"type":"integer","title":"Start Hour","default":9},"end_hour":{"type":"integer","title":"End Hour","default":17},"interval_minutes":{"type":"integer","title":"Interval Minutes","default":60},"capacity":{"type":"integer","title":"Capacity","default":1}},"type":"object","required":["site_name","days"],"title":"BulkCreateSlotsRequest"},"CallingLimitsIn":{"properties":{"limit":{"type":"integer","title":"Limit"},"reserve":{"type":"integer","title":"Reserve"}},"type":"object","required":["limit","reserve"],"title":"CallingLimitsIn"},"CancelAppointmentRequest":{"properties":{"appointment_id":{"type":"string","title":"Appointment Id"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"sms_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sms Body"},"local_only":{"type":"boolean","title":"Local Only","default":false}},"type":"object","required":["appointment_id"],"title":"CancelAppointmentRequest"},"CardOutcome":{"properties":{"title":{"type":"string","maxLength":300,"title":"Title"},"at":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"At"},"outcome":{"type":"string","enum":["applied","cancelled","failed","not acted on"],"title":"Outcome"},"message":{"anyOf":[{"type":"string","maxLength":600},{"type":"null"}],"title":"Message"},"undo":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Undo"}},"type":"object","required":["title","outcome"],"title":"CardOutcome"},"ChannelTestRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"voice_campaign_type":{"type":"string","title":"Voice Campaign Type","default":"first_contact"},"include_dispositions":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Include Dispositions"},"relaunch_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Relaunch From"}},"type":"object","title":"ChannelTestRequest"},"ChatRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Msg"},"type":"array","maxItems":400,"minItems":1,"title":"Messages"},"page":{"anyOf":[{"$ref":"#/components/schemas/Page"},{"type":"null"}]},"changes":{"items":{"$ref":"#/components/schemas/CardOutcome"},"type":"array","maxItems":50,"title":"Changes"},"shown_buttons":{"items":{"type":"string"},"type":"array","maxItems":30,"title":"Shown Buttons"},"chat_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Chat Id"},"files":{"items":{"$ref":"#/components/schemas/AttachedFile"},"type":"array","maxItems":6,"title":"Files"}},"type":"object","required":["messages"],"title":"ChatRequest"},"CloseStudyRequest":{"properties":{"number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Number"},"keys":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Keys"},"disabled":{"type":"boolean","title":"Disabled","default":false}},"type":"object","title":"CloseStudyRequest"},"ClosedDate":{"properties":{"from":{"type":"string","title":"From"},"to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"To"},"label":{"type":"string","title":"Label","default":""}},"type":"object","required":["from"],"title":"ClosedDate"},"ClosedDaysRequest":{"properties":{"holiday_location":{"anyOf":[{"$ref":"#/components/schemas/HolidayLocation"},{"type":"null"}]},"reset_location":{"type":"boolean","title":"Reset Location","default":false},"removed_holidays":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Removed Holidays"},"added_holidays":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Added Holidays"},"closed_dates":{"anyOf":[{"items":{"$ref":"#/components/schemas/ClosedDate"},"type":"array"},{"type":"null"}],"title":"Closed Dates"}},"type":"object","title":"ClosedDaysRequest","description":"Any subset; keys left out keep their stored value. ``holiday_location: null``\ngoes back to the location detected from the site."},"ColumnInfo":{"properties":{"name":{"type":"string","title":"Name"},"detected_type":{"type":"string","title":"Detected Type"},"sample_values":{"items":{"type":"string"},"type":"array","title":"Sample Values"},"non_null_count":{"type":"integer","title":"Non Null Count"}},"type":"object","required":["name","detected_type","sample_values","non_null_count"],"title":"ColumnInfo"},"ColumnMappingRequest":{"properties":{"mapping":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","title":"Mapping"}},"type":"object","required":["mapping"],"title":"ColumnMappingRequest"},"ColumnMappingResponse":{"properties":{"source_id":{"type":"string","title":"Source Id"},"mapping":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","title":"Mapping"},"status":{"type":"string","title":"Status"}},"type":"object","required":["source_id","mapping","status"],"title":"ColumnMappingResponse"},"ColumnReport":{"properties":{"valid":{"type":"integer","title":"Valid"},"errors":{"type":"integer","title":"Errors"},"warnings":{"type":"integer","title":"Warnings"}},"type":"object","required":["valid","errors","warnings"],"title":"ColumnReport"},"ContactListRequest":{"properties":{"stages":{"items":{"type":"string"},"type":"array","title":"Stages","default":[]},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","default":[]}},"type":"object","title":"ContactListRequest"},"ContactedRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"note":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Note"},"clear_tags":{"items":{"type":"string"},"type":"array","title":"Clear Tags"},"reached":{"type":"boolean","title":"Reached","default":true},"close_owed":{"type":"boolean","title":"Close Owed","default":true},"outcome":{"anyOf":[{"type":"string","enum":["reached","voicemail","no_answer","booked","not_interested","escalated_pi","other"]},{"type":"null"}],"title":"Outcome"},"pi_informed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Pi Informed"}},"type":"object","required":["study_id"],"title":"ContactedRequest","description":"\"Mark done\" on the profile and in Needs you (user, 2026-10-23; was Contacted)."},"CreateAppointmentRequest":{"properties":{"patient_id":{"type":"string","title":"Patient Id"},"site":{"type":"string","title":"Site"},"day":{"type":"string","title":"Day","default":""},"date":{"type":"string","title":"Date","default":""},"time":{"type":"string","title":"Time","default":""}},"type":"object","required":["patient_id","site"],"title":"CreateAppointmentRequest"},"CreateCallRequest":{"properties":{"patient_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Patient Id"},"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"agent_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Agent Id"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"scheduled_call_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Scheduled Call Id"},"is_test":{"type":"boolean","title":"Is Test","default":false},"override":{"type":"boolean","title":"Override","default":false}},"type":"object","title":"CreateCallRequest"},"CreateCallResponse":{"properties":{"call_id":{"type":"string","title":"Call Id"},"session_id":{"type":"string","title":"Session Id"},"patient_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Id"},"squad_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Squad Id"},"assistant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assistant Id"},"status":{"type":"string","title":"Status"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"}},"type":"object","required":["call_id","session_id","status"],"title":"CreateCallResponse"},"CreateConnectionRequest":{"properties":{"org_id":{"type":"string","format":"uuid","title":"Org Id"},"name":{"type":"string","title":"Name"},"study_id":{"type":"string","format":"uuid","title":"Study Id"},"cadence_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Cadence Ids","default":[]},"field_mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Field Mapping"},"destination":{"anyOf":[{"type":"string","enum":["intera","crio"]},{"type":"null"}],"title":"Destination"},"ctms_push":{"anyOf":[{"type":"string","enum":["off","on_arrival","on_qualified"]},{"type":"null"}],"title":"Ctms Push"},"sheet_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sheet Url"}},"additionalProperties":false,"type":"object","required":["org_id","name","study_id","field_mapping"],"title":"CreateConnectionRequest"},"CreateExperiment":{"properties":{"name":{"type":"string","maxLength":120,"title":"Name","default":""},"channel":{"type":"string","pattern":"^(sms|voice)$","title":"Channel","default":"sms"},"variant_b_opener":{"anyOf":[{"type":"string","maxLength":600,"minLength":10},{"type":"null"}],"title":"Variant B Opener"},"variant_a_agent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variant A Agent Id"},"variant_b_agent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variant B Agent Id"},"variant_a_script_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variant A Script Id"},"variant_b_script_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Variant B Script Id"},"split_pct":{"type":"integer","maximum":99.0,"minimum":1.0,"title":"Split Pct","default":50},"segment":{"type":"string","pattern":"^(all|cold|warm)$","title":"Segment","default":"all"}},"type":"object","title":"CreateExperiment"},"CreateOrgRequest":{"properties":{"name":{"type":"string","title":"Name"},"slug":{"type":"string","title":"Slug"},"domain":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Domain"},"region":{"type":"string","title":"Region","default":"us-east-1"}},"type":"object","required":["name","slug"],"title":"CreateOrgRequest"},"CreatePartnerConnectionRequest":{"properties":{"lead_format":{"type":"string","title":"Lead Format"},"allowed_study_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Allowed Study Ids"},"study_key_map":{"anyOf":[{"additionalProperties":{"type":"string","format":"uuid"},"type":"object"},{"type":"null"}],"title":"Study Key Map"},"study_defaults":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/StudyDefault"},"propertyNames":{"format":"uuid"},"type":"object"},{"type":"null"}],"title":"Study Defaults"},"default_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Timezone"},"org_id":{"type":"string","format":"uuid","title":"Org Id"},"name":{"type":"string","title":"Name"}},"additionalProperties":false,"type":"object","required":["lead_format","allowed_study_ids","org_id","name"],"title":"CreatePartnerConnectionRequest"},"CreatePatientRequest":{"properties":{"first_name":{"type":"string","maxLength":100,"title":"First Name"},"last_name":{"type":"string","maxLength":100,"title":"Last Name"},"cell_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cell Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"date_of_birth":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date Of Birth"},"gender":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gender"},"study_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}},"type":"object","required":["first_name","last_name"],"title":"CreatePatientRequest"},"CreateRequest":{"properties":{"lead_format":{"type":"string","title":"Lead Format"},"allowed_study_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Allowed Study Ids"},"study_key_map":{"anyOf":[{"additionalProperties":{"type":"string","format":"uuid"},"type":"object"},{"type":"null"}],"title":"Study Key Map"},"study_defaults":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/StudyDefault"},"propertyNames":{"format":"uuid"},"type":"object"},{"type":"null"}],"title":"Study Defaults"},"default_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Timezone"},"name":{"type":"string","title":"Name"}},"additionalProperties":false,"type":"object","required":["lead_format","allowed_study_ids","name"],"title":"CreateRequest","description":"The console's create body without org_id: the org is always the user's own."},"CreateSlotRequest":{"properties":{"site_name":{"type":"string","title":"Site Name"},"day_of_week":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Day Of Week"},"time_slot":{"type":"string","title":"Time Slot"},"capacity":{"type":"integer","title":"Capacity","default":1}},"type":"object","required":["site_name","time_slot"],"title":"CreateSlotRequest"},"CreateStudyRequest":{"properties":{"name":{"type":"string","title":"Name"},"protocol_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Protocol Number"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"therapeutic_area":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Therapeutic Area"},"indication":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Indication"},"phase":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phase"},"sponsor_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sponsor Name"},"inclusion_criteria":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Inclusion Criteria"},"exclusion_criteria":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Exclusion Criteria"},"config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Config"}},"type":"object","required":["name"],"title":"CreateStudyRequest"},"CrioAvailabilityRequest":{"properties":{"enabled":{"type":"boolean","title":"Enabled","default":false},"prefetch_working_days":{"type":"integer","title":"Prefetch Working Days","default":2},"slots_to_offer":{"type":"integer","title":"Slots To Offer","default":3}},"type":"object","title":"CrioAvailabilityRequest"},"CrioCredentialRequest":{"properties":{"region":{"type":"string","title":"Region"},"bearer_token":{"type":"string","title":"Bearer Token"},"client_id":{"type":"string","title":"Client Id"}},"type":"object","required":["region","bearer_token","client_id"],"title":"CrioCredentialRequest"},"CrioSiteUpdate":{"properties":{"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"}},"type":"object","title":"CrioSiteUpdate"},"CrioTaskRequest":{"properties":{"task_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Id"}},"type":"object","title":"CrioTaskRequest"},"CrioTestRequest":{"properties":{"webhook_type":{"type":"string","title":"Webhook Type"},"payload":{"anyOf":[{"additionalProperties":true,"type":"object"},{"items":{},"type":"array"}],"title":"Payload"}},"type":"object","required":["webhook_type","payload"],"title":"CrioTestRequest"},"Criterion":{"properties":{"label":{"type":"string","title":"Label"},"type":{"type":"string","title":"Type"},"column":{"type":"string","title":"Column"},"value":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"number"},{"type":"boolean"},{"type":"null"}],"title":"Value"},"min":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Min"},"max":{"anyOf":[{"type":"integer"},{"type":"number"},{"type":"null"}],"title":"Max"}},"type":"object","required":["label","type","column"],"title":"Criterion"},"DailyCapIn":{"properties":{"study_id":{"type":"string","title":"Study Id"},"policies":{"additionalProperties":true,"type":"object","title":"Policies","default":{}},"agent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Id"},"cadence_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cadence Id"}},"type":"object","required":["study_id"],"title":"DailyCapIn"},"DecisionRequest":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Note"}},"type":"object","title":"DecisionRequest"},"DeleteOrgRequest":{"properties":{"confirm_slug":{"type":"string","title":"Confirm Slug"}},"type":"object","required":["confirm_slug"],"title":"DeleteOrgRequest"},"DocumentTypeUpdate":{"properties":{"document_type":{"type":"string","title":"Document Type"}},"type":"object","required":["document_type"],"title":"DocumentTypeUpdate"},"DuplicateGroup":{"properties":{"key":{"type":"string","title":"Key"},"rows":{"items":{"type":"integer"},"type":"array","title":"Rows"},"existing_patient_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Existing Patient Id"},"match_type":{"type":"string","title":"Match Type"}},"type":"object","required":["key","rows","match_type"],"title":"DuplicateGroup"},"EodConfigRequest":{"properties":{"eod_report_time":{"type":"string","title":"Eod Report Time"},"eod_timezone":{"type":"string","title":"Eod Timezone"}},"type":"object","required":["eod_report_time","eod_timezone"],"title":"EodConfigRequest"},"EscalationAcknowledgeRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"}},"type":"object","required":["study_id"],"title":"EscalationAcknowledgeRequest"},"EscalationResolveRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"note":{"type":"string","title":"Note","default":""},"visit_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visit Date"},"visit_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visit Time"},"visit_site":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visit Site"},"send_sms":{"type":"boolean","title":"Send Sms","default":false},"sms_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sms Message"}},"type":"object","required":["study_id"],"title":"EscalationResolveRequest"},"ExportRequest":{"properties":{"patient_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":500,"minItems":1,"title":"Patient Ids"},"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"export_id":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Export Id"},"format":{"type":"string","enum":["csv","xlsx"],"title":"Format"},"scope":{"type":"string","enum":["inbox","queue"],"title":"Scope","default":"inbox"},"filters":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"integer"},{"type":"boolean"},{"type":"null"}]},"type":"object","maxProperties":40,"title":"Filters"},"chunk":{"type":"integer","minimum":1.0,"title":"Chunk","default":1},"total":{"type":"integer","minimum":0.0,"title":"Total","default":0}},"type":"object","required":["patient_ids","export_id","format"],"title":"ExportRequest"},"FromIntentRequest":{"properties":{"study_id":{"type":"string","title":"Study Id"},"intent":{"type":"string","title":"Intent","default":""},"agent_type":{"type":"string","title":"Agent Type","default":"screener"},"source_ids":{"items":{"type":"string"},"type":"array","title":"Source Ids","default":[]},"call_window_start":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Call Window Start"},"call_window_end":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Call Window End"},"agent_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Label"}},"type":"object","required":["study_id"],"title":"FromIntentRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HandoffScriptRequest":{"properties":{"transfer_line":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transfer Line"},"fallback_line":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fallback Line"},"on_failed_handoff":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"On Failed Handoff"}},"type":"object","title":"HandoffScriptRequest"},"HolidayLocation":{"properties":{"country":{"type":"string","title":"Country"},"subdiv":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subdiv"}},"type":"object","required":["country"],"title":"HolidayLocation"},"ImportFromCtmsRequest":{"properties":{"ctms_type":{"type":"string","title":"Ctms Type"},"ctms_patient_id":{"type":"string","title":"Ctms Patient Id"},"site_id":{"type":"string","title":"Site Id"},"study_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"}},"type":"object","required":["ctms_type","ctms_patient_id","site_id"],"title":"ImportFromCtmsRequest"},"InviteRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"role":{"type":"string","enum":["admin","member"],"title":"Role","default":"member"}},"type":"object","required":["email"],"title":"InviteRequest"},"LinkCrioRequest":{"properties":{"crio_patient_id":{"type":"string","title":"Crio Patient Id"},"site_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Site Id"}},"type":"object","required":["crio_patient_id"],"title":"LinkCrioRequest"},"LinkSourcesRequest":{"properties":{"source_ids":{"items":{"type":"string"},"type":"array","title":"Source Ids"}},"type":"object","required":["source_ids"],"title":"LinkSourcesRequest"},"LoadPreviewIn":{"properties":{"policies":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Policies"},"start_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start At"}},"type":"object","title":"LoadPreviewIn"},"LogInteractionRequest":{"properties":{"channel":{"type":"string","title":"Channel"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"direction":{"type":"string","title":"Direction","default":"outbound"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"analyze":{"type":"boolean","title":"Analyze","default":false}},"type":"object","required":["channel"],"title":"LogInteractionRequest"},"MappingRequest":{"properties":{"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"inclusion":{"items":{"$ref":"#/components/schemas/Criterion"},"type":"array","title":"Inclusion","default":[]},"exclusion":{"items":{"$ref":"#/components/schemas/Criterion"},"type":"array","title":"Exclusion","default":[]}},"type":"object","title":"MappingRequest"},"MappingResponse":{"properties":{"source_id":{"type":"string","title":"Source Id"},"study_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Id"},"status":{"type":"string","title":"Status"},"inclusion_count":{"type":"integer","title":"Inclusion Count"},"exclusion_count":{"type":"integer","title":"Exclusion Count"},"column_warnings":{"items":{"type":"string"},"type":"array","title":"Column Warnings"}},"type":"object","required":["source_id","status","inclusion_count","exclusion_count","column_warnings"],"title":"MappingResponse"},"MissedCallSmsRequest":{"properties":{"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["enabled"],"title":"MissedCallSmsRequest"},"Msg":{"properties":{"role":{"type":"string","enum":["user","assistant"],"title":"Role"},"content":{"type":"string","maxLength":8000,"title":"Content"}},"type":"object","required":["role","content"],"title":"Msg"},"NextStepRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"choice":{"type":"string","pattern":"^(agent_rebooks|person_follows_up|stop)$","title":"Choice"},"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","required":["study_id","choice"],"title":"NextStepRequest"},"NoStudyRequest":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"}},"type":"object","title":"NoStudyRequest"},"NumberRequest":{"properties":{"channel":{"type":"string","pattern":"^(texts|calls)$","title":"Channel"},"number":{"type":"string","pattern":"^(cell|home)$","title":"Number"}},"type":"object","required":["channel","number"],"title":"NumberRequest"},"OperationsRequest":{"properties":{"changes":{"additionalProperties":true,"type":"object","title":"Changes"},"note":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Note"},"expected_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expected Version","default":-1}},"type":"object","required":["changes"],"title":"OperationsRequest"},"OptOutLiftRequest":{"properties":{"note":{"type":"string","maxLength":2000,"minLength":1,"title":"Note"},"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},"type":"object","required":["note"],"title":"OptOutLiftRequest"},"OrgHolidayLocation":{"properties":{"country":{"type":"string","title":"Country","default":""},"subdiv":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subdiv"}},"type":"object","title":"OrgHolidayLocation","description":"Country \"US\" / \"CA\" and an optional state / province code; country \"\" clears it."},"OrgLinesIn":{"properties":{"lines":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lines"},"outbound_pct":{"type":"integer","title":"Outbound Pct","default":80}},"type":"object","title":"OrgLinesIn"},"OutreachConfigRequest":{"properties":{"max_attempts":{"type":"integer","maximum":20.0,"minimum":1.0,"title":"Max Attempts","default":3},"call_window_start":{"type":"integer","maximum":23.0,"minimum":0.0,"title":"Call Window Start","default":9},"call_window_end":{"type":"integer","maximum":23.0,"minimum":0.0,"title":"Call Window End","default":17},"timezone":{"type":"string","title":"Timezone","default":"America/New_York"},"retry_hours":{"type":"number","maximum":168.0,"exclusiveMinimum":0.0,"title":"Retry Hours","default":4.0},"channels":{"items":{"type":"string"},"type":"array","title":"Channels","default":["voice"]},"voicemail_policy":{"type":"string","title":"Voicemail Policy","default":"skip"},"voicemail_message":{"type":"string","title":"Voicemail Message","default":""},"stop_on_appointment":{"type":"boolean","title":"Stop On Appointment","default":true},"stop_on_opt_out":{"type":"boolean","title":"Stop On Opt Out","default":true},"stop_on_ineligible":{"type":"boolean","title":"Stop On Ineligible","default":true},"stop_on_max_attempts":{"type":"boolean","title":"Stop On Max Attempts","default":true},"attempt_schedule":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Attempt Schedule"},"campaign_end_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign End At"},"active_days":{"items":{"type":"integer"},"type":"array","title":"Active Days","default":[1,2,3,4,5]},"booking_buffer_hours":{"type":"integer","title":"Booking Buffer Hours","default":0}},"type":"object","title":"OutreachConfigRequest"},"OutreachRequest":{"properties":{"study_id":{"type":"string","title":"Study Id"},"patient_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Patient Ids"}},"type":"object","required":["study_id"],"title":"OutreachRequest"},"OwedAction":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Note"},"until":{"anyOf":[{"type":"string","pattern":"^(next_working_day|three_working_days|date)$"},{"type":"null"}],"title":"Until"},"on":{"anyOf":[{"type":"string","maxLength":10},{"type":"null"}],"title":"On"}},"type":"object","title":"OwedAction"},"Page":{"properties":{"path":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Path"},"study_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Study Id"},"study_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Study Name"},"patient_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Patient Id"},"tz":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Tz"}},"type":"object","title":"Page"},"Params":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Note"},"clear_tags":{"items":{"type":"string"},"type":"array","title":"Clear Tags"},"close_callbacks":{"type":"boolean","title":"Close Callbacks","default":false},"reason":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Reason"},"cadence_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Cadence Id"},"assignee_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Assignee Id"},"unassign":{"type":"boolean","title":"Unassign","default":false}},"type":"object","title":"Params"},"PartnerAccessRequest":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"formats":{"items":{"type":"string"},"type":"array","title":"Formats"}},"additionalProperties":false,"type":"object","required":["enabled"],"title":"PartnerAccessRequest"},"PatientTimezoneRequest":{"properties":{"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"}},"type":"object","title":"PatientTimezoneRequest"},"PlanPreviewRequest":{"properties":{"spec":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Spec"},"start_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start At"}},"type":"object","title":"PlanPreviewRequest"},"PresetTargetsRequest":{"properties":{"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"}},"type":"object","title":"PresetTargetsRequest"},"PreviewRequest":{"properties":{"action":{"type":"string","enum":["mark_done","ai_off","ai_on","do_not_call","do_not_text","pause_outreach","resume_outreach","restart_outreach","add_to_campaign","assign"],"title":"Action"},"params":{"$ref":"#/components/schemas/Params"},"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"targets":{"items":{"$ref":"#/components/schemas/Target"},"type":"array","maxItems":500,"minItems":1,"title":"Targets"}},"type":"object","required":["action","targets"],"title":"PreviewRequest"},"PromoteBody":{"properties":{"winner":{"type":"string","pattern":"^(A|B)$","title":"Winner"}},"type":"object","required":["winner"],"title":"PromoteBody"},"PronunciationFlagIn":{"properties":{"term":{"type":"string","maxLength":80,"minLength":2,"title":"Term"},"kind":{"type":"string","title":"Kind","default":"suspect"},"heard_as":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Heard As"},"suggested_spoken":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suggested Spoken"},"example_intended":{"anyOf":[{"type":"string","maxLength":400},{"type":"null"}],"title":"Example Intended"},"example_heard":{"anyOf":[{"type":"string","maxLength":400},{"type":"null"}],"title":"Example Heard"}},"type":"object","required":["term"],"title":"PronunciationFlagIn"},"ProposeRequest":{"properties":{"campaign_type":{"type":"string","title":"Campaign Type","default":"revival"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"include_dispositions":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Include Dispositions"},"spec":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Spec"},"relaunch_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Relaunch From"}},"type":"object","title":"ProposeRequest"},"ProvisionRequest":{"properties":{"org_id":{"type":"string","format":"uuid","title":"Org Id"},"region":{"type":"string","title":"Region","default":"us-east-1"}},"type":"object","required":["org_id"],"title":"ProvisionRequest"},"ProvisionResult":{"properties":{"org_id":{"type":"string","title":"Org Id"},"project_ref":{"type":"string","title":"Project Ref"},"region":{"type":"string","title":"Region"},"status":{"type":"string","title":"Status"},"migrations_applied":{"type":"integer","title":"Migrations Applied"}},"type":"object","required":["org_id","project_ref","region","status","migrations_applied"],"title":"ProvisionResult"},"ProvisionToolRequest":{"properties":{"org_id":{"type":"string","title":"Org Id"},"name":{"type":"string","title":"Name"},"display_name":{"type":"string","title":"Display Name"},"description":{"type":"string","title":"Description","default":""},"parameter_schema":{"additionalProperties":true,"type":"object","title":"Parameter Schema","default":{}},"server_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Server Url"},"tool_type":{"type":"string","title":"Tool Type","default":"custom"},"config":{"additionalProperties":true,"type":"object","title":"Config","default":{}}},"type":"object","required":["org_id","name","display_name"],"title":"ProvisionToolRequest"},"PushToCtmsRequest":{"properties":{"study_id":{"type":"string","title":"Study Id"},"site_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Site Id"},"force":{"type":"boolean","title":"Force","default":false}},"type":"object","required":["study_id"],"title":"PushToCtmsRequest"},"QuickCreateRequest":{"properties":{"study_id":{"type":"string","title":"Study Id"}},"type":"object","required":["study_id"],"title":"QuickCreateRequest"},"RawUploadResponse":{"properties":{"source_id":{"type":"string","title":"Source Id"},"filename":{"type":"string","title":"Filename"},"total_row_count":{"type":"integer","title":"Total Row Count"},"raw_rows":{"items":{"items":{"type":"string"},"type":"array"},"type":"array","title":"Raw Rows"},"auto_header_row":{"type":"integer","title":"Auto Header Row"},"sheet_names":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sheet Names"}},"type":"object","required":["source_id","filename","total_row_count","raw_rows","auto_header_row"],"title":"RawUploadResponse"},"ReaskRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"questions":{"items":{"type":"string"},"type":"array","title":"Questions","default":[]},"reason":{"type":"string","title":"Reason","default":""}},"type":"object","required":["study_id"],"title":"ReaskRequest"},"ReevaluateRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"apply":{"type":"boolean","title":"Apply","default":false},"expect_inputs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expect Inputs"},"lift_check":{"type":"boolean","title":"Lift Check","default":false}},"type":"object","required":["study_id"],"title":"ReevaluateRequest"},"RefreshAudienceRequest":{"properties":{"start_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start At"}},"type":"object","title":"RefreshAudienceRequest"},"RegisterPhoneRequest":{"properties":{"vapi_phone_number_id":{"type":"string","title":"Vapi Phone Number Id"},"phone_number":{"type":"string","title":"Phone Number"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"org_id":{"type":"string","format":"uuid","title":"Org Id"}},"type":"object","required":["vapi_phone_number_id","phone_number","org_id"],"title":"RegisterPhoneRequest"},"ReminderPrefsRequest":{"properties":{"reminders_disabled":{"type":"boolean","title":"Reminders Disabled"}},"type":"object","required":["reminders_disabled"],"title":"ReminderPrefsRequest"},"ReminderSettings":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"offsets_hours":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Offsets Hours"}},"type":"object","required":["enabled"],"title":"ReminderSettings"},"ReprovisionRequest":{"properties":{"confirm_slug":{"type":"string","title":"Confirm Slug"}},"type":"object","required":["confirm_slug"],"title":"ReprovisionRequest"},"RescheduleRequest":{"properties":{"run_at":{"type":"string","title":"Run At"}},"type":"object","required":["run_at"],"title":"RescheduleRequest"},"RescheduleVisitRequest":{"properties":{"appointment_id":{"type":"string","title":"Appointment Id"},"new_date":{"type":"string","title":"New Date"},"new_time":{"type":"string","title":"New Time"},"sms_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sms Body"}},"type":"object","required":["appointment_id","new_date","new_time"],"title":"RescheduleVisitRequest"},"RestartRequest":{"properties":{"restart":{"type":"boolean","title":"Restart","default":false}},"type":"object","title":"RestartRequest"},"RestoreRequest":{"properties":{"version_id":{"type":"integer","title":"Version Id"},"note":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Note"},"expected_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expected Version"}},"type":"object","required":["version_id","expected_version"],"title":"RestoreRequest"},"RotateCrioTokenRequest":{"properties":{"region":{"type":"string","title":"Region"},"bearer_token":{"type":"string","title":"Bearer Token"},"client_id":{"type":"string","title":"Client Id"}},"type":"object","required":["region","bearer_token","client_id"],"title":"RotateCrioTokenRequest"},"RotatePartnerRequest":{"properties":{"overlap_hours":{"type":"integer","maximum":24.0,"minimum":0.0,"title":"Overlap Hours","default":0}},"additionalProperties":false,"type":"object","title":"RotatePartnerRequest"},"SampleLeadRequest":{"properties":{"lead":{"additionalProperties":true,"type":"object","title":"Lead"},"routing":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Routing"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"additionalProperties":false,"type":"object","required":["lead"],"title":"SampleLeadRequest","description":"Optional body for Send test lead (console and org page): the envelope the Sample\nlead panel built. The lead is always sent as a test (environment \"test\", a fresh\nleadId and submittedAt), so it is stored and answered but never becomes a patient."},"SaveRequest":{"properties":{"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"overrides":{"additionalProperties":true,"type":"object","title":"Overrides"},"note":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Note"},"expected_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expected Version"}},"type":"object","required":["expected_version"],"title":"SaveRequest"},"ScheduleCallRequest":{"properties":{"agent_id":{"type":"string","title":"Agent Id"},"date":{"type":"string","title":"Date"},"time":{"type":"string","title":"Time"}},"type":"object","required":["agent_id","date","time"],"title":"ScheduleCallRequest"},"SchedulingRestrictionsRequest":{"properties":{"text":{"type":"string","title":"Text","default":""}},"type":"object","title":"SchedulingRestrictionsRequest"},"ScreeningOverrideRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"result":{"type":"string","title":"Result"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["study_id","result","reason"],"title":"ScreeningOverrideRequest"},"SendHeldEmailRequest":{"properties":{"cc_emails":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Cc Emails"}},"type":"object","title":"SendHeldEmailRequest","description":"Optional overrides applied at send time. Omitted means use what was stored."},"SendReminderRequest":{"properties":{"study_id":{"type":"string","title":"Study Id"}},"type":"object","required":["study_id"],"title":"SendReminderRequest"},"SendSmsRequest":{"properties":{"body":{"type":"string","title":"Body"},"study_id":{"type":"string","title":"Study Id"}},"type":"object","required":["body","study_id"],"title":"SendSmsRequest"},"SendTestRequest":{"properties":{"study_id":{"type":"string","title":"Study Id"},"phone":{"type":"string","title":"Phone"},"first_name":{"type":"string","title":"First Name","default":"there"}},"type":"object","required":["study_id","phone"],"title":"SendTestRequest"},"SetAppointmentRequest":{"properties":{"study_id":{"type":"string","title":"Study Id"},"date":{"type":"string","title":"Date"},"time":{"type":"string","title":"Time"},"study_visit_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Study Visit Id"},"send_sms":{"type":"boolean","title":"Send Sms","default":false}},"type":"object","required":["study_id","date","time"],"title":"SetAppointmentRequest"},"SetHeaderRequest":{"properties":{"header_row_index":{"type":"integer","title":"Header Row Index"}},"type":"object","required":["header_row_index"],"title":"SetHeaderRequest"},"SetHeaderResponse":{"properties":{"source_id":{"type":"string","title":"Source Id"},"filename":{"type":"string","title":"Filename"},"row_count":{"type":"integer","title":"Row Count"},"columns":{"items":{"$ref":"#/components/schemas/ColumnInfo"},"type":"array","title":"Columns"},"preview_rows":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Preview Rows"},"missing_required":{"items":{"type":"string"},"type":"array","title":"Missing Required"},"missing_recommended":{"items":{"type":"string"},"type":"array","title":"Missing Recommended"},"auto_mapping":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","title":"Auto Mapping"},"duplicate_columns":{"items":{"type":"string"},"type":"array","title":"Duplicate Columns","default":[]}},"type":"object","required":["source_id","filename","row_count","columns","preview_rows","missing_required","missing_recommended","auto_mapping"],"title":"SetHeaderResponse"},"SimRequest":{"properties":{"study_id":{"type":"string","title":"Study Id"},"message":{"type":"string","title":"Message"},"history":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"History","default":[]},"first_name":{"type":"string","title":"First Name","default":"Alex"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},"type":"object","required":["study_id","message"],"title":"SimRequest"},"SpecPatchRequest":{"properties":{"policies":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Policies"},"steps":{"anyOf":[{"additionalProperties":{"additionalProperties":true,"type":"object"},"type":"object"},{"type":"null"}],"title":"Steps"}},"type":"object","title":"SpecPatchRequest"},"SpinOffRequest":{"properties":{"campaign_type":{"type":"string","title":"Campaign Type","default":"revival"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"include_untouched":{"type":"boolean","title":"Include Untouched","default":false},"min_attempts":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Min Attempts"},"max_attempts":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Attempts"},"channels_tried":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Channels Tried"}},"type":"object","title":"SpinOffRequest"},"StartCallsRequest":{"properties":{"patient_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Patient Ids"},"start_mode":{"type":"string","title":"Start Mode","default":"window"},"start_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start At"}},"type":"object","title":"StartCallsRequest"},"StartRequest":{"properties":{"action":{"type":"string","enum":["mark_done","ai_off","ai_on","do_not_call","do_not_text","pause_outreach","resume_outreach","restart_outreach","add_to_campaign","assign"],"title":"Action"},"params":{"$ref":"#/components/schemas/Params"},"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"total":{"type":"integer","maximum":5000.0,"minimum":1.0,"title":"Total"}},"type":"object","required":["action","total"],"title":"StartRequest"},"StateTransitionRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"new_status":{"type":"string","title":"New Status"}},"type":"object","required":["study_id","new_status"],"title":"StateTransitionRequest"},"StudyDefault":{"properties":{"mode":{"type":"string","enum":["study","campaign"],"title":"Mode","default":"study"},"campaign_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Campaign Id"},"allowed_campaign_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Allowed Campaign Ids"},"sites":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Sites"}},"additionalProperties":false,"type":"object","title":"StudyDefault"},"SwitchOrgRequest":{"properties":{"org_id":{"type":"string","title":"Org Id"}},"type":"object","required":["org_id"],"title":"SwitchOrgRequest"},"Target":{"properties":{"patient_id":{"type":"string","format":"uuid","title":"Patient Id"},"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"}},"type":"object","required":["patient_id"],"title":"Target"},"TestRequest":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"TestRequest"},"TestWebhookRequest":{"properties":{"webhook_url":{"type":"string","title":"Webhook Url"}},"type":"object","required":["webhook_url"],"title":"TestWebhookRequest"},"ToggleSharedRequest":{"properties":{"shared":{"type":"boolean","title":"Shared"}},"type":"object","required":["shared"],"title":"ToggleSharedRequest"},"TryRequest":{"properties":{"study_id":{"type":"string","format":"uuid","title":"Study Id"},"patient_id":{"type":"string","format":"uuid","title":"Patient Id"},"draft":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Draft"},"draft_level":{"type":"string","enum":["study","org"],"title":"Draft Level","default":"study"},"interaction_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Interaction Id"}},"type":"object","required":["study_id","patient_id"],"title":"TryRequest"},"UpdateConnectionRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"study_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Study Id"},"cadence_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Cadence Ids"},"field_mapping":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Field Mapping"},"destination":{"anyOf":[{"type":"string","enum":["intera","crio"]},{"type":"null"}],"title":"Destination"},"ctms_push":{"anyOf":[{"type":"string","enum":["off","on_arrival","on_qualified"]},{"type":"null"}],"title":"Ctms Push"},"sheet_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sheet Url"}},"additionalProperties":false,"type":"object","title":"UpdateConnectionRequest","description":"Only the fields sent are changed (retargeting: everything but the token).\n\n``cadence_ids`` replaces the whole list ([] or null clears it); ``sheet_url`` can be\ncleared with an explicit null, so \"was it sent\" comes from ``model_fields_set``.\nChanging ``study_id`` needs ``cadence_ids`` from the new study (or []) in the same\nrequest."},"UpdateLabelRequest":{"properties":{"label":{"type":"string","title":"Label"}},"type":"object","required":["label"],"title":"UpdateLabelRequest"},"UpdatePartnerConnectionRequest":{"properties":{"lead_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lead Format"},"allowed_study_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Allowed Study Ids"},"study_key_map":{"anyOf":[{"additionalProperties":{"type":"string","format":"uuid"},"type":"object"},{"type":"null"}],"title":"Study Key Map"},"study_defaults":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/StudyDefault"},"propertyNames":{"format":"uuid"},"type":"object"},{"type":"null"}],"title":"Study Defaults"},"default_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Timezone"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"additionalProperties":false,"type":"object","title":"UpdatePartnerConnectionRequest"},"UpdatePatientFlagsRequest":{"properties":{"do_not_call":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Do Not Call"},"do_not_text":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Do Not Text"}},"type":"object","title":"UpdatePatientFlagsRequest"},"UpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"spec":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Spec"},"include_dispositions":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Include Dispositions"},"selected_patient_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Selected Patient Ids"},"excluded_patient_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Excluded Patient Ids"},"filters":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Filters"}},"type":"object","title":"UpdateRequest"},"UpdateStudyRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"protocol_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Protocol Number"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"therapeutic_area":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Therapeutic Area"},"indication":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Indication"},"phase":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phase"},"sponsor_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sponsor Name"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"inclusion_criteria":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Inclusion Criteria"},"exclusion_criteria":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Exclusion Criteria"},"config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Config"},"crio_destination_study_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Crio Destination Study Id"},"expected_updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expected Updated At"}},"type":"object","title":"UpdateStudyRequest"},"UpsertGlobalRequest":{"properties":{"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url"},"teams_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teams Webhook Url"},"is_enabled":{"type":"boolean","title":"Is Enabled","default":true},"categories":{"items":{"type":"string"},"type":"array","title":"Categories","default":["qualified_patient","urgent_safety","escalation","inbound_leads"]}},"type":"object","title":"UpsertGlobalRequest"},"UpsertOrgRequest":{"properties":{"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url"},"teams_webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Teams Webhook Url"},"is_enabled":{"type":"boolean","title":"Is Enabled","default":true},"categories":{"items":{"type":"string"},"type":"array","title":"Categories","default":["qualified_patient","urgent_safety","escalation","inbound_leads"]}},"type":"object","title":"UpsertOrgRequest"},"ValidateRequest":{"properties":{"column_mapping":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","title":"Column Mapping"},"skip_rows":{"items":{"type":"integer"},"type":"array","title":"Skip Rows","default":[]}},"type":"object","required":["column_mapping"],"title":"ValidateRequest"},"ValidateResponse":{"properties":{"valid_count":{"type":"integer","title":"Valid Count"},"error_count":{"type":"integer","title":"Error Count"},"warning_count":{"type":"integer","title":"Warning Count"},"errors":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Errors"},"duplicate_groups":{"items":{"$ref":"#/components/schemas/DuplicateGroup"},"type":"array","title":"Duplicate Groups"},"column_report":{"additionalProperties":{"$ref":"#/components/schemas/ColumnReport"},"type":"object","title":"Column Report"}},"type":"object","required":["valid_count","error_count","warning_count","errors","duplicate_groups","column_report"],"title":"ValidateResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VapiCredentialRequest":{"properties":{"vapi_api_key":{"type":"string","title":"Vapi Api Key"},"vapi_org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vapi Org Id"},"environment":{"type":"string","title":"Environment","default":"production"}},"type":"object","required":["vapi_api_key"],"title":"VapiCredentialRequest"},"api__modules__admin__organizations__UpdateOrgRequest":{"properties":{"max_active_studies":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Active Studies"}},"type":"object","title":"UpdateOrgRequest"},"api__modules__assistant__ApplyRequest":{"properties":{"token":{"type":"string","maxLength":60000,"minLength":10,"title":"Token"},"confirmed":{"type":"boolean","title":"Confirmed","default":false},"chat_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Chat Id"}},"type":"object","required":["token"],"title":"ApplyRequest"},"api__modules__organizations__UpdateOrgRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Name"},"domain":{"anyOf":[{"type":"string","maxLength":253},{"type":"null"}],"title":"Domain"},"notification_emails":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Notification Emails"},"patient_facing_name":{"anyOf":[{"type":"string","maxLength":80},{"type":"null"}],"title":"Patient Facing Name"},"holiday_location":{"anyOf":[{"$ref":"#/components/schemas/OrgHolidayLocation"},{"type":"null"}]}},"type":"object","title":"UpdateOrgRequest"},"api__modules__patients__bulk__ApplyRequest":{"properties":{"targets":{"items":{"$ref":"#/components/schemas/Target"},"type":"array","maxItems":50,"minItems":1,"title":"Targets"}},"type":"object","required":["targets"],"title":"ApplyRequest"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}