{"openapi":"3.1.0","info":{"title":"StateSet Voice API - Admin","description":"Administrative StateSet Voice API endpoints for tenant management, control-plane configuration, diagnostics, authentication, and operator workflow maintenance.","contact":{"name":"StateSet Support","url":"https://stateset.com","email":"support@stateset.com"},"license":{"name":"BUSL-1.1","url":"https://mariadb.com/bsl11/"},"version":"0.1.0"},"servers":[{"url":"http://localhost:5050","description":"Local development"},{"url":"https://voice.stateset.app","description":"Production"},{"url":"https://voice-staging.stateset.com","description":"Staging"}],"paths":{"/api/v1/admin/alerts/auth-transport":{"get":{"tags":["admin"],"summary":"Get Auth Transport Alerts","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_auth_transport_alerts","responses":{"200":{"description":"Auth transport rollout alert status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAuthTransportAlertsResponse"},"example":{"alerts":[{"action":{},"code":{},"message":{},"severity":{}}],"count":123,"diagnostics":{"legacy_query_auth_enabled":true,"stream_auth_previous_configured":true,"stream_auth_primary_configured":true,"stream_auth_secret_count":123},"ok":true,"status":"string"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/api-access-requests":{"get":{"tags":["admin"],"summary":"List Api Access Requests","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_api_access_requests","parameters":[{"name":"status","in":"query","description":"Filter requests by review status.","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Maximum number of requests to return.","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"offset","in":"query","description":"Offset for pagination.","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"List Voice API access requests for team review","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminApiAccessRequestsResponse"},"example":{"count":123,"ok":true,"requests":[{"company_name":"Acme Health","contact_name":"Jordan Lee","created_at":"2026-05-14T20:15:00Z","expected_monthly_minutes":"10000-50000","id":"550e8400-e29b-41d4-a716-446655440000","metadata":{"submitted_from":"request_access_page"},"phone":"+15555550123","remote_addr":"203.0.113.10","reviewed_at":null,"role":"VP Operations","source":"voice_landing_page","status":"open","timeline":"30 days","use_case":"Inbound scheduling and missed-call recovery for regional clinics.","user_agent":"Mozilla/5.0","website":"https://acme.example","work_email":"jordan.lee@acme.example"}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Database not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/auth/login":{"post":{"tags":["admin"],"summary":"Admin Login","description":"Creates a browser admin session with the configured username and password credentials.","operationId":"admin_login","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminLoginRequest"},"example":{"password":"string","username":"string"}}},"required":true},"responses":{"200":{"description":"Create a browser admin session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminLoginResponse"},"example":{"ok":true,"username":"string"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}}}},"/api/v1/admin/auth/logout":{"post":{"tags":["admin"],"summary":"Admin Logout","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"admin_logout","responses":{"200":{"description":"Clear the browser admin session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSessionStatusResponse"},"example":{"authenticated":true,"login_enabled":true,"ok":true,"username":"string","workos_authorize_url":"string","workos_enabled":true}}}}},"security":[{"admin_session":[]},{"admin_key":[]}]}},"/api/v1/admin/auth/session":{"get":{"tags":["admin"],"summary":"Get Admin Session Status","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_admin_session_status","responses":{"200":{"description":"Browser admin session status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSessionStatusResponse"},"example":{"authenticated":true,"login_enabled":true,"ok":true,"username":"string","workos_authorize_url":"string","workos_enabled":true}}}}},"security":[{"admin_session":[]},{"admin_key":[]}]}},"/api/v1/admin/auth/transport":{"get":{"tags":["admin"],"summary":"Get Auth Transport Diagnostics","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_auth_transport_diagnostics","responses":{"200":{"description":"Auth transport diagnostics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAuthTransportResponse"},"example":{"auth_transport":{"legacy_query_auth_enabled":true,"stream_auth_previous_configured":true,"stream_auth_primary_configured":true,"stream_auth_secret_count":123},"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/callback-tasks":{"get":{"tags":["admin"],"summary":"List Callback Tasks Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_callback_tasks_admin","parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"$ref":"#/components/schemas/CallbackTaskStatus"}},{"name":"disposition","in":"query","required":false,"schema":{"$ref":"#/components/schemas/CallbackDisposition"}},{"name":"stream_sid","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"List callback workflow tasks across tenants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCallbackTasksResponse"},"example":{"count":123,"ok":true,"tasks":[{"acknowledged_at":{},"acknowledged_by":{},"agent_name":{},"assigned_to":{},"call_sid":{},"claimed_at":{},"completed_at":{},"created_at":{},"created_by":{},"customer_phone":{},"dispatch_attempt_count":{},"disposition":{},"due_at":{},"id":{},"last_dispatch_attempted_at":{},"last_dispatch_call_sid":{},"last_dispatch_status":{},"last_sla_alert_due_at":{},"last_sla_alerted_at":{},"metadata":{},"notes":{},"priority":{},"queue_key":{},"sla_due_at":{},"snooze_reason":{},"snoozed_until":{},"status":{},"stream_sid":{},"summary":{},"tenant_id":{},"updated_at":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Database not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/operator-queues/dispatch":{"post":{"tags":["admin"],"summary":"Dispatch Operator Callbacks Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"dispatch_operator_callbacks_admin","parameters":[{"name":"auth_token","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":0}},{"name":"emit_webhooks","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Auto-dispatch callback tasks from operator queues","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOperatorCallbackDispatchResponse"},"example":{"ok":true,"result":{"attempted_tenants":3,"dispatched_tasks":2,"dry_run_tasks":1,"eligible_tasks":5,"evaluated_tenants":3,"failures":[{}],"items":[{}]}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Database not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/operator-queues/external-reconciliation/sweep":{"post":{"tags":["admin"],"summary":"Sweep External Callback Task Reconciliation Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"sweep_external_callback_task_reconciliation_admin","parameters":[{"name":"auth_token","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":0}},{"name":"emit_webhooks","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Reconcile linked callback tasks with external ticket state","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminExternalCallbackTaskReconciliationResponse"},"example":{"ok":true,"result":{"attempted_tenants":3,"candidate_tasks":4,"evaluated_tenants":2,"failures":[{}],"items":[{}],"reconciled_tasks":3,"unchanged_tasks":1,"webhooks_enqueued":3}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Database not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/operator-queues/follow-up-notifications/sweep":{"post":{"tags":["admin"],"summary":"Sweep Operator Follow Up Notifications Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"sweep_operator_follow_up_notifications_admin","parameters":[{"name":"auth_token","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":0}},{"name":"emit_webhooks","in":"query","required":false,"schema":{"type":"boolean"}},{"name":"send_notifications","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Process operator follow-up reminders and snooze expiry wake-ups","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOperatorFollowUpNotificationResponse"},"example":{"ok":true,"result":{"attempted_tenants":3,"candidate_tasks":4,"escalations_applied":1,"evaluated_tenants":3,"failures":[{}],"items":[{}],"notifications_sent":2,"snoozes_expired":2,"webhooks_enqueued":3}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Database not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/operator-queues/sweep":{"post":{"tags":["admin"],"summary":"Sweep Operator Queues Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"sweep_operator_queues_admin","parameters":[{"name":"auth_token","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":0}},{"name":"emit_webhooks","in":"query","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Sweep callback task queues for SLA breaches","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOperatorQueueSweepResponse"},"example":{"ok":true,"result":{"alerts_recorded":2,"attempted_tenants":3,"evaluated_tenants":3,"failures":[{}],"items":[{}],"overdue_tasks":4,"webhooks_enqueued":2}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Database not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/outboxes/billing-outcomes/sweep":{"post":{"tags":["admin"],"summary":"Sweep Billing Outcome Outbox Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"sweep_billing_outcome_outbox_admin","parameters":[{"name":"limit","in":"query","description":"Maximum due rows to claim and deliver in this sweep.","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Trigger a billing outcome outbox delivery sweep","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminBillingOutcomeOutboxSweepResponse"},"example":{"attempted":123,"delivered":123,"failed":123,"ok":true,"rescheduled":123}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Billing outcome outbox delivery unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/outboxes/depth":{"get":{"tags":["admin"],"summary":"Get Outbox Depth Diagnostics","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_outbox_depth_diagnostics","responses":{"200":{"description":"Outbox delivery depth diagnostics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOutboxDepthResponse"},"example":{"count":123,"depths":[{"delivered":{},"failed":{},"pending":{},"table":{}}],"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Database-backed outbox diagnostics unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/rollout-governance/sweep":{"post":{"tags":["admin"],"summary":"Sweep Rollout Governance Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"sweep_rollout_governance_admin","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RolloutGovernanceSweepRequest"},"example":{"apply":true,"auth_token":"string","limit":123}}},"required":true},"responses":{"200":{"description":"Sweep rollout governance across tenants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRolloutGovernanceSweepResponse"},"example":{"ok":true,"result":{"attempted_agents":123,"attempted_tenants":123,"evaluated_agents":123,"evaluated_tenants":123,"failures":[{}],"items":[{}],"rollback_recommended":123,"rollbacks_applied":123}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Voice session evals repository unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/sessions":{"get":{"tags":["admin"],"summary":"List Active Sessions","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_active_sessions","responses":{"200":{"description":"List active sessions across cached tenants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSessionsResponse"},"example":{"count":123,"ok":true,"sessions":[{"agent_name":{},"call_type":{},"customer_phone":{},"escalated":{},"escalation_target":{},"greeting":{},"org_id":{},"started_at":{},"stream_sid":{},"tenant":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/supervisor-actions":{"get":{"tags":["admin"],"summary":"List Supervisor Actions Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_supervisor_actions_admin","parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"stream_sid","in":"query","required":false,"schema":{"type":"string"}},{"name":"action","in":"query","required":false,"schema":{"$ref":"#/components/schemas/SupervisorActionType"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"List durable supervisor actions across tenants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminSupervisorActionsResponse"},"example":{"actions":[{"action":{},"call_sid":{},"created_at":{},"id":{},"metadata":{},"note":{},"reason":{},"stream_sid":{},"supervisor":{},"target":{},"tenant_id":{}}],"count":123,"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Database not configured","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants":{"get":{"tags":["admin"],"summary":"List Tenants","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_tenants","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"List tenants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListTenantsResponse"},"example":{"count":123,"ok":true,"tenants":[{"config":{},"etag":{},"tenant_id":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/audio-providers":{"get":{"tags":["admin"],"summary":"Get Audio Provider Diagnostics","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_audio_provider_diagnostics","parameters":[{"name":"limit","in":"query","description":"Maximum number of diagnostics rows to return.","required":false,"schema":{"type":"integer","minimum":0}},{"name":"include_uncached","in":"query","description":"Include tenant configs from the backing store even when not currently cached.\n\nThis gives a broader operational view but may be more expensive than cache-only mode.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Audio provider diagnostics across cached tenants (and optionally uncached store entries)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAudioProviderDiagnosticsResponse"},"example":{"cached_tenants":123,"configured_elevenlabs":123,"configured_openai":123,"count":123,"effective_elevenlabs":123,"effective_openai":123,"evaluated_tenants":123,"fallback_active":123,"fallback_not_configured":123,"fallback_unavailable":123,"include_uncached_requested":true,"items":[{"active_sessions":{},"cached":{},"configured_provider":{},"effective_provider":{},"elevenlabs_configured":{},"elevenlabs_ready":{},"fallback_active":{},"fallback_reason":{},"tenant_id":{}}],"ok":true,"uncached_scan_supported":true,"uncached_tenants":123}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/cache-metrics":{"get":{"tags":["admin"],"summary":"Get Cache Metrics","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_cache_metrics","responses":{"200":{"description":"Tenant cache metrics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTenantCacheMetricsResponse"},"example":{"auth_transport":{"legacy_query_auth_enabled":true,"stream_auth_previous_configured":true,"stream_auth_primary_configured":true,"stream_auth_secret_count":123},"cache_entries":123,"evictions":123,"hits":123,"misses":123,"ok":true,"reloads":123}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/cache-metrics/by-token":{"get":{"tags":["admin"],"summary":"Get Cache Metrics By Token","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_cache_metrics_by_token","parameters":[{"name":"limit","in":"query","description":"Maximum number of token metrics entries to return.","required":false,"schema":{"type":"integer","minimum":0}}],"responses":{"200":{"description":"Tenant cache metrics by auth token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTenantTokenCacheMetricsResponse"},"example":{"count":123,"items":[{"cache_key":{},"cache_present":{},"evictions":{},"hits":{},"misses":{},"reloads":{},"tenant_id":{}}],"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/cached":{"get":{"tags":["admin"],"summary":"List Cached Tenants","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_cached_tenants","responses":{"200":{"description":"List cached tenants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCachedTenantsResponse"},"example":{"count":123,"ok":true,"tenants":[{"active_sessions":{},"audio_output_provider":{},"elevenlabs_configured":{},"elevenlabs_ready":{},"kafka_configured":{},"log_subscribers":{},"org_id":{},"tenant_id":{},"twilio_configured":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/evict-idle":{"post":{"tags":["admin"],"summary":"Evict Idle Tenants","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"evict_idle_tenants","parameters":[{"name":"max_idle_secs","in":"query","description":"Evict tenants that have been idle for more than this many seconds.","required":false,"schema":{"type":"integer","format":"int64","minimum":0}}],"responses":{"200":{"description":"Evict idle cached tenants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminEvictIdleResponse"},"example":{"evicted":123,"ok":true,"remaining":123}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/reload-cached":{"post":{"tags":["admin"],"summary":"Reload Cached Tenants","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"reload_cached_tenants","responses":{"200":{"description":"Reload cached tenants","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminReloadCachedTenantsResponse"},"example":{"attempted":123,"failures":[{"error":{},"tenant_id":{}}],"ok":true,"reloaded":123}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/validate":{"post":{"tags":["admin"],"summary":"Validate Tenant","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"validate_tenant","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantConfigDocument"},"example":{"model":"gpt-realtime","org_id":"org_123","system_prompt_key":"support_default","tenant_id":"tenant_123","twilio":{"account_sid":"AC1234567890abcdef1234567890abcdef","from_number":"+15555551234"},"voice":"alloy"}}},"required":true},"responses":{"200":{"description":"Tenant config is valid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateTenantResponse"},"example":{"error":"string","ok":true,"runtime":{"key":"value"}}}}},"400":{"description":"Invalid tenant config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}":{"get":{"tags":["admin"],"summary":"Get Tenant","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_tenant","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tenant config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResponse"},"example":{"config":{"key":"value"},"etag":"string","ok":true,"tenant_id":"string"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]},"put":{"tags":["admin"],"summary":"Upsert Tenant","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"upsert_tenant","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"if-match","in":"header","description":"Optional ETag precondition for optimistic concurrency","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantConfigDocument"},"example":{"model":"gpt-realtime","org_id":"org_123","system_prompt_key":"support_default","tenant_id":"tenant_123","twilio":{"account_sid":"AC1234567890abcdef1234567890abcdef","from_number":"+15555551234"},"voice":"alloy"}}},"required":true},"responses":{"200":{"description":"Tenant config updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantMutationResponse"},"example":{"ok":true,"tenant_id":"string"}}}},"400":{"description":"Invalid tenant config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"412":{"description":"Precondition failed (If-Match mismatch)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]},"delete":{"tags":["admin"],"summary":"Delete Tenant","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"delete_tenant","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tenant deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantMutationResponse"},"example":{"ok":true,"tenant_id":"string"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/agent-versions":{"get":{"tags":["admin"],"summary":"List Agent Versions","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_agent_versions","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"agent_id","in":"query","required":false,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"List agent versions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAgentVersionsResponse"},"example":{"count":123,"ok":true,"versions":[{"agent_id":{},"agent_key":{},"agent_name":{},"config":{},"created_at":{},"id":{},"published_at":{},"status":{},"tenant_id":{},"updated_at":{},"version_number":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]},"post":{"tags":["admin"],"summary":"Create Agent Version","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"create_agent_version","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentVersion"},"example":{"agent_id":"string","config":{"agent_name":"string","assistant_profile":"string","chat_model":"string","greeting":"string","instructions":"string","realtime_model":"string","voice":"string"}}}},"required":true},"responses":{"200":{"description":"Create an agent version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAgentVersionResponse"},"example":{"ok":true,"version":{"agent_id":"string","agent_key":"string","agent_name":"string","config":{},"created_at":"string","id":"string","published_at":"string","status":{},"tenant_id":"string","updated_at":"string","version_number":123}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/agent-versions/{version_id}/publish":{"post":{"tags":["admin"],"summary":"Publish Agent Version","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"publish_agent_version","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"version_id","in":"path","description":"Agent version id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Publish an agent version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAgentVersionResponse"},"example":{"ok":true,"version":{"agent_id":"string","agent_key":"string","agent_name":"string","config":{},"created_at":"string","id":"string","published_at":"string","status":{},"tenant_id":"string","updated_at":"string","version_number":123}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/agents":{"get":{"tags":["admin"],"summary":"List Agents","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_agents","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List configured agents for a tenant","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAgentsResponse"},"example":{"agents":[{"agent_key":{},"created_at":{},"description":{},"id":{},"name":{},"tenant_id":{},"updated_at":{}}],"count":123,"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]},"post":{"tags":["admin"],"summary":"Create Agent","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"create_agent","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgent"},"example":{"agent_key":"string","description":"string","name":"string"}}},"required":true},"responses":{"200":{"description":"Create an agent","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAgentResponse"},"example":{"agent":{"agent_key":"string","created_at":"string","description":"string","id":"string","name":"string","tenant_id":"string","updated_at":"string"},"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/agents/{agent_id}/rollout-governance/evaluate":{"post":{"tags":["admin"],"summary":"Evaluate Rollout Governance","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"evaluate_rollout_governance","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"agent_id","in":"path","description":"Agent id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvaluateRolloutGovernanceRequest"},"example":{"apply":true}}},"required":true},"responses":{"200":{"description":"Evaluate rollout governance policy against recent evals","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRolloutGovernanceEvaluationResponse"},"example":{"evaluation":{"agent_id":"string","agent_key":"string","agent_name":"string","applied":true,"policy":{},"published_version":{},"reasons":[{}],"rollout_versions":[{}],"status":"string"},"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"503":{"description":"Voice session evals repository unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/agents/{agent_id}/rollout-policy":{"get":{"tags":["admin"],"summary":"Get Rollout Governance Policy","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_rollout_governance_policy","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"agent_id","in":"path","description":"Agent id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Get rollout governance policy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRolloutGovernancePolicyResponse"},"example":{"ok":true,"policy":null}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]},"put":{"tags":["admin"],"summary":"Upsert Rollout Governance Policy","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"upsert_rollout_governance_policy","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"agent_id","in":"path","description":"Agent id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertRolloutGovernancePolicy"},"example":{"enabled":true,"lookback_hours":123,"min_avg_score":12.34,"min_eval_count":123,"min_high_quality_rate":12.34}}},"required":true},"responses":{"200":{"description":"Create or update rollout governance policy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminRolloutGovernancePolicyResponse"},"example":{"ok":true,"policy":null}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/agents/{agent_id}/rollouts":{"get":{"tags":["admin"],"summary":"List Agent Version Rollouts","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_agent_version_rollouts","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"agent_id","in":"path","description":"Agent id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List agent version rollout entries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAgentVersionRolloutsResponse"},"example":{"count":123,"ok":true,"rollouts":[{"agent_id":{},"agent_key":{},"agent_name":{},"agent_version_id":{},"created_at":{},"id":{},"position":{},"tenant_id":{},"traffic_percentage":{},"updated_at":{},"version_number":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]},"put":{"tags":["admin"],"summary":"Replace Agent Version Rollouts","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"replace_agent_version_rollouts","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"agent_id","in":"path","description":"Agent id","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplaceAgentVersionRollouts"},"example":{"entries":[{"agent_version_id":{},"traffic_percentage":{}}]}}},"required":true},"responses":{"200":{"description":"Replace agent version rollout entries","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAgentVersionRolloutsResponse"},"example":{"count":123,"ok":true,"rollouts":[{"agent_id":{},"agent_key":{},"agent_name":{},"agent_version_id":{},"created_at":{},"id":{},"position":{},"tenant_id":{},"traffic_percentage":{},"updated_at":{},"version_number":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/api-keys":{"get":{"tags":["admin"],"summary":"List Tenant Api Keys","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_tenant_api_keys","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List tenant API keys","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTenantApiKeysResponse"},"example":{"api_keys":[{"created_at":{},"id":{},"key_prefix":{},"label":{},"last_used_at":{},"revoked_at":{}}],"count":123,"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]},"post":{"tags":["admin"],"summary":"Create Tenant Api Key","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"create_tenant_api_key","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenantApiKey"},"example":{"label":"string"}}},"required":true},"responses":{"200":{"description":"Create a tenant API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCreatedTenantApiKeyResponse"},"example":{"created":{"api_key":{},"token":"string"},"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/api-keys/{key_id}":{"delete":{"tags":["admin"],"summary":"Revoke Tenant Api Key","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"revoke_tenant_api_key","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"key_id","in":"path","description":"Tenant API key ID","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Revoke a tenant API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTenantApiKeyResponse"},"example":{"api_key":{"created_at":"string","id":"string","key_prefix":"string","label":"string","last_used_at":"string","revoked_at":"string"},"ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/phone-number-routes":{"get":{"tags":["admin"],"summary":"List Phone Number Routes","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"list_phone_number_routes","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"List phone number routes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPhoneNumberRoutesResponse"},"example":{"count":123,"ok":true,"routes":[{"agent_id":{},"agent_key":{},"agent_name":{},"agent_version_id":{},"created_at":{},"direction":{},"greeting":{},"id":{},"phone_number":{},"resolved_agent_version_id":{},"resolved_version_number":{},"tenant_id":{},"updated_at":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]},"put":{"tags":["admin"],"summary":"Upsert Phone Number Route","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"upsert_phone_number_route","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertPhoneNumberRoute"},"example":{"agent_id":"string","agent_version_id":"string","direction":"inbound","greeting":"string","id":"string","phone_number":"string"}}},"required":true},"responses":{"200":{"description":"Create or update a phone number route","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPhoneNumberRouteResponse"},"example":{"ok":true,"route":{"agent_id":"string","agent_key":"string","agent_name":"string","agent_version_id":"string","created_at":"string","direction":{},"greeting":"string","id":"string","phone_number":"string","resolved_agent_version_id":"string","resolved_version_number":123,"tenant_id":"string","updated_at":"string"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/phone-number-routes/{route_id}":{"delete":{"tags":["admin"],"summary":"Delete Phone Number Route","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"delete_phone_number_route","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"route_id","in":"path","description":"Route id","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Delete a phone number route","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPhoneNumberRouteResponse"},"example":{"ok":true,"route":{"agent_id":"string","agent_key":"string","agent_name":"string","agent_version_id":"string","created_at":"string","direction":{},"greeting":"string","id":"string","phone_number":"string","resolved_agent_version_id":"string","resolved_version_number":123,"tenant_id":"string","updated_at":"string"}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/reload":{"post":{"tags":["admin"],"summary":"Reload Tenant","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"reload_tenant","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tenant reloaded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResponse"},"example":{"config":{"key":"value"},"etag":"string","ok":true,"tenant_id":"string"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/runtime":{"get":{"tags":["admin"],"summary":"Get Tenant Runtime","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_tenant_runtime","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tenant runtime config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResponse"},"example":{"config":{"key":"value"},"etag":"string","ok":true,"tenant_id":"string"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/tenants/{tenant_id}/runtime-config":{"put":{"tags":["admin"],"summary":"Update Tenant Runtime Config","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"update_tenant_runtime_config","parameters":[{"name":"tenant_id","in":"path","description":"Tenant identifier","required":true,"schema":{"type":"string"}},{"name":"if-match","in":"header","description":"Optional ETag precondition for optimistic concurrency","required":false,"schema":{"type":["string","null"]}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantRuntimeConfigPatch"},"example":{"model":"gpt-realtime","system_prompt_key":"support_default","twilio":{"from_number":"+15555551234"},"voice":"alloy"}}},"required":true},"responses":{"200":{"description":"Tenant runtime config patched and activated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantResponse"},"example":{"config":{"key":"value"},"etag":"string","ok":true,"tenant_id":"string"}}}},"400":{"description":"Invalid runtime config patch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"412":{"description":"Precondition failed (If-Match mismatch)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/twilio/webhook-diagnostics":{"get":{"tags":["admin"],"summary":"Get Twilio Webhook Diagnostics","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_twilio_webhook_diagnostics","responses":{"200":{"description":"Twilio webhook tenant-resolution diagnostics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTwilioWebhookDiagnosticsResponse"},"example":{"hint_cache":{"entries":123,"max_entries":123,"ttl_secs":123},"ok":true,"resolution":{"explicit_token_invalid":123,"explicit_token_success":123,"failures_total":123,"hint_cache_expired":123,"hint_cache_hit_rate":12.34,"hint_cache_hits":123,"hint_cache_lookups":123,"hint_cache_misses":123,"hint_cache_signature_mismatch":123,"hint_cache_stale_token":123,"requests_total":123,"signature_lookup_candidates_evaluated_total":123,"signature_lookup_not_found":123,"signature_lookup_success":123,"signature_lookup_tenant_load_error":123,"success_rate":12.34,"successes_total":123}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/twilio/webhook-diagnostics/cache/clear":{"post":{"tags":["admin"],"summary":"Clear Twilio Webhook Hint Cache Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"clear_twilio_webhook_hint_cache_admin","responses":{"200":{"description":"Clear Twilio webhook hint cache","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTwilioWebhookCacheClearResponse"},"example":{"hint_cache":{"entries":123,"max_entries":123,"ttl_secs":123},"ok":true,"removed_entries":123}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/twilio/webhook-diagnostics/counters/reset":{"post":{"tags":["admin"],"summary":"Reset Twilio Webhook Diagnostics Admin","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"reset_twilio_webhook_diagnostics_admin","parameters":[{"name":"clear_hint_cache","in":"query","description":"If true, also clears all hint-cache entries while resetting counters.","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"description":"Reset Twilio webhook diagnostics counters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTwilioWebhookResetCountersResponse"},"example":{"cleared_hint_cache":true,"hint_cache":{"entries":123,"max_entries":123,"ttl_secs":123},"ok":true,"removed_hint_cache_entries":123,"resolution":{"explicit_token_invalid":123,"explicit_token_success":123,"failures_total":123,"hint_cache_expired":123,"hint_cache_hit_rate":12.34,"hint_cache_hits":123,"hint_cache_lookups":123,"hint_cache_misses":123,"hint_cache_signature_mismatch":123,"hint_cache_stale_token":123,"requests_total":123,"signature_lookup_candidates_evaluated_total":123,"signature_lookup_not_found":123,"signature_lookup_success":123,"signature_lookup_tenant_load_error":123,"success_rate":12.34,"successes_total":123}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/api/v1/admin/voice-dashboard/bootstrap":{"get":{"tags":["admin"],"summary":"Get Voice Dashboard Bootstrap","description":"Administrative platform operation for tenant, agent, rollout, diagnostics, or queue management. Use the admin API key header or an authenticated admin browser session where supported.","operationId":"get_voice_dashboard_bootstrap","responses":{"200":{"description":"Bootstrap authenticated voice dashboard tenant context","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminVoiceDashboardBootstrapResponse"},"example":{"actor":"string","count":123,"ok":true,"tenants":[{"auth_token":{},"display_name":{},"org_id":{},"tenant_id":{}}]}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}},"404":{"description":"Not found (admin endpoints disabled)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminErrorResponse"},"example":{"error":"string","ok":true}}}}},"security":[{"admin_key":[]},{"admin_session":[]}]}},"/health":{"get":{"tags":["health"],"summary":"General health check endpoint","description":"Operational endpoint for status, liveness, readiness, tool metadata, or function diagnostics.","operationId":"health","responses":{"200":{"description":"Service health","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"},"example":{"activeSessions":3,"audioProviderFallback":false,"configuredAudioOutputProvider":"elevenlabs","effectiveAudioOutputProvider":"elevenlabs","elevenlabsConfigured":true,"elevenlabsReady":true,"ok":true,"org_id":"org-456","tenant":"tenant_acme_dental","tools":15,"uptime":3600}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"code":"VALIDATION_ERROR","details":{"field":"to","reason":"required"},"error":"Invalid request: missing required field 'to'","request_id":"req-abc123-def456","success":false}}}}},"security":[{"bearer_auth":[]}]}},"/health/live":{"get":{"tags":["health"],"summary":"Liveness probe — indicates if the application's tokio runtime is alive.","description":"Backed by [`RuntimeWatchdog`](crate::utils::runtime_health::RuntimeWatchdog):\na heartbeat task ticks once per second; this handler verifies the gap\nhas not grown past the staleness threshold. If the runtime is wedged\n(deadlock, worker starvation, panic in the heartbeat task) we return\n503 so Kubernetes restarts the pod rather than leaving it hung but\nanswering 200s.\n\nReturns 200 with the most recent staleness in JSON, or 503 with the\nsame shape when the runtime appears stuck.","operationId":"liveness","responses":{"200":{"description":"Tokio runtime is responsive"},"503":{"description":"Runtime watchdog is stale; pod should be restarted"}}}},"/health/ready":{"get":{"tags":["health"],"summary":"Readiness probe - indicates if the application is ready to serve traffic","description":"Returns 200 if ready, 503 if not ready (e.g., during startup, maintenance).\nKubernetes uses this to determine if traffic should be routed to this pod.","operationId":"readiness","responses":{"200":{"description":"Service is ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadinessResponse"},"example":{"checks":[{"details":{"latency_ms":12},"name":"database","ready":true,"status":"connected"},{"details":{"brokers":3},"name":"kafka","ready":true,"status":"connected"},{"details":{},"name":"twilio","ready":true,"status":"configured"}],"ready":true,"status":"ready","timestamp":"2026-05-14T17:40:00Z","uptime_seconds":3600,"version":"0.1.0"}}}},"503":{"description":"Service is not ready","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReadinessResponse"},"example":{"checks":[{"details":{"latency_ms":12},"name":"database","ready":true,"status":"connected"},{"details":{"brokers":3},"name":"kafka","ready":true,"status":"connected"},{"details":{},"name":"twilio","ready":true,"status":"configured"}],"ready":true,"status":"ready","timestamp":"2026-05-14T17:40:00Z","uptime_seconds":3600,"version":"0.1.0"}}}}}}}},"components":{"schemas":{"AcknowledgeCallbackTaskRequest":{"type":"object","description":"AcknowledgeCallbackTaskRequest schema used by the StateSet Voice API.","required":["operator"],"properties":{"note":{"type":["string","null"]},"operator":{"type":"string"}}},"AdminAgentResponse":{"type":"object","description":"AdminAgentResponse schema used by the StateSet Voice API.","required":["ok","agent"],"properties":{"agent":{"$ref":"#/components/schemas/Agent"},"ok":{"type":"boolean"}}},"AdminAgentVersionResponse":{"type":"object","description":"AdminAgentVersionResponse schema used by the StateSet Voice API.","required":["ok","version"],"properties":{"ok":{"type":"boolean"},"version":{"$ref":"#/components/schemas/AgentVersion"}}},"AdminAgentVersionRolloutsResponse":{"type":"object","description":"AdminAgentVersionRolloutsResponse schema used by the StateSet Voice API.","required":["ok","count","rollouts"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"rollouts":{"type":"array","items":{"$ref":"#/components/schemas/AgentVersionRollout"}}}},"AdminAgentVersionsResponse":{"type":"object","description":"AdminAgentVersionsResponse schema used by the StateSet Voice API.","required":["ok","count","versions"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"versions":{"type":"array","items":{"$ref":"#/components/schemas/AgentVersion"}}}},"AdminAgentsResponse":{"type":"object","description":"AdminAgentsResponse schema used by the StateSet Voice API.","required":["ok","count","agents"],"properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/Agent"}},"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"}}},"AdminApiAccessRequestsResponse":{"type":"object","description":"AdminApiAccessRequestsResponse schema used by the StateSet Voice API.","required":["ok","count","requests"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"requests":{"type":"array","items":{"$ref":"#/components/schemas/ApiAccessRequest"}}}},"AdminAudioProviderDiagnosticsItem":{"type":"object","description":"AdminAudioProviderDiagnosticsItem schema used by the StateSet Voice API.","required":["tenant_id","cached","configured_provider","effective_provider","fallback_active","elevenlabs_configured","elevenlabs_ready","active_sessions"],"properties":{"active_sessions":{"type":"integer","minimum":0},"cached":{"type":"boolean"},"configured_provider":{"type":"string"},"effective_provider":{"type":"string"},"elevenlabs_configured":{"type":"boolean"},"elevenlabs_ready":{"type":"boolean"},"fallback_active":{"type":"boolean"},"fallback_reason":{"type":["string","null"]},"tenant_id":{"type":"string"}}},"AdminAudioProviderDiagnosticsResponse":{"type":"object","description":"AdminAudioProviderDiagnosticsResponse schema used by the StateSet Voice API.","required":["ok","cached_tenants","uncached_tenants","evaluated_tenants","include_uncached_requested","uncached_scan_supported","configured_openai","configured_elevenlabs","effective_openai","effective_elevenlabs","fallback_active","fallback_not_configured","fallback_unavailable","count","items"],"properties":{"cached_tenants":{"type":"integer","minimum":0},"configured_elevenlabs":{"type":"integer","minimum":0},"configured_openai":{"type":"integer","minimum":0},"count":{"type":"integer","minimum":0},"effective_elevenlabs":{"type":"integer","minimum":0},"effective_openai":{"type":"integer","minimum":0},"evaluated_tenants":{"type":"integer","minimum":0},"fallback_active":{"type":"integer","minimum":0},"fallback_not_configured":{"type":"integer","minimum":0},"fallback_unavailable":{"type":"integer","minimum":0},"include_uncached_requested":{"type":"boolean"},"items":{"type":"array","items":{"$ref":"#/components/schemas/AdminAudioProviderDiagnosticsItem"}},"ok":{"type":"boolean"},"uncached_scan_supported":{"type":"boolean"},"uncached_tenants":{"type":"integer","minimum":0}}},"AdminAuthTransportAlert":{"type":"object","description":"AdminAuthTransportAlert schema used by the StateSet Voice API.","required":["severity","code","message","action"],"properties":{"action":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"},"severity":{"type":"string"}}},"AdminAuthTransportAlertsResponse":{"type":"object","description":"AdminAuthTransportAlertsResponse schema used by the StateSet Voice API.","required":["ok","status","diagnostics","count","alerts"],"properties":{"alerts":{"type":"array","items":{"$ref":"#/components/schemas/AdminAuthTransportAlert"}},"count":{"type":"integer","minimum":0},"diagnostics":{"$ref":"#/components/schemas/AdminAuthTransportDiagnostics"},"ok":{"type":"boolean"},"status":{"type":"string"}}},"AdminAuthTransportDiagnostics":{"type":"object","description":"AdminAuthTransportDiagnostics schema used by the StateSet Voice API.","required":["legacy_query_auth_enabled","stream_auth_primary_configured","stream_auth_previous_configured","stream_auth_secret_count"],"properties":{"legacy_query_auth_enabled":{"type":"boolean"},"stream_auth_previous_configured":{"type":"boolean"},"stream_auth_primary_configured":{"type":"boolean"},"stream_auth_secret_count":{"type":"integer","minimum":0}}},"AdminAuthTransportResponse":{"type":"object","description":"AdminAuthTransportResponse schema used by the StateSet Voice API.","required":["ok","auth_transport"],"properties":{"auth_transport":{"$ref":"#/components/schemas/AdminAuthTransportDiagnostics"},"ok":{"type":"boolean"}}},"AdminBillingOutcomeOutboxSweepResponse":{"type":"object","description":"AdminBillingOutcomeOutboxSweepResponse schema used by the StateSet Voice API.","required":["ok","attempted","delivered","rescheduled","failed"],"properties":{"attempted":{"type":"integer","minimum":0},"delivered":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"rescheduled":{"type":"integer","minimum":0}}},"AdminCachedTenantItem":{"type":"object","description":"AdminCachedTenantItem schema used by the StateSet Voice API.","required":["tenant_id","audio_output_provider","active_sessions","log_subscribers","elevenlabs_configured","elevenlabs_ready","twilio_configured","kafka_configured"],"properties":{"active_sessions":{"type":"integer","minimum":0},"audio_output_provider":{"type":"string"},"elevenlabs_configured":{"type":"boolean"},"elevenlabs_ready":{"type":"boolean"},"kafka_configured":{"type":"boolean"},"log_subscribers":{"type":"integer","minimum":0},"org_id":{"type":["string","null"]},"tenant_id":{"type":"string"},"twilio_configured":{"type":"boolean"}}},"AdminCachedTenantsResponse":{"type":"object","description":"AdminCachedTenantsResponse schema used by the StateSet Voice API.","required":["ok","count","tenants"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"tenants":{"type":"array","items":{"$ref":"#/components/schemas/AdminCachedTenantItem"}}}},"AdminCallbackTasksResponse":{"type":"object","description":"AdminCallbackTasksResponse schema used by the StateSet Voice API.","required":["ok","count","tasks"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"tasks":{"type":"array","items":{"$ref":"#/components/schemas/CallbackTask"}}}},"AdminCreatedTenantApiKeyResponse":{"type":"object","description":"AdminCreatedTenantApiKeyResponse schema used by the StateSet Voice API.","required":["ok","created"],"properties":{"created":{"$ref":"#/components/schemas/CreatedTenantApiKey"},"ok":{"type":"boolean"}}},"AdminErrorResponse":{"type":"object","description":"AdminErrorResponse schema used by the StateSet Voice API.","required":["ok","error"],"properties":{"error":{"type":"string"},"ok":{"type":"boolean"}}},"AdminEvictIdleResponse":{"type":"object","description":"AdminEvictIdleResponse schema used by the StateSet Voice API.","required":["ok","evicted","remaining"],"properties":{"evicted":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"remaining":{"type":"integer","minimum":0}}},"AdminExternalCallbackTaskReconciliationResponse":{"type":"object","description":"AdminExternalCallbackTaskReconciliationResponse schema used by the StateSet Voice API.","required":["ok","result"],"properties":{"ok":{"type":"boolean"},"result":{"$ref":"#/components/schemas/ExternalCallbackTaskReconciliationResult"}}},"AdminLoginRequest":{"type":"object","description":"AdminLoginRequest schema used by the StateSet Voice API.","required":["username","password"],"properties":{"password":{"type":"string"},"username":{"type":"string"}}},"AdminLoginResponse":{"type":"object","description":"AdminLoginResponse schema used by the StateSet Voice API.","required":["ok","username"],"properties":{"ok":{"type":"boolean"},"username":{"type":"string"}}},"AdminOperatorCallbackDispatchResponse":{"type":"object","description":"AdminOperatorCallbackDispatchResponse schema used by the StateSet Voice API.","required":["ok","result"],"properties":{"ok":{"type":"boolean"},"result":{"$ref":"#/components/schemas/OperatorCallbackDispatchResult"}}},"AdminOperatorFollowUpNotificationResponse":{"type":"object","description":"AdminOperatorFollowUpNotificationResponse schema used by the StateSet Voice API.","required":["ok","result"],"properties":{"ok":{"type":"boolean"},"result":{"$ref":"#/components/schemas/OperatorFollowUpNotificationResult"}}},"AdminOperatorQueueSweepResponse":{"type":"object","description":"AdminOperatorQueueSweepResponse schema used by the StateSet Voice API.","required":["ok","result"],"properties":{"ok":{"type":"boolean"},"result":{"$ref":"#/components/schemas/OperatorQueueSweepResult"}}},"AdminOutboxDepthResponse":{"type":"object","description":"AdminOutboxDepthResponse schema used by the StateSet Voice API.","required":["ok","count","depths"],"properties":{"count":{"type":"integer","minimum":0},"depths":{"type":"array","items":{"$ref":"#/components/schemas/OutboxDepthSnapshot"}},"ok":{"type":"boolean"}}},"AdminPhoneNumberRouteResponse":{"type":"object","description":"AdminPhoneNumberRouteResponse schema used by the StateSet Voice API.","required":["ok","route"],"properties":{"ok":{"type":"boolean"},"route":{"$ref":"#/components/schemas/PhoneNumberRoute"}}},"AdminPhoneNumberRoutesResponse":{"type":"object","description":"AdminPhoneNumberRoutesResponse schema used by the StateSet Voice API.","required":["ok","count","routes"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"routes":{"type":"array","items":{"$ref":"#/components/schemas/PhoneNumberRoute"}}}},"AdminReloadCachedFailure":{"type":"object","description":"AdminReloadCachedFailure schema used by the StateSet Voice API.","required":["tenant_id","error"],"properties":{"error":{"type":"string"},"tenant_id":{"type":"string"}}},"AdminReloadCachedTenantsResponse":{"type":"object","description":"AdminReloadCachedTenantsResponse schema used by the StateSet Voice API.","required":["ok","attempted","reloaded","failures"],"properties":{"attempted":{"type":"integer","minimum":0},"failures":{"type":"array","items":{"$ref":"#/components/schemas/AdminReloadCachedFailure"}},"ok":{"type":"boolean"},"reloaded":{"type":"integer","minimum":0}}},"AdminRolloutGovernanceEvaluationResponse":{"type":"object","description":"AdminRolloutGovernanceEvaluationResponse schema used by the StateSet Voice API.","required":["ok","evaluation"],"properties":{"evaluation":{"$ref":"#/components/schemas/RolloutGovernanceEvaluation"},"ok":{"type":"boolean"}}},"AdminRolloutGovernancePolicyResponse":{"type":"object","description":"AdminRolloutGovernancePolicyResponse schema used by the StateSet Voice API.","required":["ok"],"properties":{"ok":{"type":"boolean"},"policy":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/RolloutGovernancePolicy"}]}}},"AdminRolloutGovernanceSweepResponse":{"type":"object","description":"AdminRolloutGovernanceSweepResponse schema used by the StateSet Voice API.","required":["ok","result"],"properties":{"ok":{"type":"boolean"},"result":{"$ref":"#/components/schemas/RolloutGovernanceSweepResult"}}},"AdminSessionInfo":{"type":"object","description":"AdminSessionInfo schema used by the StateSet Voice API.","required":["tenant","stream_sid","started_at","escalated"],"properties":{"agent_name":{"type":["string","null"],"description":"AI agent name (optional)"},"call_type":{"type":["string","null"],"description":"Type of call (inbound/outbound/sip_inbound/etc)"},"customer_phone":{"type":["string","null"],"description":"Customer's phone number (optional)"},"escalated":{"type":"boolean","description":"Whether the session has been escalated to a human"},"escalation_target":{"type":["string","null"],"description":"Escalation target (optional)"},"greeting":{"type":["string","null"],"description":"Greeting message (optional)"},"org_id":{"type":["string","null"],"description":"Organization ID (optional)"},"started_at":{"type":"string","description":"Session start time (ISO 8601)"},"stream_sid":{"type":"string","description":"Unique stream SID from Twilio"},"tenant":{"type":"string","description":"Tenant ID that owns this session"}}},"AdminSessionStatusResponse":{"type":"object","description":"AdminSessionStatusResponse schema used by the StateSet Voice API.","required":["ok","login_enabled","workos_enabled","authenticated"],"properties":{"authenticated":{"type":"boolean"},"login_enabled":{"type":"boolean"},"ok":{"type":"boolean"},"username":{"type":["string","null"]},"workos_authorize_url":{"type":["string","null"]},"workos_enabled":{"type":"boolean"}}},"AdminSessionsResponse":{"type":"object","description":"AdminSessionsResponse schema used by the StateSet Voice API.","required":["ok","count","sessions"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/AdminSessionInfo"}}}},"AdminSupervisorActionsResponse":{"type":"object","description":"AdminSupervisorActionsResponse schema used by the StateSet Voice API.","required":["ok","count","actions"],"properties":{"actions":{"type":"array","items":{"$ref":"#/components/schemas/SupervisorActionLog"}},"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"}}},"AdminTenantApiKeyResponse":{"type":"object","description":"AdminTenantApiKeyResponse schema used by the StateSet Voice API.","required":["ok","api_key"],"properties":{"api_key":{"$ref":"#/components/schemas/TenantApiKeyMetadata"},"ok":{"type":"boolean"}}},"AdminTenantApiKeysResponse":{"type":"object","description":"AdminTenantApiKeysResponse schema used by the StateSet Voice API.","required":["ok","count","api_keys"],"properties":{"api_keys":{"type":"array","items":{"$ref":"#/components/schemas/TenantApiKeyMetadata"}},"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"}}},"AdminTenantCacheMetricsResponse":{"type":"object","description":"AdminTenantCacheMetricsResponse schema used by the StateSet Voice API.","required":["ok","cache_entries","hits","misses","reloads","evictions","auth_transport"],"properties":{"auth_transport":{"$ref":"#/components/schemas/AdminAuthTransportDiagnostics"},"cache_entries":{"type":"integer","minimum":0},"evictions":{"type":"integer","format":"int64","minimum":0},"hits":{"type":"integer","format":"int64","minimum":0},"misses":{"type":"integer","format":"int64","minimum":0},"ok":{"type":"boolean"},"reloads":{"type":"integer","format":"int64","minimum":0}}},"AdminTenantItem":{"type":"object","description":"AdminTenantItem schema used by the StateSet Voice API.","required":["tenant_id","etag","config"],"properties":{"config":{},"etag":{"type":"string"},"tenant_id":{"type":"string"}}},"AdminTenantTokenCacheMetricsItem":{"type":"object","description":"AdminTenantTokenCacheMetricsItem schema used by the StateSet Voice API.","required":["cache_key","cache_present","hits","misses","reloads","evictions"],"properties":{"cache_key":{"type":"string"},"cache_present":{"type":"boolean"},"evictions":{"type":"integer","format":"int64","minimum":0},"hits":{"type":"integer","format":"int64","minimum":0},"misses":{"type":"integer","format":"int64","minimum":0},"reloads":{"type":"integer","format":"int64","minimum":0},"tenant_id":{"type":["string","null"]}}},"AdminTenantTokenCacheMetricsResponse":{"type":"object","description":"AdminTenantTokenCacheMetricsResponse schema used by the StateSet Voice API.","required":["ok","count","items"],"properties":{"count":{"type":"integer","minimum":0},"items":{"type":"array","items":{"$ref":"#/components/schemas/AdminTenantTokenCacheMetricsItem"}},"ok":{"type":"boolean"}}},"AdminTwilioWebhookCacheClearResponse":{"type":"object","description":"AdminTwilioWebhookCacheClearResponse schema used by the StateSet Voice API.","required":["ok","removed_entries","hint_cache"],"properties":{"hint_cache":{"$ref":"#/components/schemas/AdminTwilioWebhookHintCacheDiagnostics"},"ok":{"type":"boolean"},"removed_entries":{"type":"integer","minimum":0}}},"AdminTwilioWebhookDiagnosticsResponse":{"type":"object","description":"AdminTwilioWebhookDiagnosticsResponse schema used by the StateSet Voice API.","required":["ok","hint_cache","resolution"],"properties":{"hint_cache":{"$ref":"#/components/schemas/AdminTwilioWebhookHintCacheDiagnostics"},"ok":{"type":"boolean"},"resolution":{"$ref":"#/components/schemas/AdminTwilioWebhookResolutionDiagnostics"}}},"AdminTwilioWebhookHintCacheDiagnostics":{"type":"object","description":"AdminTwilioWebhookHintCacheDiagnostics schema used by the StateSet Voice API.","required":["entries","max_entries","ttl_secs"],"properties":{"entries":{"type":"integer","minimum":0},"max_entries":{"type":"integer","minimum":0},"ttl_secs":{"type":"integer","format":"int64","minimum":0}}},"AdminTwilioWebhookResetCountersResponse":{"type":"object","description":"AdminTwilioWebhookResetCountersResponse schema used by the StateSet Voice API.","required":["ok","cleared_hint_cache","removed_hint_cache_entries","hint_cache","resolution"],"properties":{"cleared_hint_cache":{"type":"boolean"},"hint_cache":{"$ref":"#/components/schemas/AdminTwilioWebhookHintCacheDiagnostics"},"ok":{"type":"boolean"},"removed_hint_cache_entries":{"type":"integer","minimum":0},"resolution":{"$ref":"#/components/schemas/AdminTwilioWebhookResolutionDiagnostics"}}},"AdminTwilioWebhookResolutionDiagnostics":{"type":"object","description":"AdminTwilioWebhookResolutionDiagnostics schema used by the StateSet Voice API.","required":["requests_total","successes_total","failures_total","success_rate","explicit_token_success","explicit_token_invalid","hint_cache_lookups","hint_cache_hits","hint_cache_misses","hint_cache_expired","hint_cache_signature_mismatch","hint_cache_stale_token","hint_cache_hit_rate","signature_lookup_success","signature_lookup_tenant_load_error","signature_lookup_not_found","signature_lookup_candidates_evaluated_total"],"properties":{"explicit_token_invalid":{"type":"integer","format":"int64","minimum":0},"explicit_token_success":{"type":"integer","format":"int64","minimum":0},"failures_total":{"type":"integer","format":"int64","minimum":0},"hint_cache_expired":{"type":"integer","format":"int64","minimum":0},"hint_cache_hit_rate":{"type":"number","format":"double"},"hint_cache_hits":{"type":"integer","format":"int64","minimum":0},"hint_cache_lookups":{"type":"integer","format":"int64","minimum":0},"hint_cache_misses":{"type":"integer","format":"int64","minimum":0},"hint_cache_signature_mismatch":{"type":"integer","format":"int64","minimum":0},"hint_cache_stale_token":{"type":"integer","format":"int64","minimum":0},"requests_total":{"type":"integer","format":"int64","minimum":0},"signature_lookup_candidates_evaluated_total":{"type":"integer","format":"int64","minimum":0},"signature_lookup_not_found":{"type":"integer","format":"int64","minimum":0},"signature_lookup_success":{"type":"integer","format":"int64","minimum":0},"signature_lookup_tenant_load_error":{"type":"integer","format":"int64","minimum":0},"success_rate":{"type":"number","format":"double"},"successes_total":{"type":"integer","format":"int64","minimum":0}}},"AdminVoiceDashboardBootstrapResponse":{"type":"object","description":"AdminVoiceDashboardBootstrapResponse schema used by the StateSet Voice API.","required":["ok","actor","count","tenants"],"properties":{"actor":{"type":"string"},"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"tenants":{"type":"array","items":{"$ref":"#/components/schemas/AdminVoiceDashboardTenant"}}}},"AdminVoiceDashboardTenant":{"type":"object","description":"AdminVoiceDashboardTenant schema used by the StateSet Voice API.","required":["tenant_id","auth_token"],"properties":{"auth_token":{"type":"string"},"display_name":{"type":["string","null"]},"org_id":{"type":["string","null"]},"tenant_id":{"type":"string"}}},"Agent":{"type":"object","description":"Agent schema used by the StateSet Voice API.","required":["id","tenant_id","agent_key","name","created_at","updated_at"],"properties":{"agent_key":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"description":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"tenant_id":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"AgentVersion":{"type":"object","description":"AgentVersion schema used by the StateSet Voice API.","required":["id","agent_id","tenant_id","agent_key","agent_name","version_number","status","config","created_at","updated_at"],"properties":{"agent_id":{"type":"string","format":"uuid"},"agent_key":{"type":"string"},"agent_name":{"type":"string"},"config":{"$ref":"#/components/schemas/AgentVersionConfig"},"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"published_at":{"type":["string","null"],"format":"date-time"},"status":{"$ref":"#/components/schemas/AgentVersionStatus"},"tenant_id":{"type":"string"},"updated_at":{"type":"string","format":"date-time"},"version_number":{"type":"integer","format":"int32"}}},"AgentVersionConfig":{"type":"object","description":"AgentVersionConfig schema used by the StateSet Voice API.","properties":{"agent_name":{"type":["string","null"]},"assistant_profile":{"type":["string","null"]},"chat_model":{"type":["string","null"]},"greeting":{"type":["string","null"]},"instructions":{"type":["string","null"]},"realtime_model":{"type":["string","null"]},"voice":{"type":["string","null"]}}},"AgentVersionEvalStats":{"type":"object","description":"AgentVersionEvalStats schema used by the StateSet Voice API.","required":["agent_version_id","agent_key","agent_name","version_number","eval_count"],"properties":{"agent_key":{"type":"string"},"agent_name":{"type":"string"},"agent_version_id":{"type":"string","format":"uuid"},"avg_score":{"type":["number","null"],"format":"double"},"eval_count":{"type":"integer","format":"int64","minimum":0},"high_quality_rate":{"type":["number","null"],"format":"double"},"last_eval_at":{"type":["string","null"],"format":"date-time"},"version_number":{"type":"integer","format":"int32"}}},"AgentVersionRollout":{"type":"object","description":"AgentVersionRollout schema used by the StateSet Voice API.","required":["id","tenant_id","agent_id","agent_version_id","agent_key","agent_name","version_number","traffic_percentage","position","created_at","updated_at"],"properties":{"agent_id":{"type":"string","format":"uuid"},"agent_key":{"type":"string"},"agent_name":{"type":"string"},"agent_version_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"position":{"type":"integer","format":"int32"},"tenant_id":{"type":"string"},"traffic_percentage":{"type":"integer","format":"int32"},"updated_at":{"type":"string","format":"date-time"},"version_number":{"type":"integer","format":"int32"}}},"AgentVersionStatus":{"type":"string","description":"AgentVersionStatus schema used by the StateSet Voice API.","enum":["draft","published"]},"AnsweredBy":{"type":"string","description":"Twilio's answering-machine detection result (`AnsweredBy` webhook field).\nPopulated only when a call was originated with `MachineDetection` enabled.","enum":["human","machine_start","machine_end_beep","machine_end_silence","machine_end_other","fax","unknown"]},"ApiAccessRequest":{"type":"object","description":"Prospective customer request for StateSet Voice API access.","required":["id","company_name","contact_name","work_email","use_case","status","source","metadata","created_at"],"properties":{"company_name":{"type":"string","description":"Company requesting access.","example":"Acme Health"},"contact_name":{"type":"string","description":"Primary contact name.","example":"Jordan Lee"},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp.","example":"2026-05-14T20:15:00Z"},"expected_monthly_minutes":{"type":["string","null"],"description":"Expected monthly call volume or minutes.","example":"10000-50000"},"id":{"type":"string","description":"Request identifier.","example":"550e8400-e29b-41d4-a716-446655440000"},"metadata":{"description":"Additional request metadata."},"phone":{"type":["string","null"],"description":"Optional contact phone number.","example":"+15555550123"},"remote_addr":{"type":["string","null"],"description":"Client address when available from trusted proxy metadata.","example":"203.0.113.10"},"reviewed_at":{"type":["string","null"],"format":"date-time","description":"Review timestamp when the team has processed the request.","example":"2026-05-14T21:00:00Z"},"role":{"type":["string","null"],"description":"Contact role or title.","example":"VP Operations"},"source":{"type":"string","description":"Submission source.","example":"voice_landing_page"},"status":{"type":"string","description":"Review status.","example":"open"},"timeline":{"type":["string","null"],"description":"Desired evaluation or production timeline.","example":"30 days"},"use_case":{"type":"string","description":"Business workflow the prospect wants to build with the Voice API.","example":"Inbound scheduling and missed-call recovery for regional clinics."},"user_agent":{"type":["string","null"],"description":"Browser user agent captured at submission.","example":"Mozilla/5.0"},"website":{"type":["string","null"],"description":"Company website.","example":"https://acme.example"},"work_email":{"type":"string","description":"Business email address for provisioning follow-up.","example":"jordan.lee@acme.example"}},"example":{"company_name":"Acme Health","contact_name":"Jordan Lee","created_at":"2026-05-14T20:15:00Z","expected_monthly_minutes":"10000-50000","id":"550e8400-e29b-41d4-a716-446655440000","metadata":{"submitted_from":"request_access_page"},"phone":"+15555550123","remote_addr":"203.0.113.10","reviewed_at":null,"role":"VP Operations","source":"voice_landing_page","status":"open","timeline":"30 days","use_case":"Inbound scheduling and missed-call recovery for regional clinics.","user_agent":"Mozilla/5.0","website":"https://acme.example","work_email":"jordan.lee@acme.example"}},"ApiAccessRequestErrorResponse":{"type":"object","description":"API access request validation or intake error.","required":["ok","error"],"properties":{"error":{"type":"string","description":"Error message safe to display to the requester.","example":"work_email must be a valid business email"},"ok":{"type":"boolean","description":"Whether the request succeeded.","example":false}},"example":{"error":"work_email must be a valid business email","ok":false}},"ApiAccessRequestInput":{"type":"object","description":"Request StateSet Voice API access for a prospective customer or partner.","required":["company_name","contact_name","work_email","use_case"],"properties":{"company_name":{"type":"string","description":"Company requesting Voice API access.","example":"Acme Health"},"company_website_confirm":{"type":["string","null"],"description":"Honeypot field. Leave blank.","example":""},"contact_name":{"type":"string","description":"Primary business contact.","example":"Jordan Lee"},"expected_monthly_minutes":{"type":["string","null"],"description":"Expected monthly call volume or minutes.","example":"10000-50000"},"phone":{"type":["string","null"],"description":"Optional contact phone.","example":"+15555550123"},"role":{"type":["string","null"],"description":"Contact title or role.","example":"VP Operations"},"timeline":{"type":["string","null"],"description":"Desired evaluation or production timeline.","example":"30 days"},"use_case":{"type":"string","description":"Business workflow the prospect wants to build.","example":"Inbound scheduling and missed-call recovery for regional clinics."},"website":{"type":["string","null"],"description":"Company website.","example":"https://acme.example"},"work_email":{"type":"string","description":"Business email address for provisioning follow-up.","example":"jordan.lee@acme.example"}},"example":{"company_name":"Acme Health","company_website_confirm":"","contact_name":"Jordan Lee","expected_monthly_minutes":"10000-50000","phone":"+15555550123","role":"VP Operations","timeline":"30 days","use_case":"Inbound scheduling and missed-call recovery for regional clinics.","website":"https://acme.example","work_email":"jordan.lee@acme.example"}},"ApiAccessRequestSubmitResponse":{"type":"object","description":"Accepted API access request response.","required":["ok","request_id","message"],"properties":{"message":{"type":"string","description":"Human-readable confirmation.","example":"Request received. The StateSet team will review it and follow up with provisioning details."},"ok":{"type":"boolean","description":"Whether the request was accepted.","example":true},"request_id":{"type":"string","description":"Request identifier for support follow-up.","example":"550e8400-e29b-41d4-a716-446655440000"}},"example":{"message":"Request received. The StateSet team will review it and follow up with provisioning details.","ok":true,"request_id":"550e8400-e29b-41d4-a716-446655440000"}},"AssignCallbackTaskRequest":{"type":"object","description":"AssignCallbackTaskRequest schema used by the StateSet Voice API.","required":["assigned_to"],"properties":{"assigned_to":{"type":"string"},"due_at":{"type":["string","null"],"format":"date-time"},"priority":{"type":["integer","null"],"format":"int32"},"sla_due_at":{"type":["string","null"],"format":"date-time"}}},"AutomationPayload":{"type":"object","description":"Automation payload passed to a tenant's registered workflow function. Common fields are documented here; individual tenant functions may accept additional keys.","properties":{"call_sid":{"type":["string","null"],"description":"Twilio call SID","example":"CA1234567890abcdef1234567890abcdef"},"customer_phone":{"type":["string","null"],"description":"Customer phone number in E.164 format","example":"+15555555678"},"metadata":{"description":"Optional workflow-specific metadata"},"reason":{"type":["string","null"],"description":"Human-readable workflow reason or note","example":"customer requested a human agent"},"session_id":{"type":["string","null"],"description":"Voice session identifier when the automation is tied to a persisted session","example":"550e8400-e29b-41d4-a716-446655440000"},"to":{"type":["string","null"],"description":"Destination phone number or escalation target","example":"+15555551234"}},"example":{"call_sid":"CA1234567890abcdef1234567890abcdef","customer_phone":"+15555555678","metadata":{"order_id":"ORD-12345"},"reason":"customer requested a human agent","session_id":"550e8400-e29b-41d4-a716-446655440000"}},"AutomationResponse":{"type":"object","description":"Response returned by automation function execution endpoints","required":["ok"],"properties":{"error":{"type":["string","null"],"description":"Error message (present on failure)","example":"Function 'escalate_call_to_human' failed: missing required field 'target_number'"},"ok":{"type":"boolean","description":"Whether the automation executed successfully","example":true},"result":{"description":"Result payload returned by the function (present on success)"}},"example":{"ok":true,"result":{"message_sid":"SM1234567890abcdef","queued_at":"2026-05-14T17:42:09Z"}}},"CallDirection":{"type":"string","description":"Direction of the call","enum":["inbound","outbound"]},"CallLatencyResponse":{"type":"object","description":"CallLatencyResponse schema used by the StateSet Voice API.","required":["ok","tenant","stats","slowest","timeseries"],"properties":{"ok":{"type":"boolean"},"slowest":{"type":"array","items":{"$ref":"#/components/schemas/LatencySample"}},"stats":{"$ref":"#/components/schemas/LatencyStats"},"tenant":{"type":"string"},"timeseries":{"$ref":"#/components/schemas/LatencyTimeseries","description":"p50/p95/p99 latency bucketed over the window for the trend chart."}}},"CallLog":{"type":"object","description":"Full call log record including transcript, function calls, and metadata","required":["id","tenant_id","stream_sid","direction","status","started_at","ended_at","transcript","escalated","function_calls","created_at","updated_at"],"properties":{"answered_by":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AnsweredBy","description":"Twilio answering-machine detection result for outbound calls."}]},"call_sid":{"type":["string","null"],"description":"Twilio call SID","example":"CA1234567890abcdef1234567890abcdef"},"created_at":{"type":"string","description":"When this record was created (ISO 8601)","example":"2024-01-15T10:30:00Z"},"direction":{"$ref":"#/components/schemas/CallDirection","description":"Direction of the call"},"duration_seconds":{"type":["integer","null"],"format":"int32","description":"Duration of the call in seconds","example":142},"ended_at":{"type":"string","description":"When the call ended (ISO 8601)","example":"2024-01-15T10:32:22Z"},"error_message":{"type":["string","null"],"description":"Error message if call failed","example":"WebSocket connection closed unexpectedly"},"escalated":{"type":"boolean","description":"Whether the call was escalated to a human","example":false},"escalation_reason":{"type":["string","null"],"description":"Reason for escalation","example":"Customer requested to speak with a human agent"},"from_number":{"type":["string","null"],"description":"Caller's phone number (E.164 format)","example":"+15555555678"},"function_calls":{"type":"array","items":{"$ref":"#/components/schemas/FunctionCallEntry"},"description":"Functions called during the conversation"},"id":{"type":"string","description":"Unique identifier for this call log","example":"550e8400-e29b-41d4-a716-446655440000"},"model":{"type":["string","null"],"description":"AI model used","example":"gpt-4o-realtime-preview"},"outcome":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CallOutcome","description":"Normalized terminal call outcome derived from status and AMD."}]},"recording_url":{"type":["string","null"],"description":"URL to the call recording (from Twilio)","example":"https://api.twilio.com/2010-04-01/Accounts/AC123/Recordings/RE456.json"},"started_at":{"type":"string","description":"When the call started (ISO 8601)","example":"2024-01-15T10:30:00Z"},"status":{"$ref":"#/components/schemas/CallStatus","description":"Current status of the call"},"stream_sid":{"type":"string","description":"Twilio stream SID","example":"MZ1234567890abcdef1234567890abcdef"},"summary":{"type":["string","null"],"description":"LLM-generated summary of the call","example":"Customer called to check order status for order #12345. Agent confirmed the order shipped yesterday."},"system_prompt_key":{"type":["string","null"],"description":"System prompt key used","example":"default"},"tenant_id":{"type":"string","description":"Tenant that owns this call","example":"tenant-123"},"to_number":{"type":["string","null"],"description":"Called phone number (E.164 format)","example":"+15555551234"},"transcript":{"type":"array","items":{"$ref":"#/components/schemas/TranscriptEntry"},"description":"Full conversation transcript"},"updated_at":{"type":"string","description":"When this record was last updated (ISO 8601)","example":"2024-01-15T10:32:22Z"},"voice":{"type":["string","null"],"description":"Voice used for TTS","example":"alloy"}}},"CallLogDetailResponse":{"type":"object","description":"Full call log detail response including transcript and function calls","required":["ok","call"],"properties":{"call":{"$ref":"#/components/schemas/CallLog","description":"Full call record"},"ok":{"type":"boolean","description":"Whether the request succeeded","example":true}}},"CallLogSummary":{"type":"object","description":"Compact call log summary suitable for list views (excludes full transcript and function call details)","required":["id","stream_sid","direction","status","started_at","escalated","function_call_count","transcript_length"],"properties":{"direction":{"type":"string","description":"Call direction: \"inbound\" or \"outbound\"","example":"inbound"},"duration_seconds":{"type":["integer","null"],"format":"int32","description":"Call duration in seconds","example":142},"ended_at":{"type":["string","null"],"description":"When the call ended (ISO 8601)","example":"2024-01-15T10:32:22Z"},"escalated":{"type":"boolean","description":"Whether the call was escalated to a human","example":false},"from_number":{"type":["string","null"],"description":"Caller phone number","example":"+15555555678"},"function_call_count":{"type":"integer","description":"Number of AI function calls made during the conversation","example":3,"minimum":0},"id":{"type":"string","description":"Unique call log identifier","example":"550e8400-e29b-41d4-a716-446655440000"},"outcome":{"type":["string","null"],"description":"Normalized terminal outcome: answered, voicemail, no_answer, busy, failed"},"started_at":{"type":"string","description":"When the call started (ISO 8601)","example":"2024-01-15T10:30:00Z"},"status":{"type":"string","description":"Call status: in_progress, completed, failed, escalated, busy, no_answer, canceled","example":"completed"},"stream_sid":{"type":"string","description":"Twilio stream SID","example":"MZ1234567890abcdef1234567890abcdef"},"to_number":{"type":["string","null"],"description":"Called phone number","example":"+15555551234"},"transcript_length":{"type":"integer","description":"Number of transcript turns","example":12,"minimum":0}}},"CallLogsListResponse":{"type":"object","description":"Tenant-scoped call log list response with compact call summaries","required":["ok","tenant","calls","count"],"properties":{"calls":{"type":"array","items":{"$ref":"#/components/schemas/CallLogSummary"},"description":"Compact call summaries"},"count":{"type":"integer","description":"Number of calls returned in this page","example":25,"minimum":0},"next_cursor":{"type":["string","null"],"description":"Opaque cursor to pass back as `?cursor=...` to fetch the next page.\n`null` when this is the last page. Prefer this over `offset` for\nlarge tenants — it is O(log n) regardless of page depth."},"ok":{"type":"boolean","description":"Whether the request succeeded","example":true},"tenant":{"type":"string","description":"Authenticated tenant identifier","example":"tenant_123"}}},"CallOutcome":{"type":"string","description":"Normalized terminal outcome of an outbound call, derived from the\ncombination of `CallStatus` and `AnsweredBy`. Analytics-oriented:\n`CallStatus::Completed` alone can't distinguish human-answered from\nvoicemail-answered.","enum":["answered","voicemail","no_answer","busy","failed"]},"CallStats":{"type":"object","description":"Aggregate call statistics for a tenant including totals, rates, and averages","required":["total_calls","completed_calls","escalated_calls","failed_calls","answered_calls","voicemail_calls","no_answer_calls","busy_calls","failed_outcome_calls","calls_last_24h"],"properties":{"answer_rate":{"type":["number","null"],"format":"double","description":"Human-answer rate among calls with a normalized terminal outcome.","example":0.762},"answered_calls":{"type":"integer","format":"int64","description":"Number of calls answered by a human.","example":820,"minimum":0},"avg_duration_seconds":{"type":["number","null"],"format":"double","description":"Average call duration in seconds","example":185.5},"busy_calls":{"type":"integer","format":"int64","description":"Number of calls that reached a busy line.","example":18,"minimum":0},"calls_last_24h":{"type":"integer","format":"int64","description":"Number of calls in the last 24 hours","example":42,"minimum":0},"completed_calls":{"type":"integer","format":"int64","description":"Number of completed calls","example":1100,"minimum":0},"escalated_calls":{"type":"integer","format":"int64","description":"Number of escalated calls","example":87,"minimum":0},"failed_calls":{"type":"integer","format":"int64","description":"Number of failed calls","example":23,"minimum":0},"failed_outcome_calls":{"type":"integer","format":"int64","description":"Number of calls with failed normalized outcome.","example":23,"minimum":0},"no_answer_calls":{"type":"integer","format":"int64","description":"Number of calls that rang without answer.","example":75,"minimum":0},"total_calls":{"type":"integer","format":"int64","description":"Total number of calls","example":1250,"minimum":0},"voicemail_calls":{"type":"integer","format":"int64","description":"Number of calls that reached voicemail.","example":140,"minimum":0}}},"CallStatsResponse":{"type":"object","description":"Tenant-scoped aggregate call statistics response","required":["ok","tenant","stats"],"properties":{"ok":{"type":"boolean","description":"Whether the request succeeded","example":true},"stats":{"$ref":"#/components/schemas/CallStats","description":"Aggregate call statistics"},"tenant":{"type":"string","description":"Authenticated tenant identifier","example":"tenant_123"}}},"CallStatus":{"type":"string","description":"Status of the call","enum":["in_progress","completed","failed","escalated","busy","no_answer","canceled"]},"CallStatusAckResponse":{"type":"object","description":"CallStatusAckResponse schema used by the StateSet Voice API.","required":["ok"],"properties":{"ok":{"type":"boolean"}}},"CallbackDisposition":{"type":"string","description":"CallbackDisposition schema used by the StateSet Voice API.","enum":["human_follow_up_required","callback_requested","callback_scheduled","transferred","resolved","voicemail_follow_up","customer_abandoned"]},"CallbackTask":{"type":"object","description":"Durable callback or follow-up queue item for a voice interaction","required":["id","tenant_id","status","disposition","priority","due_at","sla_due_at","metadata","last_sla_alert_due_at","last_sla_alerted_at","dispatch_attempt_count","last_dispatch_attempted_at","claimed_at","completed_at","acknowledged_at","snoozed_until","created_at","updated_at"],"properties":{"acknowledged_at":{"type":"string","example":"2024-01-15T10:40:00Z"},"acknowledged_by":{"type":["string","null"],"example":"tier2@stateset.com"},"agent_name":{"type":["string","null"],"example":"Support Agent"},"assigned_to":{"type":["string","null"],"example":"tier2@stateset.com"},"call_sid":{"type":["string","null"],"example":"CA1234567890abcdef1234567890abcdef"},"claimed_at":{"type":"string","example":"2024-01-15T10:33:15Z"},"completed_at":{"type":"string","example":"2024-01-15T10:45:00Z"},"created_at":{"type":"string","example":"2024-01-15T10:30:00Z"},"created_by":{"type":["string","null"],"example":"dashboard"},"customer_phone":{"type":["string","null"],"example":"+15555555678"},"dispatch_attempt_count":{"type":"integer","format":"int32","example":1},"disposition":{"$ref":"#/components/schemas/CallbackDisposition"},"due_at":{"type":"string","example":"2024-01-15T18:00:00Z"},"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"last_dispatch_attempted_at":{"type":"string","example":"2024-01-15T10:47:00Z"},"last_dispatch_call_sid":{"type":["string","null"],"example":"CA9876543210abcdef9876543210abcdef"},"last_dispatch_status":{"type":["string","null"],"example":"initiated"},"last_sla_alert_due_at":{"type":"string","example":"2024-01-15T10:45:00Z"},"last_sla_alerted_at":{"type":"string","example":"2024-01-15T10:46:10Z"},"metadata":{},"notes":{"type":["string","null"],"example":"Reach out after carrier update is confirmed."},"priority":{"type":"integer","format":"int32","example":10},"queue_key":{"type":["string","null"],"example":"escalations"},"sla_due_at":{"type":"string","example":"2024-01-15T10:45:00Z"},"snooze_reason":{"type":["string","null"],"example":"Waiting on carrier escalation before calling customer back."},"snoozed_until":{"type":"string","example":"2024-01-15T12:00:00Z"},"status":{"$ref":"#/components/schemas/CallbackTaskStatus"},"stream_sid":{"type":["string","null"],"example":"MZ1234567890abcdef1234567890abcdef"},"summary":{"type":["string","null"],"example":"Customer requested a human follow-up about a delayed shipment."},"tenant_id":{"type":"string","example":"tenant-123"},"updated_at":{"type":"string","example":"2024-01-15T10:32:22Z"}}},"CallbackTaskStatus":{"type":"string","description":"CallbackTaskStatus schema used by the StateSet Voice API.","enum":["open","in_progress","completed","canceled"]},"ClaimCallbackTaskRequest":{"type":"object","description":"ClaimCallbackTaskRequest schema used by the StateSet Voice API.","required":["operator"],"properties":{"operator":{"type":"string"}}},"CreateAgent":{"type":"object","description":"CreateAgent schema used by the StateSet Voice API.","required":["agent_key","name"],"properties":{"agent_key":{"type":"string"},"description":{"type":["string","null"]},"name":{"type":"string"}}},"CreateAgentVersion":{"type":"object","description":"CreateAgentVersion schema used by the StateSet Voice API.","required":["agent_id"],"properties":{"agent_id":{"type":"string","format":"uuid"},"config":{"$ref":"#/components/schemas/AgentVersionConfig"}}},"CreateCallbackTaskRequest":{"type":"object","description":"CreateCallbackTaskRequest schema used by the StateSet Voice API.","required":["disposition"],"properties":{"agent_name":{"type":["string","null"]},"assigned_to":{"type":["string","null"]},"call_sid":{"type":["string","null"]},"created_by":{"type":"string"},"customer_phone":{"type":["string","null"]},"disposition":{"$ref":"#/components/schemas/CallbackDisposition"},"due_at":{"type":["string","null"],"format":"date-time"},"metadata":{},"notes":{"type":["string","null"]},"priority":{"type":["integer","null"],"format":"int32"},"queue_key":{"type":["string","null"]},"sla_due_at":{"type":["string","null"],"format":"date-time"},"status":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CallbackTaskStatus"}]},"stream_sid":{"type":["string","null"]},"summary":{"type":["string","null"]}}},"CreateTenantApiKey":{"type":"object","description":"CreateTenantApiKey schema used by the StateSet Voice API.","properties":{"label":{"type":["string","null"]}}},"CreateVoiceSessionRequest":{"type":"object","description":"CreateVoiceSessionRequest schema used by the StateSet Voice API.","required":["stream_id"],"properties":{"agent_name":{"type":["string","null"]},"call_sid":{"type":["string","null"]},"call_type":{"type":["string","null"]},"customer_phone":{"type":["string","null"]},"duration_ms":{"type":["integer","null"],"format":"int64"},"metadata":{},"model":{"type":["string","null"]},"org_id":{"type":["string","null"]},"sentiment":{"type":["string","null"]},"status":{"type":["string","null"]},"stream_id":{"type":"string"},"summary":{"type":["string","null"]},"tags":{"type":["array","null"],"items":{"type":"string"}},"transcript":{},"voice":{"type":["string","null"]}}},"CreatedTenantApiKey":{"type":"object","description":"CreatedTenantApiKey schema used by the StateSet Voice API.","required":["api_key","token"],"properties":{"api_key":{"$ref":"#/components/schemas/TenantApiKeyMetadata"},"token":{"type":"string"}}},"ErrorResponse":{"type":"object","description":"Standard error envelope returned by tenant-facing API errors","required":["success","error","code"],"properties":{"code":{"type":"string","description":"Machine-readable error code","example":"VALIDATION_ERROR"},"details":{"description":"Additional error details (optional)"},"error":{"type":"string","description":"Human-readable error message","example":"Invalid request: missing required field 'to'"},"request_id":{"type":["string","null"],"description":"Request ID for support correlation","example":"req-abc123-def456"},"success":{"type":"boolean","description":"Always false for errors","example":false}},"example":{"code":"VALIDATION_ERROR","details":{"field":"to","reason":"required"},"error":"Invalid request: missing required field 'to'","request_id":"req-abc123-def456","success":false}},"EvaluateRolloutGovernanceRequest":{"type":"object","description":"EvaluateRolloutGovernanceRequest schema used by the StateSet Voice API.","properties":{"apply":{"type":"boolean"}}},"ExternalCallbackTaskReconciliationFailure":{"type":"object","description":"Failure encountered while reconciling a callback task with an external ticketing system","required":["task_id","error"],"properties":{"error":{"type":"string","example":"Gorgias API error 404 Not Found"},"external_reference_id":{"type":["string","null"],"example":"gorgias-ticket-123"},"task_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"tenant_id":{"type":["string","null"],"example":"tenant-123"}}},"ExternalCallbackTaskReconciliationItem":{"type":"object","description":"Callback task external reconciliation item processed from a linked CRM or ticket source","required":["tenant_id","task_id","source","external_reference_id","previous_status","status","webhook_enqueued"],"properties":{"assigned_to":{"type":["string","null"],"example":"supervisor@stateset.com"},"external_assignee":{"type":["string","null"],"example":"supervisor@stateset.com"},"external_reference_id":{"type":"string","example":"gorgias-ticket-123"},"external_status":{"type":["string","null"],"example":"closed"},"previous_assigned_to":{"type":["string","null"],"example":"tier2@stateset.com"},"previous_status":{"$ref":"#/components/schemas/CallbackTaskStatus"},"source":{"type":"string","example":"gorgias"},"status":{"$ref":"#/components/schemas/CallbackTaskStatus"},"task_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"tenant_id":{"type":"string","example":"tenant-123"},"webhook_enqueued":{"type":"boolean","example":true}}},"ExternalCallbackTaskReconciliationResult":{"type":"object","description":"Aggregate result of reconciling linked callback tasks with external ticket state","required":["attempted_tenants","evaluated_tenants","candidate_tasks","unchanged_tasks","reconciled_tasks","webhooks_enqueued","items","failures"],"properties":{"attempted_tenants":{"type":"integer","format":"int64","example":3,"minimum":0},"candidate_tasks":{"type":"integer","format":"int64","example":4,"minimum":0},"evaluated_tenants":{"type":"integer","format":"int64","example":2,"minimum":0},"failures":{"type":"array","items":{"$ref":"#/components/schemas/ExternalCallbackTaskReconciliationFailure"}},"items":{"type":"array","items":{"$ref":"#/components/schemas/ExternalCallbackTaskReconciliationItem"}},"reconciled_tasks":{"type":"integer","format":"int64","example":3,"minimum":0},"unchanged_tasks":{"type":"integer","format":"int64","example":1,"minimum":0},"webhooks_enqueued":{"type":"integer","format":"int64","example":3,"minimum":0}}},"FunctionCallEntry":{"type":"object","description":"Record of an AI tool/function call made during a voice session","required":["name","arguments","timestamp"],"properties":{"arguments":{"description":"Arguments passed to the function"},"duration_ms":{"type":["integer","null"],"format":"int64","description":"How long the function took to execute in milliseconds","example":150},"name":{"type":"string","description":"Name of the function called","example":"get_order_status"},"result":{"description":"Result returned by the function"},"timestamp":{"type":"string","description":"When the function was called (ISO 8601)","example":"2024-01-15T10:30:45Z"}}},"FunctionContextInput":{"type":"object","description":"Optional execution context providing session and tenant information for function testing","properties":{"agent_name":{"type":["string","null"],"description":"AI agent name","example":"ResponseCX"},"authenticated":{"type":"boolean","description":"Whether the customer has been authenticated","example":true},"customer_id":{"type":["string","null"],"description":"Customer identifier","example":"cust-789"},"customer_phone":{"type":["string","null"],"description":"Customer phone number (E.164)","example":"+15555555678"},"org_id":{"type":["string","null"],"description":"Organization ID","example":"org-456"},"session_id":{"type":["string","null"],"description":"Active session ID","example":"sess-abc123"}}},"FunctionTestRequest":{"type":"object","description":"Manually execute a registered AI tool/function with a synthetic context","required":["name","args"],"properties":{"args":{"description":"Function arguments as JSON"},"context":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/FunctionContextInput","description":"Optional execution context"}]},"name":{"type":"string","description":"Function name to execute","example":"get_order"}},"example":{"args":{"order_id":"12345"},"context":{"agent_name":"Front Desk","authenticated":true,"customer_id":"cust-789","customer_phone":"+15555555678","org_id":"org-456","session_id":"sess-abc123"},"name":"get_order"}},"FunctionTestResponse":{"type":"object","description":"Result of manually executing a registered AI tool/function","required":["ok"],"properties":{"error":{"type":["string","null"],"description":"Error message (if failed)","example":"Function not found: get_order"},"ok":{"type":"boolean","description":"Whether the function executed successfully","example":true},"result":{"description":"Function result (if successful)"}},"example":{"ok":true,"result":{"order":{"id":"12345","status":"shipped"}}}},"HealthResponse":{"type":"object","description":"Tenant-scoped health snapshot with tool, session, and audio-provider state","required":["ok","tenant","tools","activeSessions","uptime","configuredAudioOutputProvider","effectiveAudioOutputProvider","audioProviderFallback","elevenlabsConfigured","elevenlabsReady"],"properties":{"activeSessions":{"type":"integer","description":"Number of active voice sessions","example":3,"minimum":0},"audioProviderFallback":{"type":"boolean","description":"Whether runtime is currently falling back from configured provider","example":false},"configuredAudioOutputProvider":{"type":"string","description":"Configured per-tenant audio output provider (`openai` or `elevenlabs`)","example":"elevenlabs"},"effectiveAudioOutputProvider":{"type":"string","description":"Effective provider after runtime fallback checks","example":"openai"},"elevenlabsConfigured":{"type":"boolean","description":"Whether ElevenLabs credentials are configured for this tenant","example":true},"elevenlabsReady":{"type":"boolean","description":"Whether ElevenLabs service initialized successfully for this tenant","example":true},"ok":{"type":"boolean","description":"Service status","example":true},"org_id":{"type":["string","null"],"description":"Organization ID","example":"org-456"},"tenant":{"type":"string","description":"Tenant identifier","example":"tenant-123"},"tools":{"type":"integer","description":"Number of registered tools/functions","example":15,"minimum":0},"uptime":{"type":"integer","format":"int64","description":"Server uptime in seconds","example":3600,"minimum":0}},"example":{"activeSessions":3,"audioProviderFallback":false,"configuredAudioOutputProvider":"elevenlabs","effectiveAudioOutputProvider":"elevenlabs","elevenlabsConfigured":true,"elevenlabsReady":true,"ok":true,"org_id":"org-456","tenant":"tenant_acme_dental","tools":15,"uptime":3600}},"LatencySample":{"type":"object","description":"A single call selected as a \"slowest\" sample for review.","required":["id","stream_sid","started_at"],"properties":{"call_sid":{"type":["string","null"]},"duration_seconds":{"type":["integer","null"],"format":"int32"},"e2e_p95_ms":{"type":["number","null"],"format":"double"},"id":{"type":"string","format":"uuid"},"llm_p50_ms":{"type":["number","null"],"format":"double"},"llm_p95_ms":{"type":["number","null"],"format":"double"},"model":{"type":["string","null"]},"started_at":{"type":"string","format":"date-time"},"stream_sid":{"type":"string"},"turn_count":{"type":["integer","null"],"format":"int32"},"voice":{"type":["string","null"]}}},"LatencyStats":{"type":"object","description":"Aggregated turn-latency percentiles across a tenant's recent calls.\n\nComputed from each call_log's `turn_latency_stats.summary` JSON column,\nwhich already contains per-call avg/p50/p95/p99 for both LLM first-token\nand end-to-end first-audio. The repo aggregates those scalar percentiles\nacross calls in the requested window with `percentile_cont`, so the\nreturned p95 is \"p95 of the per-call p95\" — a defensible proxy when raw\nper-turn samples aren't surfaced through the API.","required":["call_sample_count","turn_sample_count","window"],"properties":{"avg_e2e_first_audio_ms":{"type":["number","null"],"format":"double","description":"Average of per-call end-to-end first-audio averages, in milliseconds."},"avg_llm_first_token_ms":{"type":["number","null"],"format":"double","description":"Average of per-call LLM first-token averages, in milliseconds."},"call_sample_count":{"type":"integer","format":"int64","description":"Number of calls contributing samples to the aggregate.","example":124},"max_e2e_first_audio_ms":{"type":["number","null"],"format":"double"},"max_llm_first_token_ms":{"type":["number","null"],"format":"double"},"p50_e2e_first_audio_ms":{"type":["number","null"],"format":"double"},"p50_llm_first_token_ms":{"type":["number","null"],"format":"double"},"p95_e2e_first_audio_ms":{"type":["number","null"],"format":"double"},"p95_llm_first_token_ms":{"type":["number","null"],"format":"double"},"p99_e2e_first_audio_ms":{"type":["number","null"],"format":"double"},"p99_llm_first_token_ms":{"type":["number","null"],"format":"double"},"turn_sample_count":{"type":"integer","format":"int64","description":"Sum of per-call turn counts (proxy for total turns observed).","example":1832},"window":{"type":"string"}}},"LatencyTimeseries":{"type":"object","description":"Latency percentiles bucketed over time, mirroring the voice-outcomes\ntimeseries shape so the dashboard can plot p50/p95/p99 trend lines.","required":["window","bucket","points"],"properties":{"bucket":{"type":"string","description":"Bucket granularity: \"hour\" or \"day\"."},"points":{"type":"array","items":{"$ref":"#/components/schemas/LatencyTimeseriesPoint"}},"window":{"type":"string"}}},"LatencyTimeseriesPoint":{"type":"object","description":"One time bucket of aggregated latency percentiles. Field names match the\nscalar `LatencyStats` keys so the frontend can reuse the same accessors.","required":["bucket_start","call_count"],"properties":{"bucket_start":{"type":"string","format":"date-time"},"call_count":{"type":"integer","format":"int64","description":"Calls contributing to this bucket."},"p50_e2e_first_audio_ms":{"type":["number","null"],"format":"double"},"p50_llm_first_token_ms":{"type":["number","null"],"format":"double"},"p95_e2e_first_audio_ms":{"type":["number","null"],"format":"double"},"p95_llm_first_token_ms":{"type":["number","null"],"format":"double"},"p99_e2e_first_audio_ms":{"type":["number","null"],"format":"double"},"p99_llm_first_token_ms":{"type":["number","null"],"format":"double"}}},"ListTenantsResponse":{"type":"object","description":"ListTenantsResponse schema used by the StateSet Voice API.","required":["ok","count","tenants"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"tenants":{"type":"array","items":{"$ref":"#/components/schemas/AdminTenantItem"}}}},"LogsStatsResponse":{"type":"object","description":"LogsStatsResponse schema used by the StateSet Voice API.","required":["ok","tenant","connectedClients","timestamp"],"properties":{"connectedClients":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"tenant":{"type":"string"},"timestamp":{"type":"string"}}},"MakeCallRequest":{"type":"object","description":"Request body for placing an outbound AI voice call","required":["to"],"properties":{"agent_key":{"type":["string","null"],"description":"Optional stable agent key to resolve the currently published version","example":"support_primary"},"agent_name":{"type":["string","null"],"description":"Optional agent name override","example":"Support Agent"},"agent_version_id":{"type":["string","null"],"description":"Optional explicit agent version id","example":"550e8400-e29b-41d4-a716-446655440000"},"from":{"type":["string","null"],"description":"Source phone number (defaults to tenant's Twilio number)","example":"+15555551234"},"greeting":{"type":["string","null"],"description":"Optional custom greeting message for the AI agent","example":"Hello, this is an automated call from StateSet"},"org_id":{"type":["string","null"],"description":"Optional organization ID for multi-org support","example":"org-456"},"to":{"type":"string","description":"Destination phone number (E.164 format recommended)","example":"+15555555678"}},"example":{"agent_key":"support_primary","from":"+15555551234","greeting":"Hi, this is Acme Dental calling about your appointment.","org_id":"org-456","to":"+15555555678"}},"MakeCallResponse":{"type":"object","description":"Acknowledgement returned after queueing an outbound AI voice call","required":["ok"],"properties":{"call_sid":{"type":["string","null"],"description":"Twilio call SID for tracking","example":"CA1234567890abcdef1234567890abcdef"},"error":{"type":["string","null"],"description":"Error message (if failed)","example":"Twilio not configured"},"from":{"type":["string","null"],"description":"Source phone number","example":"+15555551234"},"ok":{"type":"boolean","description":"Whether the call was initiated successfully","example":true},"status":{"type":["string","null"],"description":"Current call status","example":"queued"},"to":{"type":["string","null"],"description":"Destination phone number","example":"+15555555678"}},"example":{"call_sid":"CA1234567890abcdef1234567890abcdef","from":"+15555551234","ok":true,"status":"queued","to":"+15555555678"}},"OperatorCallbackDispatchFailure":{"type":"object","description":"Failure encountered while auto-dispatching callback tasks","required":["task_id","error"],"properties":{"error":{"type":"string","example":"Twilio not configured"},"task_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"tenant_id":{"type":["string","null"],"example":"tenant-123"}}},"OperatorCallbackDispatchItem":{"type":"object","description":"Callback task auto-dispatch item initiated from a queue","required":["tenant_id","task_id","dispatch_attempt_count","dry_run"],"properties":{"call_sid":{"type":["string","null"],"example":"CA9876543210abcdef9876543210abcdef"},"customer_phone":{"type":["string","null"],"example":"+15555550123"},"dispatch_attempt_count":{"type":"integer","format":"int32","example":1},"dry_run":{"type":"boolean","example":false},"queue_key":{"type":["string","null"],"example":"callbacks"},"task_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"tenant_id":{"type":"string","example":"tenant-123"}}},"OperatorCallbackDispatchResult":{"type":"object","description":"Aggregate result of an operator callback auto-dispatch sweep","required":["attempted_tenants","evaluated_tenants","eligible_tasks","dispatched_tasks","dry_run_tasks","items","failures"],"properties":{"attempted_tenants":{"type":"integer","format":"int64","example":3,"minimum":0},"dispatched_tasks":{"type":"integer","format":"int64","example":2,"minimum":0},"dry_run_tasks":{"type":"integer","format":"int64","example":1,"minimum":0},"eligible_tasks":{"type":"integer","format":"int64","example":5,"minimum":0},"evaluated_tenants":{"type":"integer","format":"int64","example":3,"minimum":0},"failures":{"type":"array","items":{"$ref":"#/components/schemas/OperatorCallbackDispatchFailure"}},"items":{"type":"array","items":{"$ref":"#/components/schemas/OperatorCallbackDispatchItem"}}}},"OperatorFollowUpNotificationFailure":{"type":"object","description":"Failure encountered while processing operator follow-up notifications","required":["task_id","error"],"properties":{"error":{"type":"string","example":"Function notify_operator_follow_up_required not found"},"task_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"tenant_id":{"type":["string","null"],"example":"tenant-123"}}},"OperatorFollowUpNotificationItem":{"type":"object","description":"Callback task follow-up notification or snooze-expiry item processed by the operator notifier","required":["tenant_id","task_id","reason","escalated","snooze_expired","notification_sent","webhook_enqueued"],"properties":{"assigned_to":{"type":["string","null"],"example":"tier2@stateset.com"},"customer_phone":{"type":["string","null"],"example":"+15555550123"},"escalated":{"type":"boolean","example":true},"escalation_assignee":{"type":["string","null"],"example":"supervisor@stateset.com"},"escalation_queue_key":{"type":["string","null"],"example":"supervisor-escalations"},"notification_channel":{"type":["string","null"],"example":"email"},"notification_sent":{"type":"boolean","example":true},"notification_target":{"type":["string","null"],"example":"tier2@stateset.com"},"queue_key":{"type":["string","null"],"example":"escalations"},"reason":{"type":"string","example":"unacknowledged_deadline_breached"},"snooze_expired":{"type":"boolean","example":true},"task_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"tenant_id":{"type":"string","example":"tenant-123"},"webhook_enqueued":{"type":"boolean","example":true}}},"OperatorFollowUpNotificationResult":{"type":"object","description":"Aggregate result of the operator follow-up notification sweep","required":["attempted_tenants","evaluated_tenants","candidate_tasks","snoozes_expired","escalations_applied","notifications_sent","webhooks_enqueued","items","failures"],"properties":{"attempted_tenants":{"type":"integer","format":"int64","example":3,"minimum":0},"candidate_tasks":{"type":"integer","format":"int64","example":4,"minimum":0},"escalations_applied":{"type":"integer","format":"int64","example":1,"minimum":0},"evaluated_tenants":{"type":"integer","format":"int64","example":3,"minimum":0},"failures":{"type":"array","items":{"$ref":"#/components/schemas/OperatorFollowUpNotificationFailure"}},"items":{"type":"array","items":{"$ref":"#/components/schemas/OperatorFollowUpNotificationItem"}},"notifications_sent":{"type":"integer","format":"int64","example":2,"minimum":0},"snoozes_expired":{"type":"integer","format":"int64","example":2,"minimum":0},"webhooks_enqueued":{"type":"integer","format":"int64","example":3,"minimum":0}}},"OperatorQueue":{"type":"object","description":"Tenant-scoped operator queue used for callback and follow-up work","required":["id","tenant_id","queue_key","name","is_default","priority","auto_dispatch_enabled","auto_dispatch_max_attempts","dispatch_schedule","active","metadata","created_at","updated_at"],"properties":{"active":{"type":"boolean","example":true},"auto_dispatch_delay_seconds":{"type":["integer","null"],"format":"int32","example":600},"auto_dispatch_enabled":{"type":"boolean","example":true},"auto_dispatch_max_attempts":{"type":"integer","format":"int32","example":3},"auto_dispatch_retry_delay_seconds":{"type":["integer","null"],"format":"int32","example":900},"created_at":{"type":"string","example":"2024-01-15T10:30:00Z"},"default_assignee":{"type":["string","null"],"example":"tier2@stateset.com"},"description":{"type":["string","null"],"example":"Queue for human escalations that require follow-up"},"dispatch_schedule":{},"dispatch_timezone":{"type":["string","null"],"example":"America/New_York"},"dispatch_window_end_hour_utc":{"type":["integer","null"],"format":"int32","example":22},"dispatch_window_start_hour_utc":{"type":["integer","null"],"format":"int32","example":14},"follow_up_escalation_assignee":{"type":["string","null"],"example":"supervisor@stateset.com"},"follow_up_escalation_priority":{"type":["integer","null"],"format":"int32","example":2},"follow_up_escalation_queue_key":{"type":["string","null"],"example":"priority-escalations"},"follow_up_escalation_seconds":{"type":["integer","null"],"format":"int32","example":1800},"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440010"},"is_default":{"type":"boolean","example":true},"metadata":{},"name":{"type":"string","example":"Escalations"},"priority":{"type":"integer","format":"int32","example":10},"queue_key":{"type":"string","example":"escalations"},"sla_seconds":{"type":["integer","null"],"format":"int32","example":900},"tenant_id":{"type":"string","example":"tenant-123"},"updated_at":{"type":"string","example":"2024-01-15T10:32:22Z"}}},"OperatorQueueStats":{"type":"object","description":"Aggregate queue metrics for callback and follow-up operations","required":["queue_key","name","priority","open_tasks","in_progress_tasks","overdue_tasks","unassigned_tasks","total_tasks"],"properties":{"in_progress_tasks":{"type":"integer","format":"int64","example":2,"minimum":0},"name":{"type":"string","example":"Escalations"},"oldest_task_age_secs":{"type":["number","null"],"format":"double","example":7200.0},"open_tasks":{"type":"integer","format":"int64","example":4,"minimum":0},"overdue_tasks":{"type":"integer","format":"int64","example":1,"minimum":0},"priority":{"type":"integer","format":"int32","example":10},"queue_key":{"type":"string","example":"escalations"},"sla_seconds":{"type":["integer","null"],"format":"int32","example":900},"total_tasks":{"type":"integer","format":"int64","example":6,"minimum":0},"unassigned_tasks":{"type":"integer","format":"int64","example":3,"minimum":0}}},"OperatorQueueSweepFailure":{"type":"object","description":"Failure encountered while sweeping callback task queues","required":["task_id","error"],"properties":{"error":{"type":"string","example":"Operator workflows not configured"},"task_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"tenant_id":{"type":["string","null"],"example":"tenant-123"}}},"OperatorQueueSweepItem":{"type":"object","description":"Callback task SLA sweep item that was newly marked overdue","required":["tenant_id","task_id","sla_due_at","webhook_enqueued"],"properties":{"assigned_to":{"type":["string","null"],"example":"tier2@stateset.com"},"customer_phone":{"type":["string","null"],"example":"+15555550123"},"queue_key":{"type":["string","null"],"example":"escalations"},"sla_due_at":{"type":"string","example":"2024-01-15T10:45:00Z"},"stream_sid":{"type":["string","null"],"example":"MZ1234567890abcdef1234567890abcdef"},"task_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"tenant_id":{"type":"string","example":"tenant-123"},"webhook_enqueued":{"type":"boolean","example":true}}},"OperatorQueueSweepResult":{"type":"object","description":"Aggregate result of a callback task SLA sweep","required":["attempted_tenants","evaluated_tenants","overdue_tasks","alerts_recorded","webhooks_enqueued","items","failures"],"properties":{"alerts_recorded":{"type":"integer","format":"int64","example":2,"minimum":0},"attempted_tenants":{"type":"integer","format":"int64","example":3,"minimum":0},"evaluated_tenants":{"type":"integer","format":"int64","example":3,"minimum":0},"failures":{"type":"array","items":{"$ref":"#/components/schemas/OperatorQueueSweepFailure"}},"items":{"type":"array","items":{"$ref":"#/components/schemas/OperatorQueueSweepItem"}},"overdue_tasks":{"type":"integer","format":"int64","example":4,"minimum":0},"webhooks_enqueued":{"type":"integer","format":"int64","example":2,"minimum":0}}},"OutboxDepthSnapshot":{"type":"object","description":"Current depth snapshot for one tracked outbox table.","required":["table","pending","delivered","failed"],"properties":{"delivered":{"type":"integer","format":"int64"},"failed":{"type":"integer","format":"int64"},"pending":{"type":"integer","format":"int64"},"table":{"type":"string"}}},"PhoneNumberRoute":{"type":"object","description":"PhoneNumberRoute schema used by the StateSet Voice API.","required":["id","tenant_id","phone_number","direction","agent_id","agent_key","agent_name","created_at","updated_at"],"properties":{"agent_id":{"type":"string","format":"uuid"},"agent_key":{"type":"string"},"agent_name":{"type":"string"},"agent_version_id":{"type":["string","null"],"format":"uuid"},"created_at":{"type":"string","format":"date-time"},"direction":{"$ref":"#/components/schemas/PhoneNumberRouteDirection"},"greeting":{"type":["string","null"]},"id":{"type":"string","format":"uuid"},"phone_number":{"type":"string"},"resolved_agent_version_id":{"type":["string","null"],"format":"uuid"},"resolved_version_number":{"type":["integer","null"],"format":"int32"},"tenant_id":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"PhoneNumberRouteDirection":{"type":"string","description":"PhoneNumberRouteDirection schema used by the StateSet Voice API.","enum":["inbound","outbound","sip_inbound","sip_outbound"]},"ReadinessCheck":{"type":"object","description":"Health status of a single subsystem checked during the readiness probe","required":["name","status","ready","details"],"properties":{"details":{"description":"Additional details about the check"},"name":{"type":"string","description":"Name of the subsystem being checked","example":"database"},"ready":{"type":"boolean","description":"Whether this subsystem is ready","example":true},"status":{"type":"string","description":"Human-readable status description","example":"connected"}}},"ReadinessResponse":{"type":"object","description":"Aggregated readiness probe result with individual subsystem checks","required":["ready","status","checks","version","timestamp","uptime_seconds"],"properties":{"checks":{"type":"array","items":{"$ref":"#/components/schemas/ReadinessCheck"},"description":"Individual subsystem checks"},"ready":{"type":"boolean","description":"Overall readiness status","example":true},"status":{"type":"string","description":"Summary status string","example":"ready"},"timestamp":{"type":"string","description":"ISO 8601 timestamp","example":"2024-01-15T10:30:00Z"},"uptime_seconds":{"type":"integer","format":"int64","description":"Server uptime in seconds","example":3600,"minimum":0},"version":{"type":"string","description":"Server version","example":"0.1.0"}},"example":{"checks":[{"details":{"latency_ms":12},"name":"database","ready":true,"status":"connected"},{"details":{"brokers":3},"name":"kafka","ready":true,"status":"connected"},{"details":{},"name":"twilio","ready":true,"status":"configured"}],"ready":true,"status":"ready","timestamp":"2026-05-14T17:40:00Z","uptime_seconds":3600,"version":"0.1.0"}},"ReleaseCallbackTaskRequest":{"type":"object","description":"ReleaseCallbackTaskRequest schema used by the StateSet Voice API.","properties":{"clear_assignee":{"type":"boolean"}}},"ReplaceAgentVersionRollouts":{"type":"object","description":"ReplaceAgentVersionRollouts schema used by the StateSet Voice API.","properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/SetAgentVersionRollout"}}}},"RolloutGovernanceEvaluation":{"type":"object","description":"RolloutGovernanceEvaluation schema used by the StateSet Voice API.","required":["agent_id","agent_key","agent_name","status","applied"],"properties":{"agent_id":{"type":"string","format":"uuid"},"agent_key":{"type":"string"},"agent_name":{"type":"string"},"applied":{"type":"boolean"},"policy":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/RolloutGovernancePolicy"}]},"published_version":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AgentVersionEvalStats"}]},"reasons":{"type":"array","items":{"type":"string"}},"rollout_versions":{"type":"array","items":{"$ref":"#/components/schemas/RolloutGovernanceVersionEvaluation"}},"status":{"type":"string"}}},"RolloutGovernancePolicy":{"type":"object","description":"RolloutGovernancePolicy schema used by the StateSet Voice API.","required":["tenant_id","agent_id","enabled","lookback_hours","min_eval_count","min_avg_score","created_at","updated_at"],"properties":{"agent_id":{"type":"string","format":"uuid"},"created_at":{"type":"string","format":"date-time"},"enabled":{"type":"boolean"},"lookback_hours":{"type":"integer","format":"int32"},"min_avg_score":{"type":"number","format":"double"},"min_eval_count":{"type":"integer","format":"int32"},"min_high_quality_rate":{"type":["number","null"],"format":"double"},"tenant_id":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"RolloutGovernanceSweepFailure":{"type":"object","description":"RolloutGovernanceSweepFailure schema used by the StateSet Voice API.","required":["auth_token","error"],"properties":{"agent_id":{"type":["string","null"],"format":"uuid"},"auth_token":{"type":"string"},"error":{"type":"string"}}},"RolloutGovernanceSweepItem":{"type":"object","description":"RolloutGovernanceSweepItem schema used by the StateSet Voice API.","required":["auth_token","tenant_id","evaluation"],"properties":{"auth_token":{"type":"string"},"evaluation":{"$ref":"#/components/schemas/RolloutGovernanceEvaluation"},"tenant_id":{"type":"string"}}},"RolloutGovernanceSweepRequest":{"type":"object","description":"RolloutGovernanceSweepRequest schema used by the StateSet Voice API.","properties":{"apply":{"type":"boolean"},"auth_token":{"type":["string","null"]},"limit":{"type":["integer","null"],"format":"int64"}}},"RolloutGovernanceSweepResult":{"type":"object","description":"RolloutGovernanceSweepResult schema used by the StateSet Voice API.","required":["attempted_tenants","evaluated_tenants","attempted_agents","evaluated_agents","rollback_recommended","rollbacks_applied"],"properties":{"attempted_agents":{"type":"integer","format":"int64","minimum":0},"attempted_tenants":{"type":"integer","format":"int64","minimum":0},"evaluated_agents":{"type":"integer","format":"int64","minimum":0},"evaluated_tenants":{"type":"integer","format":"int64","minimum":0},"failures":{"type":"array","items":{"$ref":"#/components/schemas/RolloutGovernanceSweepFailure"}},"items":{"type":"array","items":{"$ref":"#/components/schemas/RolloutGovernanceSweepItem"}},"rollback_recommended":{"type":"integer","format":"int64","minimum":0},"rollbacks_applied":{"type":"integer","format":"int64","minimum":0}}},"RolloutGovernanceVersionEvaluation":{"type":"object","description":"RolloutGovernanceVersionEvaluation schema used by the StateSet Voice API.","required":["agent_version_id","version_number","eval_count","status"],"properties":{"agent_version_id":{"type":"string","format":"uuid"},"avg_score":{"type":["number","null"],"format":"double"},"eval_count":{"type":"integer","format":"int64","minimum":0},"high_quality_rate":{"type":["number","null"],"format":"double"},"last_eval_at":{"type":["string","null"],"format":"date-time"},"reasons":{"type":"array","items":{"type":"string"}},"status":{"type":"string"},"traffic_percentage":{"type":["integer","null"],"format":"int32"},"version_number":{"type":"integer","format":"int32"}}},"RootResponse":{"type":"object","description":"Service banner with version and timestamp returned by the root endpoint","required":["message","version","timestamp","tenant"],"properties":{"message":{"type":"string","description":"Human-readable status message","example":"StateSet Cloud <-> Twilio Media Stream Server (Rust) is running!"},"org_id":{"type":["string","null"],"description":"Organization ID","example":"org-456"},"tenant":{"type":"string","description":"Tenant identifier","example":"tenant-123"},"timestamp":{"type":"string","description":"ISO 8601 timestamp","example":"2024-01-15T10:30:00Z"},"version":{"type":"string","description":"Server version","example":"0.1.0"}},"example":{"message":"StateSet Cloud <-> Twilio Media Stream Server (Rust) is running!","org_id":"org-456","tenant":"tenant_acme_dental","timestamp":"2026-05-14T17:40:00Z","version":"0.1.0"}},"SessionActionBody":{"type":"object","description":"Request body for session control actions (monitor, whisper, barge, escalate, end)","properties":{"note":{"type":["string","null"],"description":"Note to send (used with whisper action)","example":"Offer the customer a 15% discount"},"reason":{"type":["string","null"],"description":"Reason for the action (used with end action)","example":"Customer issue resolved"},"supervisor":{"type":"string","description":"Identifier for who is performing the action","example":"dashboard"},"target":{"type":["string","null"],"description":"Escalation target phone number or SIP address (used with escalate action)","example":"+15555559999"}}},"SessionActionResponse":{"type":"object","description":"Acknowledgement returned after performing a session control action","required":["ok","message"],"properties":{"message":{"type":"string","description":"Human-readable result message","example":"Escalated"},"ok":{"type":"boolean","description":"Whether the action was accepted","example":true}},"example":{"message":"Escalated","ok":true}},"SessionInfo":{"type":"object","description":"Snapshot of an in-flight realtime voice session","required":["stream_sid","started_at","escalated"],"properties":{"agent_name":{"type":["string","null"],"description":"AI agent name (optional)","example":"ResponseCX"},"call_type":{"type":["string","null"],"description":"Type of call (inbound/outbound/sip_inbound/etc)","example":"inbound"},"customer_phone":{"type":["string","null"],"description":"Customer's phone number (optional)","example":"+15555555678"},"escalated":{"type":"boolean","description":"Whether the session has been escalated to a human","example":false},"escalation_target":{"type":["string","null"],"description":"Escalation target (optional)","example":"+15555551234"},"greeting":{"type":["string","null"],"description":"Greeting message (optional)","example":"Hello, how can I help?"},"org_id":{"type":["string","null"],"description":"Organization ID (optional)","example":"org-456"},"started_at":{"type":"string","description":"Session start time (ISO 8601)","example":"2024-01-15T10:30:00Z"},"stream_sid":{"type":"string","description":"Unique stream SID from Twilio","example":"MZ1234567890abcdef1234567890abcdef"}},"example":{"agent_name":"Front Desk","call_type":"inbound","customer_phone":"+15555555678","escalated":false,"escalation_target":null,"greeting":"Thanks for calling Acme Dental.","org_id":"org-456","started_at":"2026-05-14T17:40:02Z","stream_sid":"MZ1234567890abcdef1234567890abcdef"}},"SessionsListResponse":{"type":"object","description":"Response containing a list of active in-memory voice sessions","required":["ok","tenant","sessions"],"properties":{"ok":{"type":"boolean","description":"Whether the request succeeded","example":true},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/SessionInfo"},"description":"Active voice sessions"},"tenant":{"type":"string","description":"Tenant identifier","example":"tenant-123"}},"example":{"ok":true,"sessions":[{"agent_name":"Front Desk","call_type":"inbound","customer_phone":"+15555555678","escalated":false,"escalation_target":null,"greeting":"Thanks for calling Acme Dental.","org_id":"org-456","started_at":"2026-05-14T17:40:02Z","stream_sid":"MZ1234567890abcdef1234567890abcdef"}],"tenant":"tenant_acme_dental"}},"SetAgentVersionRollout":{"type":"object","description":"SetAgentVersionRollout schema used by the StateSet Voice API.","required":["agent_version_id","traffic_percentage"],"properties":{"agent_version_id":{"type":"string","format":"uuid"},"traffic_percentage":{"type":"integer","format":"int32"}}},"SnoozeCallbackTaskRequest":{"type":"object","description":"SnoozeCallbackTaskRequest schema used by the StateSet Voice API.","required":["operator","snoozed_until"],"properties":{"operator":{"type":"string"},"reason":{"type":["string","null"]},"snoozed_until":{"type":"string","format":"date-time"}}},"SupervisorActionLog":{"type":"object","description":"Durable supervisor action taken against a live session","required":["id","tenant_id","stream_sid","action","supervisor","metadata","created_at"],"properties":{"action":{"$ref":"#/components/schemas/SupervisorActionType"},"call_sid":{"type":["string","null"],"example":"CA1234567890abcdef1234567890abcdef"},"created_at":{"type":"string","example":"2024-01-15T10:30:00Z"},"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"metadata":{},"note":{"type":["string","null"],"example":"Offer a 15% discount before transfer"},"reason":{"type":["string","null"],"example":"Customer requested a human agent"},"stream_sid":{"type":"string","example":"MZ1234567890abcdef1234567890abcdef"},"supervisor":{"type":"string","example":"dashboard"},"target":{"type":["string","null"],"example":"+15555551234"},"tenant_id":{"type":"string","example":"tenant-123"}}},"SupervisorActionType":{"type":"string","description":"SupervisorActionType schema used by the StateSet Voice API.","enum":["monitor","whisper","barge","escalate","end"]},"TenantApiKeyMetadata":{"type":"object","description":"TenantApiKeyMetadata schema used by the StateSet Voice API.","required":["id","key_prefix","created_at"],"properties":{"created_at":{"type":"string","format":"date-time"},"id":{"type":"string","format":"uuid"},"key_prefix":{"type":"string"},"label":{"type":["string","null"]},"last_used_at":{"type":["string","null"],"format":"date-time"},"revoked_at":{"type":["string","null"],"format":"date-time"}}},"TenantConfigDocument":{"type":"object","description":"Full tenant configuration document. Secret values may be supplied by administrators but are redacted from read responses.","required":["tenant_id"],"properties":{"model":{"type":["string","null"],"description":"Realtime model used by this tenant","example":"gpt-realtime"},"org_id":{"type":["string","null"],"description":"Optional organization identifier","example":"org_123"},"system_prompt_key":{"type":["string","null"],"description":"System prompt key for the tenant's voice agent","example":"support_default"},"tenant_id":{"type":"string","description":"Stable tenant identifier","example":"tenant_123"},"twilio":{"description":"Twilio-specific tenant configuration"},"voice":{"type":["string","null"],"description":"Voice used for generated speech","example":"alloy"}},"example":{"model":"gpt-realtime","org_id":"org_123","system_prompt_key":"support_default","tenant_id":"tenant_123","twilio":{"account_sid":"AC1234567890abcdef1234567890abcdef","from_number":"+15555551234"},"voice":"alloy"}},"TenantMutationResponse":{"type":"object","description":"TenantMutationResponse schema used by the StateSet Voice API.","required":["ok","tenant_id"],"properties":{"ok":{"type":"boolean"},"tenant_id":{"type":"string"}}},"TenantResponse":{"type":"object","description":"TenantResponse schema used by the StateSet Voice API.","required":["ok","tenant_id","etag","config"],"properties":{"config":{},"etag":{"type":"string"},"ok":{"type":"boolean"},"tenant_id":{"type":"string"}}},"TenantRuntimeConfigPatch":{"type":"object","description":"Partial tenant runtime configuration patch. Only supplied fields are merged into the active tenant config; arbitrary tenant-specific configuration keys are accepted.","properties":{"model":{"type":["string","null"],"description":"Realtime model to use for new sessions","example":"gpt-realtime"},"system_prompt_key":{"type":["string","null"],"description":"System prompt key for the tenant's voice agent","example":"support_default"},"twilio":{"description":"Twilio-specific runtime configuration patch"},"voice":{"type":["string","null"],"description":"Voice to use for generated speech","example":"alloy"},"webhook_url":{"type":["string","null"],"description":"Optional webhook URL for tenant events","example":"https://example.com/webhooks/stateset-voice"}},"example":{"model":"gpt-realtime","system_prompt_key":"support_default","twilio":{"from_number":"+15555551234"},"voice":"alloy"}},"ToolDefinition":{"type":"object","description":"OpenAI-compatible function/tool definition with JSON Schema parameters","required":["type","name","description","parameters"],"properties":{"description":{"type":"string","description":"Function description","example":"Retrieves order information by order ID"},"name":{"type":"string","description":"Function name","example":"get_order"},"parameters":{"description":"JSON schema for parameters"},"type":{"type":"string","description":"Function type (always \"function\")","example":"function"}}},"ToolEntry":{"type":"object","description":"A single registered tool with its name and OpenAI-compatible function definition","required":["name","definition"],"properties":{"definition":{"$ref":"#/components/schemas/ToolDefinition","description":"Full function definition"},"name":{"type":"string","description":"Function name","example":"get_order"}}},"ToolsResponse":{"type":"object","description":"List of all registered AI tool/function definitions available for the tenant","required":["tools","count"],"properties":{"count":{"type":"integer","description":"Total number of registered tools","example":15,"minimum":0},"tools":{"type":"array","items":{"$ref":"#/components/schemas/ToolEntry"},"description":"List of available functions"}},"example":{"count":2,"tools":[{"definition":{"description":"Look up the current status of an order","name":"get_order","parameters":{"properties":{"order_id":{"description":"Order ID like ORD-12345","type":"string"}},"required":["order_id"],"type":"object"},"type":"function"},"name":"get_order"},{"definition":{"description":"Transfer the current call to a human agent","name":"escalate_call_to_human","parameters":{"properties":{"reason":{"type":"string"},"target_number":{"description":"E.164 target number","type":"string"}},"required":["target_number"],"type":"object"},"type":"function"},"name":"escalate_call_to_human"}]}},"TranscriptEntry":{"type":"object","description":"A single turn in the voice conversation transcript","required":["role","content","timestamp"],"properties":{"content":{"type":"string","description":"Content of the message","example":"Hi, I'd like to check the status of my order"},"role":{"type":"string","description":"Role of the speaker: \"user\", \"assistant\", or \"system\"","example":"user"},"timestamp":{"type":"string","description":"When this message was spoken (ISO 8601)","example":"2024-01-15T10:30:15Z"}}},"TranslationCallRequest":{"type":"object","description":"TranslationCallRequest schema used by the StateSet Voice API.","required":["participant_a","participant_b"],"properties":{"from":{"type":["string","null"],"example":"+15551234567"},"language_a":{"type":"string","example":"en"},"language_b":{"type":"string","example":"es"},"participant_a":{"type":"string","example":"+15551230001"},"participant_b":{"type":"string","example":"+15551230002"}}},"TranslationCallResponse":{"type":"object","description":"TranslationCallResponse schema used by the StateSet Voice API.","required":["ok","room_id"],"properties":{"error":{"type":["string","null"],"example":"Twilio not configured"},"ok":{"type":"boolean","example":true},"participant_a_call_sid":{"type":["string","null"],"example":"CA123"},"participant_b_call_sid":{"type":["string","null"],"example":"CA456"},"room_id":{"type":"string","example":"8f1f7d28-0ea9-4531-95d7-8d8f0fd72516"}}},"UnsnoozeCallbackTaskRequest":{"type":"object","description":"UnsnoozeCallbackTaskRequest schema used by the StateSet Voice API.","required":["operator"],"properties":{"note":{"type":["string","null"]},"operator":{"type":"string"}}},"UpdateCallbackTaskRequest":{"type":"object","description":"UpdateCallbackTaskRequest schema used by the StateSet Voice API.","properties":{"assigned_to":{"type":["string","null"]},"disposition":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CallbackDisposition"}]},"due_at":{"type":["string","null"],"format":"date-time"},"metadata":{},"notes":{"type":["string","null"]},"priority":{"type":["integer","null"],"format":"int32"},"queue_key":{"type":["string","null"]},"sla_due_at":{"type":["string","null"],"format":"date-time"},"status":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CallbackTaskStatus"}]},"summary":{"type":["string","null"]}}},"UpsertOperatorQueueRequest":{"type":"object","description":"UpsertOperatorQueueRequest schema used by the StateSet Voice API.","required":["name"],"properties":{"active":{"type":"boolean"},"auto_dispatch_delay_seconds":{"type":["integer","null"],"format":"int32"},"auto_dispatch_enabled":{"type":"boolean"},"auto_dispatch_max_attempts":{"type":"integer","format":"int32"},"auto_dispatch_retry_delay_seconds":{"type":["integer","null"],"format":"int32"},"default_assignee":{"type":["string","null"]},"description":{"type":["string","null"]},"dispatch_schedule":{},"dispatch_timezone":{"type":["string","null"]},"dispatch_window_end_hour_utc":{"type":["integer","null"],"format":"int32"},"dispatch_window_start_hour_utc":{"type":["integer","null"],"format":"int32"},"follow_up_escalation_assignee":{"type":["string","null"]},"follow_up_escalation_priority":{"type":["integer","null"],"format":"int32"},"follow_up_escalation_queue_key":{"type":["string","null"]},"follow_up_escalation_seconds":{"type":["integer","null"],"format":"int32"},"is_default":{"type":"boolean"},"metadata":{},"name":{"type":"string"},"priority":{"type":"integer","format":"int32"},"sla_seconds":{"type":["integer","null"],"format":"int32"}}},"UpsertPhoneNumberRoute":{"type":"object","description":"UpsertPhoneNumberRoute schema used by the StateSet Voice API.","required":["phone_number","direction","agent_id"],"properties":{"agent_id":{"type":"string","format":"uuid"},"agent_version_id":{"type":["string","null"],"format":"uuid"},"direction":{"$ref":"#/components/schemas/PhoneNumberRouteDirection"},"greeting":{"type":["string","null"]},"id":{"type":["string","null"],"format":"uuid"},"phone_number":{"type":"string"}}},"UpsertRolloutGovernancePolicy":{"type":"object","description":"UpsertRolloutGovernancePolicy schema used by the StateSet Voice API.","required":["enabled","lookback_hours","min_eval_count","min_avg_score"],"properties":{"enabled":{"type":"boolean"},"lookback_hours":{"type":"integer","format":"int32"},"min_avg_score":{"type":"number","format":"double"},"min_eval_count":{"type":"integer","format":"int32"},"min_high_quality_rate":{"type":["number","null"],"format":"double"}}},"ValidateTenantResponse":{"type":"object","description":"ValidateTenantResponse schema used by the StateSet Voice API.","required":["ok"],"properties":{"error":{"type":["string","null"]},"ok":{"type":"boolean"},"runtime":{}}},"VoiceOutcome":{"type":"object","description":"VoiceOutcome schema used by the StateSet Voice API.","required":["id","tenant_id","stream_sid","resolution","billing_status","outcome_source","escalated","disposition","metadata","occurred_at","created_at","updated_at"],"properties":{"agent_name":{"type":["string","null"]},"billable_sku":{"type":["string","null"]},"billing_status":{"type":"string"},"call_sid":{"type":["string","null"]},"call_type":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"},"customer_phone":{"type":["string","null"]},"disposition":{},"duration_seconds":{"type":["integer","null"],"format":"int32"},"escalated":{"type":"boolean"},"id":{"type":"string","format":"uuid"},"metadata":{},"occurred_at":{"type":"string","format":"date-time"},"org_id":{"type":["string","null"]},"outcome_source":{"type":"string"},"primary_intent":{"type":["string","null"]},"resolution":{"type":"string"},"risk_level":{"type":["string","null"]},"stream_sid":{"type":"string"},"tenant_id":{"type":"string"},"updated_at":{"type":"string","format":"date-time"}}},"VoiceOutcomeCount":{"type":"object","description":"VoiceOutcomeCount schema used by the StateSet Voice API.","required":["name","count"],"properties":{"count":{"type":"integer","format":"int64"},"name":{"type":"string"}}},"VoiceOutcomeDetailResponse":{"type":"object","description":"VoiceOutcomeDetailResponse schema used by the StateSet Voice API.","required":["ok","tenant","outcome"],"properties":{"ok":{"type":"boolean"},"outcome":{"$ref":"#/components/schemas/VoiceOutcome"},"tenant":{"type":"string"}}},"VoiceOutcomeStats":{"type":"object","description":"VoiceOutcomeStats schema used by the StateSet Voice API.","required":["total","billable","not_billable","pending_emit","emitted","failed_billing","escalated","resolution_mix","billing_status_mix","sku_mix","risk_mix"],"properties":{"avg_duration_seconds":{"type":["number","null"],"format":"double"},"billable":{"type":"integer","format":"int64"},"billing_status_mix":{"type":"array","items":{"$ref":"#/components/schemas/VoiceOutcomeCount"}},"emitted":{"type":"integer","format":"int64"},"escalated":{"type":"integer","format":"int64"},"failed_billing":{"type":"integer","format":"int64"},"not_billable":{"type":"integer","format":"int64"},"pending_emit":{"type":"integer","format":"int64"},"resolution_mix":{"type":"array","items":{"$ref":"#/components/schemas/VoiceOutcomeCount"}},"risk_mix":{"type":"array","items":{"$ref":"#/components/schemas/VoiceOutcomeCount"}},"sku_mix":{"type":"array","items":{"$ref":"#/components/schemas/VoiceOutcomeCount"}},"total":{"type":"integer","format":"int64"}}},"VoiceOutcomeStatsResponse":{"type":"object","description":"VoiceOutcomeStatsResponse schema used by the StateSet Voice API.","required":["ok","tenant","stats"],"properties":{"ok":{"type":"boolean"},"stats":{"$ref":"#/components/schemas/VoiceOutcomeStats"},"tenant":{"type":"string"}}},"VoiceOutcomeTimeseries":{"type":"object","description":"VoiceOutcomeTimeseries schema used by the StateSet Voice API.","required":["window","bucket","points"],"properties":{"bucket":{"type":"string"},"points":{"type":"array","items":{"$ref":"#/components/schemas/VoiceOutcomeTimeseriesPoint"}},"window":{"type":"string"}}},"VoiceOutcomeTimeseriesPoint":{"type":"object","description":"VoiceOutcomeTimeseriesPoint schema used by the StateSet Voice API.","required":["bucket_start","total","billable","escalated","pending_emit"],"properties":{"avg_duration_seconds":{"type":["number","null"],"format":"double"},"billable":{"type":"integer","format":"int64"},"bucket_start":{"type":"string","format":"date-time"},"escalated":{"type":"integer","format":"int64"},"pending_emit":{"type":"integer","format":"int64"},"total":{"type":"integer","format":"int64"}}},"VoiceOutcomeTimeseriesResponse":{"type":"object","description":"VoiceOutcomeTimeseriesResponse schema used by the StateSet Voice API.","required":["ok","tenant","timeseries"],"properties":{"ok":{"type":"boolean"},"tenant":{"type":"string"},"timeseries":{"$ref":"#/components/schemas/VoiceOutcomeTimeseries"}}},"VoiceOutcomesListResponse":{"type":"object","description":"VoiceOutcomesListResponse schema used by the StateSet Voice API.","required":["ok","tenant","count","outcomes"],"properties":{"count":{"type":"integer","minimum":0},"ok":{"type":"boolean"},"outcomes":{"type":"array","items":{"$ref":"#/components/schemas/VoiceOutcome"}},"tenant":{"type":"string"}}},"VoiceSession":{"type":"object","description":"Persisted voice session record with transcript, function calls, and VAD metrics","required":["id","tenant_id","stream_id","status","transcript","function_calls","tags","turn_count","vad_events","metadata","started_at","ended_at","created_at","updated_at"],"properties":{"agent_name":{"type":["string","null"],"description":"AI agent name","example":"ResponseCX"},"call_sid":{"type":["string","null"],"description":"Twilio call SID","example":"CA1234567890abcdef1234567890abcdef"},"call_type":{"type":["string","null"],"description":"Type of call: inbound, outbound, sip_inbound","example":"inbound"},"created_at":{"type":"string","description":"Record creation time (ISO 8601)","example":"2024-01-15T10:30:00Z"},"customer_phone":{"type":["string","null"],"description":"Customer phone number (E.164)","example":"+15555555678"},"duration_ms":{"type":["integer","null"],"format":"int64","description":"Session duration in milliseconds","example":142000},"ended_at":{"type":"string","description":"Session end time (ISO 8601)","example":"2024-01-15T10:32:22Z"},"function_calls":{"description":"Function calls made during the session as JSON array"},"id":{"type":"string","description":"Unique session identifier","example":"550e8400-e29b-41d4-a716-446655440000"},"metadata":{"description":"Arbitrary session metadata"},"model":{"type":["string","null"],"description":"AI model used","example":"gpt-4o-realtime-preview"},"org_id":{"type":["string","null"],"description":"Organization ID","example":"org-456"},"rating":{"type":["integer","null"],"format":"int32","description":"Operator-provided review rating","example":4},"sentiment":{"type":["string","null"],"description":"Operator or model sentiment label","example":"positive"},"started_at":{"type":"string","description":"Session start time (ISO 8601)","example":"2024-01-15T10:30:00Z"},"status":{"type":"string","description":"Session status: active, completed","example":"completed"},"stream_id":{"type":"string","description":"Twilio stream ID","example":"MZ1234567890abcdef1234567890abcdef"},"summary":{"type":["string","null"],"description":"LLM-generated summary","example":"Customer inquired about order ORD-123 status. Agent confirmed it shipped yesterday."},"tags":{"type":"array","items":{"type":"string"},"description":"Session tags applied in the voice desk","example":["vip","escalation"]},"tenant_id":{"type":"string","description":"Tenant that owns this session","example":"tenant-123"},"transcript":{"description":"Conversation transcript as JSON array"},"turn_count":{"type":"integer","format":"int32","description":"Number of conversation turns","example":12},"updated_at":{"type":"string","description":"Record last updated time (ISO 8601)","example":"2024-01-15T10:32:22Z"},"vad_events":{"description":"Voice activity detection events as JSON array"},"voice":{"type":["string","null"],"description":"TTS voice used","example":"alloy"}}},"VoiceSessionEval":{"type":"object","description":"Persisted evaluation for a voice session","required":["id","tenant_id","session_id","voice_session_id","call_log_id","agent_version_id","score","tags","rubric","metadata","created_at","updated_at"],"properties":{"agent_key":{"type":["string","null"],"example":"support_primary"},"agent_name":{"type":["string","null"],"example":"StateSet Support"},"agent_version_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440003"},"call_log_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440002"},"created_at":{"type":"string","example":"2024-01-15T10:30:00Z"},"id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440000"},"metadata":{},"notes":{"type":["string","null"],"example":"The agent authenticated correctly and resolved the issue without escalation."},"rubric":{},"score":{"type":"number","format":"double","example":0.92},"session_id":{"type":"string","example":"MZ1234567890abcdef1234567890abcdef"},"source":{"type":["string","null"],"example":"auto"},"stream_id":{"type":["string","null"],"example":"MZ1234567890abcdef1234567890abcdef"},"tags":{"type":"array","items":{"type":"string"},"example":["resolved","authenticated"]},"tenant_id":{"type":"string","example":"tenant-123"},"updated_at":{"type":"string","example":"2024-01-15T10:32:22Z"},"voice_session_id":{"type":"string","example":"550e8400-e29b-41d4-a716-446655440001"}}},"VoiceSessionEvalStats":{"type":"object","description":"Aggregate evaluation metrics for a tenant","required":["total_evals","evals_last_24h"],"properties":{"avg_score":{"type":["number","null"],"format":"double","example":0.89},"evals_last_24h":{"type":"integer","format":"int64","example":12,"minimum":0},"high_quality_rate":{"type":["number","null"],"format":"double","example":0.76},"total_evals":{"type":"integer","format":"int64","example":125,"minimum":0}}},"WebhookCallCompletedPayload":{"type":"object","description":"Data payload included in call.completed webhook events","required":["stream_sid","direction","status","escalated","function_call_count","transcript_turn_count"],"properties":{"call_sid":{"type":["string","null"],"description":"Twilio call SID","example":"CA1234567890abcdef1234567890abcdef"},"direction":{"type":"string","description":"Call direction","example":"inbound"},"duration_seconds":{"type":["integer","null"],"format":"int32","description":"Call duration in seconds","example":142},"escalated":{"type":"boolean","description":"Whether the call was escalated to a human","example":false},"from_number":{"type":["string","null"],"description":"Caller phone number","example":"+15555555678"},"function_call_count":{"type":"integer","description":"Number of AI function calls made during the conversation","example":3,"minimum":0},"status":{"type":"string","description":"Final call status","example":"completed"},"stream_sid":{"type":"string","description":"Twilio stream SID","example":"MZ1234567890abcdef1234567890abcdef"},"summary":{"type":["string","null"],"description":"LLM-generated summary of the conversation","example":"Customer called to check order status for order #12345. Agent confirmed the order shipped yesterday via FedEx."},"to_number":{"type":["string","null"],"description":"Called phone number","example":"+15555551234"},"transcript_turn_count":{"type":"integer","description":"Number of transcript turns","example":12,"minimum":0}},"example":{"call_sid":"CA1234567890abcdef1234567890abcdef","direction":"inbound","duration_seconds":127,"escalated":false,"from_number":"+15555550101","function_call_count":3,"status":"completed","stream_sid":"MZ1234567890abcdef1234567890abcdef","summary":"Caller asked about appointment availability.","to_number":"+15555550199","transcript_turn_count":12}},"WebhookEscalationPayload":{"type":"object","description":"Data payload included in call.escalated webhook events","required":["stream_sid","target","initiated_by"],"properties":{"call_sid":{"type":["string","null"],"description":"Twilio call SID","example":"CA1234567890abcdef1234567890abcdef"},"from_number":{"type":["string","null"],"description":"Caller phone number","example":"+15555555678"},"initiated_by":{"type":"string","description":"Who initiated the escalation: \"ai\" or \"supervisor\"","example":"ai"},"reason":{"type":["string","null"],"description":"Reason the AI escalated the call","example":"Customer requested to speak with a human agent"},"stream_sid":{"type":"string","description":"Twilio stream SID","example":"MZ1234567890abcdef1234567890abcdef"},"target":{"type":"string","description":"Escalation target (phone number or SIP address)","example":"+15555559999"}},"example":{"call_sid":"CA1234567890abcdef1234567890abcdef","from_number":"+15555550101","initiated_by":"ai","reason":"Customer requested to speak with a human agent","stream_sid":"MZ1234567890abcdef1234567890abcdef","target":"+15555559999"}},"WebhookEvent":{"type":"object","description":"Webhook event envelope sent to external URLs when call events occur","required":["event","timestamp","tenant_id","data"],"properties":{"data":{"description":"Event-specific payload (shape depends on `event` type)"},"event":{"type":"string","description":"Event type identifier","example":"call.completed"},"tenant_id":{"type":"string","description":"Tenant that owns this event","example":"tenant-123"},"timestamp":{"type":"string","description":"ISO 8601 timestamp of when the event was emitted","example":"2024-01-15T10:35:00Z"}},"example":{"data":{"call_sid":"CA1234567890abcdef1234567890abcdef","direction":"inbound","duration_seconds":127,"escalated":false,"from_number":"+15555550101","status":"completed","stream_sid":"MZ1234567890abcdef1234567890abcdef","summary":"Caller asked about appointment availability.","to_number":"+15555550199"},"event":"voice.call.ended","tenant_id":"tenant_acme_dental","timestamp":"2026-05-14T17:42:09Z"}}},"securitySchemes":{"admin_key":{"type":"apiKey","in":"header","name":"x-admin-key","description":"Admin API key header. Required when ADMIN_API_KEY is configured."},"admin_session":{"type":"apiKey","in":"cookie","name":"stateset_admin_session","description":"HttpOnly browser session cookie created by the admin login endpoint."},"bearer_auth":{"type":"http","scheme":"bearer","bearerFormat":"Bearer"},"stream_token":{"type":"apiKey","in":"query","name":"stream_token","description":"Short-lived media stream token used during Twilio Media Streams WebSocket setup."},"twilio_signature":{"type":"apiKey","in":"header","name":"X-Twilio-Signature","description":"Twilio webhook signature used to verify callback authenticity."}}},"tags":[{"name":"health","description":"Health check and monitoring endpoints for Kubernetes probes and observability"},{"name":"calls","description":"Twilio call management - initiate outbound calls and handle webhooks"},{"name":"call_logs","description":"Tenant call history, call detail, and aggregate call statistics"},{"name":"admin","description":"Administrative endpoints for tenant/platform management (requires x-admin-key)"},{"name":"sessions","description":"Voice session management - monitor, control, and escalate active sessions"},{"name":"operations","description":"Supervisor workflow, callback queue, and operator follow-up endpoints"},{"name":"voice_sessions","description":"Persisted voice session records - list, query, and retrieve session history from the database"},{"name":"automation","description":"Automation and function execution - test and manage AI tool functions"},{"name":"logs","description":"Real-time log streaming via WebSocket for debugging and monitoring"},{"name":"media","description":"Real-time Twilio media streaming via WebSocket"},{"name":"access","description":"Public access request intake for Voice API prospects"},{"name":"webhooks","description":"Webhook payload schemas - documents the event payloads sent to external webhook URLs"}],"externalDocs":{"url":"https://voice.stateset.app/docs","description":"StateSet Voice API documentation"}}