{"openapi":"3.1.1","info":{"title":"Tellgence API by Pendoah AI","version":"1.0.0","description":"Backend API for the Tellgence AI-powered voice agent platform — session token minting, lead capture, and session persistence. Use **Authorize** in Swagger UI with a Clerk **Bearer** token for `/api/cp/*` routes.","termsOfService":"https://tellgence.pendoah.cloud/terms","contact":{"name":"Pendoah AI","email":"hello@tellgence.ai"}},"servers":[{"url":"/","description":"Current origin"},{"url":"https://tellgence-api.fleekbiz.cloud","description":"Staging"},{"url":"https://tellgence-api.pendoah.cloud","description":"Production"}],"tags":[{"name":"Health","description":"Service and dependency health checks"},{"name":"Session","description":"Mint ephemeral OpenAI/Azure Realtime tokens, personas, and voices"},{"name":"Leads","description":"Lead capture and session summary emails"},{"name":"Feedback","description":"End-of-demo feedback (thumbs up/down)"},{"name":"Sessions","description":"Persist, retrieve, and manage call state for demo sessions"},{"name":"Integrations","description":"Integration providers and connection test endpoints"},{"name":"Onboarding","description":"Fast-start onboarding profiles, readiness, and destination tests"},{"name":"Scenarios","description":"Demo scenario catalog — authoritative source-of-truth consumed by web/admin via generated clients"},{"name":"Tools","description":"Persona tool discovery and tool execution"},{"name":"Contact","description":"Contact form submission"},{"name":"Meta","description":"Build and deployment metadata"},{"name":"Webhooks","description":"External provider callbacks (Clerk, telephony)"},{"name":"Internal","description":"Orchestrator and server-to-server callbacks"},{"name":"Metrics","description":"Platform usage, booking rates, and scenario performance"},{"name":"Workflows","description":"Workflow state, draft, and publish operations"},{"name":"Control-plane Leads","description":"Operator-facing lead pipeline management, status updates, notes, and CSV export"},{"name":"Control-plane Auth","description":"Authenticated control-plane session and tenant-role resolution"},{"name":"Control-plane Pilots","description":"Pilot Mode: durable pilot records, status, notes"},{"name":"Control-plane Sessions","description":"Operator-facing session management, exceptions, and retry"},{"name":"Tools CP","description":"Admin inspection of tool execution journals and idempotency evidence"},{"name":"Public","description":"Publicly accessible read-only surfaces (SLOs, status — no auth)"},{"name":"Verticals","description":"Industry vertical pack metadata (read-only workflow lists)"},{"name":"Control-plane Verticals","description":"Admin-only vertical pack catalog (workflow definitions per industry)"},{"name":"Control-plane Scenarios","description":"Admin-only scenario catalog, including hidden and exception scenarios"},{"name":"Control-plane Tenants","description":"Tenant directory management"},{"name":"Control-plane Feature Flags","description":"Feature flag management and per-tenant overrides"},{"name":"Control-plane Support","description":"Support ticket management"},{"name":"Control-plane Audit Log","description":"Immutable audit trail for admin actions"},{"name":"Control-plane Billing Ops","description":"Cross-tenant billing and subscription management"},{"name":"Control-plane Compliance","description":"Compliance register and attestation tracking"}],"paths":{"/":{"get":{"tags":["Meta"],"summary":"API root","description":"Returns HTML when `Accept: text/html`; otherwise JSON with links to health and docs.","operationId":"getApiRoot","responses":{"200":{"description":"HTML landing or JSON API summary","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"version":{"type":"string"},"links":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["name"],"additionalProperties":{}}},"text/html":{"schema":{"type":"string"}}}}}}},"/api/webhooks/clerk":{"post":{"tags":["Webhooks"],"summary":"Clerk webhook (Svix-signed)","description":"Receives Clerk events with **raw JSON** body and Svix signature headers. Registered **before** generic JSON parsing. **Try it out** in Swagger will not reproduce Svix signing — configure the URL in Clerk Dashboard instead.","operationId":"postClerkWebhook","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Raw Clerk event payload (bytes verified with Svix in production)."}}}},"responses":{"200":{"description":"Event accepted"},"400":{"description":"Invalid body or verification failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"CLERK_WEBHOOK_SIGNING_SECRET not configured","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/telephony-events":{"post":{"tags":["Webhooks"],"summary":"Telephony / ACS call events","description":"Receives call-automation events with **raw JSON** body. When `TELEPHONY_WEBHOOK_SECRET` is set, `X-Telephony-Signature` must be HMAC-SHA256(hex) of the raw body.","operationId":"postTelephonyWebhook","parameters":[{"name":"x-telephony-signature","in":"header","required":false,"schema":{"type":"string"},"description":"HMAC-SHA256(secret, rawBody) as hex (when secret is configured)."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"responses":{"200":{"description":"Event processed"},"400":{"description":"Invalid payload or signature","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Invalid signature in real mode","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/internal/workflow/booking-lifecycle":{"post":{"tags":["Internal"],"summary":"Temporal booking lifecycle callback","description":"Server-to-server only. Header `x-tellgence-workflow-secret` must match `INTERNAL_WORKFLOW_CALLBACK_SECRET`. Returns **404** when the secret env is unset (route disabled).","operationId":"postInternalBookingLifecycle","security":[{"workflowSecret":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string","minLength":1},"action":{"type":"string","enum":["send_reminder","mark_no_show","complete_no_show_recovery"]}},"required":["sessionId","action"]}}}},"responses":{"200":{"description":"Lifecycle step applied","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"sessionId":{"type":"string"}},"required":["success","sessionId"],"additionalProperties":false}}}},"400":{"description":"Validation or business rule failure","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Missing or invalid secret"},"404":{"description":"Route disabled (no secret) or session not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/healthz":{"get":{"tags":["Health"],"summary":"Root liveness probe","description":"Process-level liveness endpoint exposed at the root for infrastructure probes.","operationId":"getRootLiveness","responses":{"200":{"description":"Process is alive","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"timestamp":{"type":"string"}},"required":["ok","timestamp"],"additionalProperties":false}}}}}}},"/readyz":{"get":{"tags":["Health"],"summary":"Root readiness probe","description":"Readiness endpoint exposed at the root for infrastructure probes.","operationId":"getRootReadiness","responses":{"200":{"description":"Ready","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"timestamp":{"type":"string"},"checks":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"boolean"}},"details":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"},"message":{"type":"string"},"mode":{"type":"string"},"endpoint":{"type":"string"},"appMode":{"type":"string"}},"required":["ok","status","message"],"additionalProperties":false}},"failures":{"type":"array","items":{"type":"object","properties":{"check":{"type":"string"},"status":{"type":"string"},"message":{"type":"string"}},"required":["check","status","message"],"additionalProperties":false}},"azure_openai_error":{"type":"string"},"real_application_runtime_warning":{"type":"string"}},"required":["ok","timestamp","checks"],"additionalProperties":false}}}},"503":{"description":"Not ready","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"timestamp":{"type":"string"},"checks":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"boolean"}},"details":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"},"message":{"type":"string"},"mode":{"type":"string"},"endpoint":{"type":"string"},"appMode":{"type":"string"}},"required":["ok","status","message"],"additionalProperties":false}},"failures":{"type":"array","items":{"type":"object","properties":{"check":{"type":"string"},"status":{"type":"string"},"message":{"type":"string"}},"required":["check","status","message"],"additionalProperties":false}},"azure_openai_error":{"type":"string"},"real_application_runtime_warning":{"type":"string"}},"required":["ok","timestamp","checks"],"additionalProperties":false}}}}}}},"/api/health":{"get":{"tags":["Health"],"summary":"Full health check","description":"Returns status for the API and AI provider connections.","operationId":"getHealth","responses":{"200":{"description":"All services healthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Overall health flag"},"timestamp":{"type":"string","description":"ISO-8601 timestamp"},"uptime":{"type":"number","description":"Process uptime in seconds"},"duration":{"description":"Check duration e.g. \"4ms\"","type":"string"},"services":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"configured":{"type":"boolean"},"healthy":{"type":"boolean"},"status":{"type":"string"},"mode":{"type":"string"},"endpoint":{"type":"string"},"error":{"type":"string"},"productionSafe":{"type":"boolean"},"overrideEnabled":{"type":"boolean"},"warning":{"type":"string"},"appMode":{"type":"string"}},"required":["configured","status"],"additionalProperties":false}},"environment":{"type":"string"},"version":{"type":"string"},"commit":{"type":"string"},"surface":{"description":"Hosted-app configuration snapshot (non-secret) for staging verification","type":"object","properties":{"appEnv":{"type":"string","description":"Deployment tier: local | dev | staging | prod"},"corsAllowedOrigins":{"type":"array","items":{"type":"string"},"description":"Origins from FRONTEND_URLS (browser CORS allow-list)"},"apiPublicBaseUrl":{"type":"string"},"webPublicBaseUrl":{"type":"string"},"temporalEnabled":{"type":"boolean"},"bookingTemporalOrchestration":{"type":"boolean","description":"FEATURE_BOOKING_TEMPORAL_ORCHESTRATION — durable reminder/no-show ticks via Temporal"},"internalWorkflowCallbacksConfigured":{"type":"boolean","description":"INTERNAL_WORKFLOW_CALLBACK_SECRET set (orchestrator → API callbacks)"},"realtime":{"description":"Azure OpenAI realtime credential minting configuration (no secrets or keys)","type":"object","properties":{"endpointConfigured":{"type":"boolean","description":"Non-secret: AZURE_OPENAI_ENDPOINT is set"},"deployment":{"type":"string","description":"Realtime GA deployment name (AZURE_OPENAI_DEPLOYMENT_REALTIME)"},"transcriptionModel":{"type":"string","description":"Input audio transcription deployment name (AZURE_OPENAI_TRANSCRIPTION_MODEL)"}},"required":["endpointConfigured","deployment","transcriptionModel"],"additionalProperties":false}},"required":["appEnv","corsAllowedOrigins","temporalEnabled","bookingTemporalOrchestration","internalWorkflowCallbacksConfigured"],"additionalProperties":false}},"required":["ok","timestamp","uptime"],"additionalProperties":false}}}},"503":{"description":"One or more services degraded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","description":"Overall health flag"},"timestamp":{"type":"string","description":"ISO-8601 timestamp"},"uptime":{"type":"number","description":"Process uptime in seconds"},"duration":{"description":"Check duration e.g. \"4ms\"","type":"string"},"services":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"configured":{"type":"boolean"},"healthy":{"type":"boolean"},"status":{"type":"string"},"mode":{"type":"string"},"endpoint":{"type":"string"},"error":{"type":"string"},"productionSafe":{"type":"boolean"},"overrideEnabled":{"type":"boolean"},"warning":{"type":"string"},"appMode":{"type":"string"}},"required":["configured","status"],"additionalProperties":false}},"environment":{"type":"string"},"version":{"type":"string"},"commit":{"type":"string"},"surface":{"description":"Hosted-app configuration snapshot (non-secret) for staging verification","type":"object","properties":{"appEnv":{"type":"string","description":"Deployment tier: local | dev | staging | prod"},"corsAllowedOrigins":{"type":"array","items":{"type":"string"},"description":"Origins from FRONTEND_URLS (browser CORS allow-list)"},"apiPublicBaseUrl":{"type":"string"},"webPublicBaseUrl":{"type":"string"},"temporalEnabled":{"type":"boolean"},"bookingTemporalOrchestration":{"type":"boolean","description":"FEATURE_BOOKING_TEMPORAL_ORCHESTRATION — durable reminder/no-show ticks via Temporal"},"internalWorkflowCallbacksConfigured":{"type":"boolean","description":"INTERNAL_WORKFLOW_CALLBACK_SECRET set (orchestrator → API callbacks)"},"realtime":{"description":"Azure OpenAI realtime credential minting configuration (no secrets or keys)","type":"object","properties":{"endpointConfigured":{"type":"boolean","description":"Non-secret: AZURE_OPENAI_ENDPOINT is set"},"deployment":{"type":"string","description":"Realtime GA deployment name (AZURE_OPENAI_DEPLOYMENT_REALTIME)"},"transcriptionModel":{"type":"string","description":"Input audio transcription deployment name (AZURE_OPENAI_TRANSCRIPTION_MODEL)"}},"required":["endpointConfigured","deployment","transcriptionModel"],"additionalProperties":false}},"required":["appEnv","corsAllowedOrigins","temporalEnabled","bookingTemporalOrchestration","internalWorkflowCallbacksConfigured"],"additionalProperties":false}},"required":["ok","timestamp","uptime"],"additionalProperties":false}}}}}}},"/api/health/live":{"get":{"tags":["Health"],"summary":"Liveness probe","description":"Returns 200 as long as the process is alive. Use for ACA / Kubernetes liveness checks.","operationId":"getLiveness","responses":{"200":{"description":"Process is alive","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"timestamp":{"type":"string"},"commit":{"type":"string"}},"required":["ok","timestamp"],"additionalProperties":false}}}}}}},"/api/health/ready":{"get":{"tags":["Health"],"summary":"Readiness probe","description":"Returns 200 only when all required dependencies are reachable. Returns 503 if the app should be removed from load-balancer rotation.","operationId":"getReadiness","responses":{"200":{"description":"All required dependencies ready","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"timestamp":{"type":"string"},"checks":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"boolean"}},"details":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"},"message":{"type":"string"},"mode":{"type":"string"},"endpoint":{"type":"string"},"appMode":{"type":"string"}},"required":["ok","status","message"],"additionalProperties":false}},"failures":{"type":"array","items":{"type":"object","properties":{"check":{"type":"string"},"status":{"type":"string"},"message":{"type":"string"}},"required":["check","status","message"],"additionalProperties":false}},"azure_openai_error":{"type":"string"},"real_application_runtime_warning":{"type":"string"}},"required":["ok","timestamp","checks"],"additionalProperties":false}}}},"503":{"description":"One or more required dependencies not ready","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"timestamp":{"type":"string"},"checks":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"boolean"}},"details":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"object","properties":{"ok":{"type":"boolean"},"status":{"type":"string"},"message":{"type":"string"},"mode":{"type":"string"},"endpoint":{"type":"string"},"appMode":{"type":"string"}},"required":["ok","status","message"],"additionalProperties":false}},"failures":{"type":"array","items":{"type":"object","properties":{"check":{"type":"string"},"status":{"type":"string"},"message":{"type":"string"}},"required":["check","status","message"],"additionalProperties":false}},"azure_openai_error":{"type":"string"},"real_application_runtime_warning":{"type":"string"}},"required":["ok","timestamp","checks"],"additionalProperties":false}}}}}}},"/api/health/realtime":{"get":{"tags":["Health"],"summary":"Lightweight liveness probe","operationId":"getHealthRealtime","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"timestamp":{"type":"string"},"uptime":{"type":"number"}},"required":["ok","timestamp","uptime"],"additionalProperties":false}}}}}}},"/api/personas":{"get":{"tags":["Session"],"summary":"Get persona catalog","operationId":"getPersonas","responses":{"200":{"description":"Persona catalog","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"displayName":{"type":"string"},"domain":{"type":"string"},"presentingGender":{"type":"string","enum":["male","female","neutral"]},"avatarKey":{"type":"string"},"description":{"type":"string"},"defaultVoice":{"type":"string"},"allowedVoices":{"type":"array","items":{"type":"string"}},"language":{"description":"Display language name (e.g. \"English\", \"Spanish\", \"Urdu\"). Required for personas where the avatar implies a specific spoken language; absent for legacy generic entries.","type":"string"},"locale":{"description":"BCP-47 (e.g. \"es-MX\", \"en-US\"). Used by the WelcomeOverlay picker to group voices and to enforce alignment with the persona's avatar.","type":"string"},"accentLabel":{"description":"Human-readable accent (e.g. \"Mexican Spanish\", \"Indian English\"). Surfaced as a chip next to the persona card.","type":"string"},"ageBand":{"description":"Apparent age band of the persona avatar.","type":"string","enum":["adult_20s","adult_30s","adult_40s","adult_50s","mature_60_plus"]},"professionalRole":{"description":"Free-text role title (e.g. \"Patient Intake Specialist\").","type":"string"},"defaultTone":{"description":"Comma-separated tone descriptors (e.g. \"calm, respectful, precise\"). Frontend may surface as a default-tone chip.","type":"string"},"humanVoiceReviewStatus":{"description":"Voice review state. \"approved\" suppresses the alignment validator's human-review warnings.","type":"string","enum":["pending","approved","needs_rerun"]},"assetStatus":{"description":"Avatar asset lifecycle state. \"missing\" entries are visible in admin but the avatar PNG is not yet promoted to the canonical web/admin paths.","type":"string","enum":["approved","usable_needs_review","regenerate_recommended","missing","rejected"]}},"required":["id","displayName","domain","presentingGender","avatarKey","description","defaultVoice","allowedVoices"],"additionalProperties":false}},"count":{"type":"number"},"version":{"type":"string"}},"required":["items","count","version"],"additionalProperties":false}}}}}}},"/api/personas/{personaId}/runtime":{"get":{"tags":["Session"],"summary":"Get full persona runtime configuration","description":"Returns complete persona configuration including instructions, temperature, max tokens, voice, turn detection, and tools. Use this to populate session.update() after WebRTC connection.","operationId":"getPersonaRuntime","parameters":[{"name":"personaId","in":"path","required":true,"schema":{"type":"string"},"description":"Persona ID (e.g., insurance_claims_intake)"},{"name":"onboardingProfileId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional fast-start onboarding profile ID used to inject customer context into runtime instructions."},{"name":"tone","in":"query","required":false,"schema":{"type":"string","enum":["warm","professional","friendly"]},"description":"Optional adaptive tone profile used to tailor instructions, voice, and temperature."},{"name":"scenarioId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional scenario slug (e.g. 'pulm-cpap-day7-adherence'). When provided, the service flows the scenario's `parameterization` (specialty / practiceSize / stateProfile / practiceBrand) through composePersonaRuntime — rebranding the AI's greeting + instructions to match the scenario's company. Without this, scenarios with `parameterization.practiceBrand` silently collapse to the base persona's hardcoded domain literal (Meridian / Pinnacle Financial / Morrison & Associates / Assured Auto / Gulf Coast Community Bank)."},{"name":"sessionId","in":"query","required":false,"schema":{"type":"string"},"description":"Optional session ID used for deterministic prompt-profile experiment assignment and session-level attribution."}],"responses":{"200":{"description":"Persona runtime configuration","content":{"application/json":{"schema":{"type":"object","properties":{"instructions":{"type":"string"},"temperature":{"type":"number"},"maxOutputTokens":{"type":"number"},"defaultVoice":{"type":"string"},"behaviorProfile":{"type":"object","properties":{"pacing":{"type":"string","enum":["calm","neutral","urgent"]},"empathy":{"type":"string","enum":["low","standard","high"]}},"additionalProperties":false},"turnDetection":{"anyOf":[{"type":"string","enum":["server_vad","semantic_vad"]},{"type":"null"}]},"turnDetectionConfig":{"description":"VAD configuration: server_vad for fast turns, semantic_vad for natural conversation","anyOf":[{"type":"object","properties":{"type":{"type":"string","const":"server_vad"},"threshold":{"description":"0-1, higher = louder audio required","type":"number"},"prefix_padding_ms":{"description":"Audio to include before VAD detected speech","type":"number"},"silence_duration_ms":{"description":"Duration of silence to detect speech stop","type":"number"},"create_response":{"type":"boolean"},"interrupt_response":{"type":"boolean"}},"required":["type"],"additionalProperties":false},{"type":"object","properties":{"type":{"type":"string","const":"semantic_vad"},"eagerness":{"description":"How eager to interrupt the user","type":"string","enum":["low","medium","high","auto"]},"create_response":{"type":"boolean"},"interrupt_response":{"type":"boolean"}},"required":["type"],"additionalProperties":false}]},"modalities":{"type":"array","items":{"type":"string","enum":["text","audio"]}},"inputAudioFormat":{"type":"string"},"outputAudioFormat":{"type":"string"},"inputAudioTranscription":{"type":"object","properties":{"model":{"type":"string"},"language":{"type":"string"}},"required":["model"],"additionalProperties":false},"tools":{"type":"array","items":{}},"capabilities":{"type":"array","items":{"type":"string"}},"workflowProfileId":{"type":"string"},"contextEnvelope":{"oneOf":[{"type":"object","properties":{"schemaVersion":{"type":"string","const":"v1"},"layers":{"type":"object","properties":{"globalVoiceContract":{"type":"string"},"personaId":{"type":"string"},"personaCoreSummary":{"type":"string"},"integrationHints":{"type":"string"}},"required":["globalVoiceContract","personaId","personaCoreSummary"],"additionalProperties":false}},"required":["schemaVersion","layers"],"additionalProperties":false},{"type":"object","properties":{"schemaVersion":{"type":"string","const":"v2"},"layers":{"type":"object","properties":{"globalVoiceContract":{"type":"string"},"personaId":{"type":"string"},"personaCoreSummary":{"type":"string"},"integrationHints":{"type":"string"},"tenantRuntimeHints":{"type":"string"},"connectorSurfaceSummary":{"type":"string"},"policyFingerprint":{"type":"string"}},"required":["globalVoiceContract","personaId","personaCoreSummary"],"additionalProperties":false}},"required":["schemaVersion","layers"],"additionalProperties":false}],"type":"object"},"languagePolicy":{"type":"object","properties":{"primary":{"type":"string","description":"BCP-47 primary language (e.g. es-MX, en-US). Used when no client hint is supplied."},"supported":{"type":"array","items":{"type":"string"},"description":"BCP-47 codes this persona legitimately supports. Must include `primary`."},"locked":{"type":"boolean","description":"When true, API rejects client hints outside `supported` and forces `primary` (or an in-list hint)."},"lockReason":{"description":"Human-readable UI explanation for locked scenarios.","type":"string"},"labels":{"description":"UI labels keyed by BCP-47 code.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["primary","supported","locked"],"additionalProperties":false},"recommendedLanguages":{"description":"Soft curation hint for the language picker. BCP-47 list of languages this persona is validated for. Frontend renders these as a \"Recommended\" group above the long tail. Ignored when languagePolicy.locked is true.","type":"array","items":{"type":"string"}},"greetingInstruction":{"type":"string"},"transcriptionPrompt":{"type":"string"},"brandLiteral":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"voicePipeline":{"type":"string","enum":["azure-openai-realtime","azure-voice-live"]},"voiceLiveConfig":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"promptProfileExperiment":{"description":"Deterministic prompt-profile experiment assignment for this runtime payload.","type":"object","properties":{"experimentId":{"type":"string"},"variantId":{"type":"string"},"assignmentHash":{"type":"integer","minimum":0,"maximum":9007199254740991},"assignedAt":{"type":"string"}},"required":["experimentId","variantId","assignmentHash","assignedAt"],"additionalProperties":false}},"required":["instructions","temperature","maxOutputTokens","defaultVoice","turnDetection","tools"],"additionalProperties":false}}}},"400":{"description":"Missing personaId","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Internal access required when onboardingProfileId is provided","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Persona not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/voices":{"get":{"tags":["Session"],"summary":"Get available voice catalog","description":"Returns the canonical list of allowed voices with metadata. Frontend should use this to populate voice pickers and validate selections.","operationId":"getVoices","responses":{"200":{"description":"Voice catalog","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"gender":{"type":"string","enum":["male","female","neutral"]},"provider":{"type":"string","enum":["azure","openai"]}},"required":["id","name","gender","provider"],"additionalProperties":false}},"count":{"type":"number"}},"required":["items","count"],"additionalProperties":false}}}}}}},"/api/realtime/credentials":{"post":{"tags":["Session"],"summary":"Mint Realtime credentials from persona policy","description":"When API_KEY_FOR_REALTIME is set, requests must include x-api-key header or Authorization: ApiKey with the same value. When unset, no key is required.","operationId":"createRealtimeCredentials","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"personaId":{"type":"string"},"sessionId":{"description":"Optional server-owned session id. When present, persona selection resolves against the stored scenario and requestedLocale.","type":"string"},"requestedLocale":{"description":"Optional BCP-47 locale override for persona selection. Falls back to the stored session requestedLocale when sessionId is present.","type":"string"},"userHintLanguage":{"description":"BCP-47 language hint. Never overrides a locked languagePolicy. Falls back to `en` when no persona policy exists.","type":"string"},"scenarioId":{"description":"Optional scenario slug. Healthcare personas use the scenario parameterization block to inject specialty / practice-size / state-compliance / brand prompt fragments into the Azure Realtime session instructions.","type":"string"}}}}}},"responses":{"200":{"description":"Realtime credentials created","content":{"application/json":{"schema":{"type":"object","properties":{"token":{"type":"string"},"expiresAt":{"type":"string"},"webrtcUrl":{"anyOf":[{"type":"string"},{"type":"null"}]},"transcriptionModel":{"type":"string"},"realtimeDeployment":{"type":"string"},"sessionTier":{"type":"string","enum":["standard","professional","premium"]},"effectiveReasoningEffort":{"type":"string","enum":["minimal","low","medium","high"]},"fallbackInstructions":{"type":"string"},"fallbackVoice":{"type":"string"},"selectedPersonaId":{"type":"string"},"selectedPersonaLocale":{"type":"string"},"personaSelectionReason":{"type":"string","enum":["exact-locale","language-only","preferred-persona","en-us-fallback","untagged-fallback","catalog-fallback"]},"effectiveLanguage":{"type":"string"},"transcriptionLanguageCode":{"type":"string"},"languageLocked":{"type":"boolean"},"lockReason":{"type":"string"},"supportedLanguages":{"type":"array","items":{"type":"string"}},"languageLabels":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"languagePolicyInstructions":{"type":"string"},"voicePipeline":{"type":"string","enum":["azure-openai-realtime","azure-voice-live"]},"wsUrl":{"type":"string"},"voiceLiveSessionConfig":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["token","expiresAt","webrtcUrl"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"API key required but missing or invalid (when API_KEY_FOR_REALTIME is set)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Persona not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Upstream provider error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Azure OpenAI not configured or unavailable","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/realtime/sessions":{"post":{"tags":["Session"],"summary":"Create a realtime runtime session","operationId":"createRealtimeRuntimeSession","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string","minLength":1,"maxLength":256},"personaId":{"type":"string","minLength":1,"maxLength":256},"personaName":{"type":"string","minLength":1,"maxLength":256},"locale":{"type":"string","minLength":2,"maxLength":32},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"channelId":{"type":"string","minLength":1,"maxLength":256},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["personaId","personaName","locale","transportMode"]}}}},"responses":{"200":{"description":"Realtime runtime session created","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"sessionId":{"type":"string"},"tenantId":{"type":"string"},"personaId":{"type":"string"},"personaName":{"type":"string"},"locale":{"type":"string"},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"channelId":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"number"},"updatedAt":{"type":"number"},"state":{"type":"string","enum":["initializing","connected","active","paused","closing","closed"]},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"toolCallCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastUtteranceId":{"type":"string"},"mediaStats":{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"],"additionalProperties":false}},"required":["sessionId","tenantId","personaId","personaName","locale","transportMode","createdAt","updatedAt","state","utteranceCount","interruptionCount","toolCallCount"],"additionalProperties":false},"transcript":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"speaker":{"type":"string"},"text":{"type":"string"},"startTime":{"type":"number"},"endTime":{"type":"number"},"confidence":{"type":"number"},"locale":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","sessionId","speaker","text","startTime","endTime","confidence","locale"],"additionalProperties":false}},"evidence":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"stats":{"anyOf":[{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"],"additionalProperties":false},{"type":"null"}]}},"required":["session","transcript","evidence","stats"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/realtime/sessions/{sessionId}":{"get":{"tags":["Session"],"summary":"Get a realtime runtime session","operationId":"getRealtimeRuntimeSession","parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Realtime runtime session detail","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"sessionId":{"type":"string"},"tenantId":{"type":"string"},"personaId":{"type":"string"},"personaName":{"type":"string"},"locale":{"type":"string"},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"channelId":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"number"},"updatedAt":{"type":"number"},"state":{"type":"string","enum":["initializing","connected","active","paused","closing","closed"]},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"toolCallCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastUtteranceId":{"type":"string"},"mediaStats":{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"],"additionalProperties":false}},"required":["sessionId","tenantId","personaId","personaName","locale","transportMode","createdAt","updatedAt","state","utteranceCount","interruptionCount","toolCallCount"],"additionalProperties":false},"transcript":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"speaker":{"type":"string"},"text":{"type":"string"},"startTime":{"type":"number"},"endTime":{"type":"number"},"confidence":{"type":"number"},"locale":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","sessionId","speaker","text","startTime","endTime","confidence","locale"],"additionalProperties":false}},"evidence":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"stats":{"anyOf":[{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"],"additionalProperties":false},{"type":"null"}]}},"required":["session","transcript","evidence","stats"],"additionalProperties":false}}}},"404":{"description":"Session not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/realtime/sessions/{sessionId}/utterances":{"post":{"tags":["Session"],"summary":"Record a realtime utterance","operationId":"recordRealtimeRuntimeUtterance","parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"speaker":{"type":"string","minLength":1,"maxLength":64},"text":{"type":"string","minLength":1},"startTime":{"type":"number","minimum":0},"endTime":{"type":"number","minimum":0},"confidence":{"type":"number","minimum":0,"maximum":1},"locale":{"type":"string","minLength":2,"maxLength":32},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["speaker","text"]}}}},"responses":{"200":{"description":"Utterance recorded","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"sessionId":{"type":"string"},"tenantId":{"type":"string"},"personaId":{"type":"string"},"personaName":{"type":"string"},"locale":{"type":"string"},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"channelId":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"number"},"updatedAt":{"type":"number"},"state":{"type":"string","enum":["initializing","connected","active","paused","closing","closed"]},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"toolCallCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastUtteranceId":{"type":"string"},"mediaStats":{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"],"additionalProperties":false}},"required":["sessionId","tenantId","personaId","personaName","locale","transportMode","createdAt","updatedAt","state","utteranceCount","interruptionCount","toolCallCount"],"additionalProperties":false},"transcript":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"speaker":{"type":"string"},"text":{"type":"string"},"startTime":{"type":"number"},"endTime":{"type":"number"},"confidence":{"type":"number"},"locale":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","sessionId","speaker","text","startTime","endTime","confidence","locale"],"additionalProperties":false}},"evidence":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"stats":{"anyOf":[{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"],"additionalProperties":false},{"type":"null"}]}},"required":["session","transcript","evidence","stats"],"additionalProperties":false}}}}}}},"/api/realtime/sessions/{sessionId}/stats":{"post":{"tags":["Session"],"summary":"Update realtime session stats","operationId":"recordRealtimeRuntimeStats","parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"]}}}},"responses":{"200":{"description":"Realtime session detail","content":{"application/json":{"schema":{"type":"object","properties":{"session":{"type":"object","properties":{"sessionId":{"type":"string"},"tenantId":{"type":"string"},"personaId":{"type":"string"},"personaName":{"type":"string"},"locale":{"type":"string"},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"channelId":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"number"},"updatedAt":{"type":"number"},"state":{"type":"string","enum":["initializing","connected","active","paused","closing","closed"]},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"toolCallCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastUtteranceId":{"type":"string"},"mediaStats":{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"],"additionalProperties":false}},"required":["sessionId","tenantId","personaId","personaName","locale","transportMode","createdAt","updatedAt","state","utteranceCount","interruptionCount","toolCallCount"],"additionalProperties":false},"transcript":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"speaker":{"type":"string"},"text":{"type":"string"},"startTime":{"type":"number"},"endTime":{"type":"number"},"confidence":{"type":"number"},"locale":{"type":"string"},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","sessionId","speaker","text","startTime","endTime","confidence","locale"],"additionalProperties":false}},"evidence":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"stats":{"anyOf":[{"type":"object","properties":{"sessionId":{"type":"string","minLength":1,"maxLength":256},"transportMode":{"type":"string","enum":["BROWSER_REALTIME","TELEPHONY_LIVEKIT","FALLBACK_CASCADE"]},"uptime":{"type":"number","minimum":0},"utteranceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"lastActivity":{"type":"number","minimum":0},"participantId":{"type":"string"},"interruptionCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageLatencyMs":{"type":"number","minimum":0},"audioQuality":{"type":"string","enum":["excellent","good","fair","poor"]},"jitterMs":{"type":"number","minimum":0},"packetLoss":{"type":"number","minimum":0},"bitrate":{"type":"number","minimum":0},"cpuUsage":{"type":"number","minimum":0}},"required":["sessionId","transportMode","uptime","utteranceCount","lastActivity"],"additionalProperties":false},{"type":"null"}]}},"required":["session","transcript","evidence","stats"],"additionalProperties":false}}}}}}},"/api/leads":{"post":{"tags":["Leads"],"summary":"Submit a post-demo lead","description":"Captures lead data after a completed demo session and notifies the sales team.","operationId":"createLead","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Full name","example":"Jane Smith"},"email":{"type":"string","description":"Email address","example":"jane@acme.com"},"company":{"example":"Acme Corp","type":"string"},"role":{"example":"VP of Operations","type":"string"},"phone":{"example":"+1-555-0100","type":"string"},"source":{"example":"demo-results","type":"string"},"sourcePath":{"example":"/demo/healthcare-intake/results","type":"string"},"referrer":{"example":"https://tellgence.pendoah.cloud/demo","type":"string"},"utmSource":{"example":"google","type":"string"},"utmMedium":{"example":"cpc","type":"string"},"utmCampaign":{"example":"healthcare-intake","type":"string"},"scenarioId":{"type":"string","example":"insurance-fnol"},"scenarioTitle":{"type":"string"},"timestamp":{"type":"string","description":"ISO-8601 submission time"},"sessionDuration":{"type":"number","description":"Duration in seconds"},"toolsInvoked":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"timelineEvents":{"type":"array","items":{"type":"object","properties":{"title":{"type":"string"},"description":{"type":"string"},"timestamp":{"type":"string"}},"required":["title","description","timestamp"]}},"score":{"type":"number"},"tier":{"description":"cold | warm | hot","type":"string"},"scoreLabel":{"type":"string"}},"required":["name","email","scenarioId","timestamp","sessionDuration","toolsInvoked","timelineEvents"]}}}},"responses":{"200":{"description":"Lead captured","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"leadId":{"type":"string","example":"LEAD-12345678"},"score":{"type":"number"},"tier":{"type":"string"},"emailDelivered":{"type":"boolean"}},"required":["success","message","leadId","score","tier","emailDelivered"],"additionalProperties":false}}}},"202":{"description":"Lead captured, email delivery failed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"leadId":{"type":"string","example":"LEAD-12345678"},"score":{"type":"number"},"tier":{"type":"string"},"emailDelivered":{"type":"boolean"}},"required":["success","message","leadId","score","tier","emailDelivered"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/leads/mid-demo":{"post":{"tags":["Leads"],"summary":"Capture a mid-demo lead","description":"High-intent capture triggered during an active demo session.","operationId":"createMidDemoLead","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","example":"jane@acme.com"},"company":{"type":"string"},"role":{"example":"Operations Director","type":"string"},"scenario":{"type":"string","example":"insurance-fnol"},"sessionId":{"type":"string"},"sourcePath":{"example":"/demo/insurance-fnol","type":"string"},"referrer":{"example":"https://www.google.com/","type":"string"},"utmSource":{"example":"linkedin","type":"string"},"utmMedium":{"example":"paid-social","type":"string"},"utmCampaign":{"example":"demo-funnel","type":"string"},"source":{"type":"string","const":"mid-demo-capture"}},"required":["email","scenario","source"]}}}},"responses":{"201":{"description":"Lead captured","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"leadId":{"type":"string","example":"MID-DEMO-LEAD-12345678"},"email":{"type":"string"},"scenario":{"type":"string"},"timestamp":{"type":"string"},"emailDelivered":{"type":"boolean"},"source":{"type":"string","const":"mid-demo-capture"}},"required":["success","message","leadId","emailDelivered"],"additionalProperties":false}}}},"202":{"description":"Lead captured, email delivery failed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"},"leadId":{"type":"string","example":"MID-DEMO-LEAD-12345678"},"email":{"type":"string"},"scenario":{"type":"string"},"timestamp":{"type":"string"},"emailDelivered":{"type":"boolean"},"source":{"type":"string","const":"mid-demo-capture"}},"required":["success","message","leadId","emailDelivered"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/leads/session-summary":{"post":{"tags":["Leads"],"summary":"Email a session summary to a prospect","description":"Sends the demo transcript and impact metrics directly to the prospect's inbox after the demo.","operationId":"sendSessionSummary","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","example":"jane@acme.com"},"scenarioTitle":{"type":"string","example":"Insurance FNOL"},"scenarioSlug":{"type":"string"},"toolsExecuted":{"type":"number"},"systemsUpdated":{"type":"number"},"timeSaved":{"description":"Estimated minutes saved","type":"number"},"sessionDuration":{"description":"Duration in ms","type":"number"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}},"required":["role","content"]}}},"required":["email","scenarioTitle"]}}}},"responses":{"200":{"description":"Email sent (or logged in dev)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"emailDelivered":{"type":"boolean"},"message":{"type":"string"}},"required":["success"],"additionalProperties":false}}}},"202":{"description":"Summary captured but email delivery failed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"emailDelivered":{"type":"boolean"},"message":{"type":"string"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/leads/transcript-email":{"post":{"tags":["Leads"],"summary":"Email transcript only (no lead capture)","description":"Send the conversation transcript to the given email. For compliance/record-keeping. No name or lead data required.","operationId":"sendTranscriptEmail","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","example":"jane@acme.com"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"content":{"type":"string"}},"required":["role","content"]},"description":"Conversation transcript (e.g. user/assistant turns)"},"scenarioTitle":{"example":"Insurance FNOL","type":"string"}},"required":["email","transcript"]}}}},"responses":{"200":{"description":"Email sent (or logged in dev)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"emailDelivered":{"type":"boolean"},"message":{"type":"string"}},"required":["success"],"additionalProperties":false}}}},"202":{"description":"Request accepted but email delivery failed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"emailDelivered":{"type":"boolean"},"message":{"type":"string"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/feedback":{"post":{"tags":["Feedback"],"summary":"Submit end-of-demo feedback","description":"Thumbs up (2) or thumbs down (1) with optional comment. Used for product/sales satisfaction signal.","operationId":"submitFeedback","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"rating":{"anyOf":[{"type":"number","const":1},{"type":"number","const":2}],"description":"1 = thumbs down, 2 = thumbs up"},"comment":{"description":"Optional free-text feedback","type":"string"},"scenarioId":{"type":"string","example":"insurance-fnol"},"sessionId":{"type":"string"}},"required":["rating","scenarioId"]}}}},"responses":{"201":{"description":"Feedback submitted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"id":{"type":"string","example":"FB-12345678"}},"required":["success","id"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions":{"get":{"tags":["Sessions"],"summary":"List admin-visible sessions","description":"Returns completed session summaries for authenticated admin callers.","operationId":"listSessions","parameters":[{"in":"query","name":"search","schema":{"type":"string"}},{"in":"query","name":"domain","schema":{"type":"string"}},{"in":"query","name":"leadTier","schema":{"type":"string","enum":["hot","warm","cold"]}},{"in":"query","name":"disposition","schema":{"type":"string","enum":["resolved","booked","qualified","follow_up_required","escalated","abandoned"]}},{"in":"query","name":"sortBy","schema":{"type":"string","enum":["createdAt","leadScore","duration"]}},{"in":"query","name":"sortOrder","schema":{"type":"string","enum":["asc","desc"]}},{"in":"query","name":"page","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"in":"query","name":"pageSize","schema":{"type":"integer","minimum":5,"maximum":100}}],"responses":{"200":{"description":"Session summaries","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"sessions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"scenarioId":{"type":"string"},"companyName":{"type":"string"},"domainModuleId":{"anyOf":[{"type":"string"},{"type":"null"}]},"interactionSummary":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"contact":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"intent":{"type":"string"},"disposition":{"type":"string","enum":["resolved","booked","qualified","follow_up_required","escalated","abandoned"]},"telephony":{"type":"object","properties":{"requested":{"type":"boolean"},"mode":{"type":"string","enum":["live_transfer","callback"]},"status":{"type":"string","enum":["not_required","pending","queued","completed","failed"]},"target":{"type":"string"},"phoneNumber":{"type":"string"},"timeWindow":{"type":"string"},"providerId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"escalation":{"type":"object","properties":{"requested":{"type":"boolean"},"reason":{"type":"string"},"target":{"type":"string"},"status":{"type":"string","enum":["pending","completed","not_required"]}},"required":["requested"],"additionalProperties":false},"booking":{"type":"object","properties":{"requested":{"type":"boolean"},"status":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"scheduledFor":{"type":"string"},"referenceId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"summary":{"type":"string"},"nextAction":{"type":"string"}},"additionalProperties":false},{"type":"null"}]},"accountingArCollectionsPayload":{"anyOf":[{"type":"object","properties":{"account":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false},"accounts":{"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false}},"collection":{"type":"object","properties":{"reason":{"type":"string"},"paymentIntent":{"type":"string","enum":["ready_to_pay","promise_to_pay","disputes_balance","needs_review"]},"promiseDate":{"type":"string"},"disputeReason":{"type":"string"},"callbackRequested":{"type":"boolean"},"callbackWindow":{"type":"string"},"escalationTarget":{"type":"string"},"notes":{"type":"string"}},"required":["reason","paymentIntent","callbackRequested"],"additionalProperties":false}},"required":["account","collection"],"additionalProperties":false},{"type":"null"}]},"bookingOutcome":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]},"nextReminderDueAt":{"type":"string"},"reminderAttemptCount":{"type":"number"},"lastReminderResult":{"type":"string","enum":["not_sent","queued","sent","failed"]},"backfillCandidateCount":{"type":"number"},"reminderScheduledFor":{"type":"string"},"reminderAttempts":{"type":"number"},"lastTransitionAction":{"type":"string","enum":["confirm","request_reschedule","cancel","mark_no_show","send_reminder","mark_reminder_failed","complete_no_show_recovery"]},"externalEventId":{"type":"string"},"externalProvider":{"type":"string"},"confirmationCode":{"type":"string"},"updatedAt":{"type":"string"},"bookingOrchestration":{"type":"object","properties":{"workflowId":{"type":"string"},"phase":{"type":"string","enum":["reminder_pending","completed","cancelled"]},"updatedAt":{"type":"string"}},"required":["workflowId","phase","updatedAt"],"additionalProperties":false},"approvalStatus":{"type":"string","enum":["not_required","pending","approved","rejected"]},"approvalRequestedAt":{"type":"string"},"approvalResolvedAt":{"type":"string"},"approvalResolvedBy":{"type":"string"},"approvalNotes":{"type":"string"}},"required":["status","updatedAt"],"additionalProperties":false},{"type":"null"}]},"bookingExceptionsOpen":{"type":"number"},"consentStatus":{"type":"string","enum":["granted","denied","unknown"]},"duration":{"type":"number"},"leadScore":{"type":"number"},"leadTier":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","scenarioId","companyName","duration","leadScore","leadTier","createdAt"],"additionalProperties":false}},"pagination":{"type":"object","properties":{"page":{"type":"number"},"pageSize":{"type":"number"},"total":{"type":"number"},"totalPages":{"type":"number"}},"required":["page","pageSize","total","totalPages"],"additionalProperties":false},"filters":{"type":"object","properties":{"search":{"type":"string"},"domain":{"type":"string"},"leadTier":{"type":"string","enum":["hot","warm","cold"]},"disposition":{"type":"string","enum":["resolved","booked","qualified","follow_up_required","escalated","abandoned"]},"hasOpenExceptions":{"type":"boolean"}},"additionalProperties":false},"sort":{"type":"object","properties":{"sortBy":{"type":"string","enum":["createdAt","leadScore","duration","scheduledFor"]},"sortOrder":{"type":"string","enum":["asc","desc"]}},"required":["sortBy","sortOrder"],"additionalProperties":false}},"required":["success","sessions","pagination","filters","sort"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — admin authentication required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"tags":["Sessions"],"summary":"Create a new demo session","description":"Creates a new session for a demo scenario. Returns session ID and access key set as an HttpOnly cookie.","operationId":"createSession","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"scenarioId":{"type":"string","example":"insurance-fnol"},"scenarioTitle":{"type":"string"},"companyName":{"type":"string"},"requestedLocale":{"description":"Optional BCP-47 locale hint for server-owned persona selection (for example `es-MX`).","type":"string"},"navigatorLanguage":{"description":"Optional browser language fallback. Used only when requestedLocale and X-Tellgence-Locale-Hint are absent.","type":"string"},"tenantId":{"description":"Tenant ID for multi-tenant isolation. When omitted, set from admin auth if present, else default-practice.","type":"string"}},"required":["scenarioId"]}}}},"responses":{"201":{"description":"Session created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"sessionId":{"type":"string","example":"abc123"},"accessKey":{"type":"string"},"createdAt":{"type":"string","description":"ISO 8601 timestamp"},"expiresAt":{"type":"string","description":"ISO 8601 timestamp"},"requestedLocale":{"type":"string"}},"required":["success","sessionId","accessKey","createdAt","expiresAt"],"additionalProperties":false}}}},"400":{"description":"scenarioId is required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/finalize":{"post":{"tags":["Sessions"],"summary":"Finalize and persist a demo session","description":"Stores the completed session data (transcript, timeline, tool usage). Healthcare intake sessions validate required demographic, insurance, and consent fields, then trigger configured EHR/webhook automation without blocking session completion on connector failure.","operationId":"finalizeSession","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"tenantId":{"type":"string"},"scenarioId":{"type":"string","example":"insurance-fnol"},"scenarioTitle":{"type":"string"},"companyName":{"type":"string"},"transcript":{"type":"array","items":{}},"timelineEvents":{"type":"array","items":{}},"toolsUsed":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"extractedData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"interactionSummary":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"contact":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}}},"intent":{"type":"string"},"disposition":{"type":"string","enum":["resolved","booked","qualified","follow_up_required","escalated","abandoned"]},"telephony":{"type":"object","properties":{"requested":{"type":"boolean"},"mode":{"type":"string","enum":["live_transfer","callback"]},"status":{"type":"string","enum":["not_required","pending","queued","completed","failed"]},"target":{"type":"string"},"phoneNumber":{"type":"string"},"timeWindow":{"type":"string"},"providerId":{"type":"string"}},"required":["requested"]},"escalation":{"type":"object","properties":{"requested":{"type":"boolean"},"reason":{"type":"string"},"target":{"type":"string"},"status":{"type":"string","enum":["pending","completed","not_required"]}},"required":["requested"]},"booking":{"type":"object","properties":{"requested":{"type":"boolean"},"status":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"scheduledFor":{"type":"string"},"referenceId":{"type":"string"}},"required":["requested"]},"summary":{"type":"string"},"nextAction":{"type":"string"}}},{"type":"null"}]},"duration":{"description":"Duration in seconds","type":"number"},"totalInputTokens":{"description":"Cumulative input tokens (from response.done events)","type":"number"},"totalOutputTokens":{"description":"Cumulative output tokens (from response.done events)","type":"number"}},"required":["scenarioId"]}}}},"responses":{"200":{"description":"Session stored","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"sessionId":{"type":"string","example":"abc123"},"accessKey":{"type":"string"},"leadScore":{"type":"number"},"leadTier":{"type":"string"},"results":{"type":"object","properties":{"roiBreakdown":{"type":"object","properties":{"timeSavedMinutes":{"type":"number"},"costSavedUsd":{"type":"number"},"efficiencyPct":{"type":"number"},"tasksAutomated":{"type":"number"},"manualTimeEstimateMinutes":{"type":"number"},"manualHours":{"type":"number"},"automatedHours":{"type":"number"},"grade":{"type":"string","enum":["A","B","C","D","F"]},"completionPct":{"type":"number"},"successRatePct":{"type":"number"},"impactMessage":{"type":"string"},"assumptions":{"type":"object","properties":{"hourlyRate":{"type":"number"},"manualTimePerTask":{"type":"number"}},"required":["hourlyRate","manualTimePerTask"],"additionalProperties":false}},"required":["timeSavedMinutes","costSavedUsd","efficiencyPct","tasksAutomated","manualTimeEstimateMinutes","manualHours","automatedHours","grade","completionPct","successRatePct","impactMessage","assumptions"],"additionalProperties":false},"leadScore":{"type":"object","properties":{"score":{"type":"number"},"tier":{"type":"string","enum":["hot","warm","cold"]},"breakdown":{"type":"object","properties":{"engagement":{"type":"number"},"intent":{"type":"number"},"action":{"type":"number"},"toolUsage":{"type":"number"}},"required":["engagement","intent","action","toolUsage"],"additionalProperties":false}},"required":["score","tier","breakdown"],"additionalProperties":false},"tier":{"type":"string","enum":["hot","warm","cold"]},"scoreLabel":{"type":"string"},"systemsUpdated":{"type":"array","items":{"type":"object","properties":{"system":{"type":"string"},"label":{"type":"string"},"updates":{"type":"number"},"lastUpdated":{"type":"string"},"keyChanges":{"type":"array","items":{"type":"string"}}},"required":["system","label","updates","lastUpdated","keyChanges"],"additionalProperties":false}},"isExpired":{"type":"boolean"},"completionPct":{"type":"number"},"computedAt":{"type":"string"}},"required":["roiBreakdown","leadScore","tier","scoreLabel","systemsUpdated","isExpired","completionPct","computedAt"],"additionalProperties":false}},"required":["success","sessionId","accessKey","leadScore","leadTier"],"additionalProperties":false}}}},"400":{"description":"scenarioId is required or healthcare intake validation failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"},"domainModuleId":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}},"required":["error","domainModuleId","details"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}":{"get":{"tags":["Sessions"],"summary":"Retrieve a session by ID","description":"Returns session data. Public demo/session flows use the `session_access` HttpOnly cookie or `x-session-access` header. Admin review flows may also use a Clerk-authenticated admin session for the matching tenant.","operationId":"getSession","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID returned from /finalize"},"required":true,"description":"Session ID returned from /finalize"}],"responses":{"200":{"description":"Session data","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"companyName":{"type":"string"},"requestedLocale":{"type":"string"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"text":{"type":"string"},"timestamp":{"type":"number"}},"required":["role","text","timestamp"],"additionalProperties":false}},"timelineEvents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"system":{"type":"string"},"timestamp":{"type":"string"}},"required":["id","type","title","description","system","timestamp"],"additionalProperties":false}},"toolsUsed":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"leadScore":{"type":"number"},"leadTier":{"type":"string"},"tenantId":{"type":"string"},"extractedData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"interactionSummary":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"contact":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"intent":{"type":"string"},"disposition":{"type":"string","enum":["resolved","booked","qualified","follow_up_required","escalated","abandoned"]},"telephony":{"type":"object","properties":{"requested":{"type":"boolean"},"mode":{"type":"string","enum":["live_transfer","callback"]},"status":{"type":"string","enum":["not_required","pending","queued","completed","failed"]},"target":{"type":"string"},"phoneNumber":{"type":"string"},"timeWindow":{"type":"string"},"providerId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"escalation":{"type":"object","properties":{"requested":{"type":"boolean"},"reason":{"type":"string"},"target":{"type":"string"},"status":{"type":"string","enum":["pending","completed","not_required"]}},"required":["requested"],"additionalProperties":false},"booking":{"type":"object","properties":{"requested":{"type":"boolean"},"status":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"scheduledFor":{"type":"string"},"referenceId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"summary":{"type":"string"},"nextAction":{"type":"string"}},"additionalProperties":false},{"type":"null"}]},"workflowPolicy":{"type":"object","properties":{"workflowProfileId":{"type":"string"},"workflowDefinitionId":{"type":"string"},"workflowVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"routingTag":{"type":"string","enum":["standard","after_hours","existing_account","payment_path","dispute_path"]},"state":{"type":"string","enum":["active","handoff","completed","fallback","retry","escalation"]},"resolutionReason":{"type":"string"},"businessHoursOpen":{"type":"boolean"},"evaluatedAt":{"type":"string"},"experiment":{"type":"object","properties":{"experimentId":{"type":"string"},"variantId":{"type":"string"},"assignmentHash":{"type":"integer","minimum":0,"maximum":9007199254740991},"assignedAt":{"type":"string"}},"required":["experimentId","variantId","assignmentHash","assignedAt"],"additionalProperties":false}},"required":["workflowProfileId","workflowDefinitionId","workflowVersion","routingTag","state","resolutionReason","businessHoursOpen","evaluatedAt"],"additionalProperties":false},"omnichannelThread":{"type":"object","properties":{"threadId":{"type":"string"},"sessionId":{"type":"string"},"tenantId":{"type":"string"},"correlationId":{"type":"string"},"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["threadId","sessionId","tenantId","correlationId","channel","createdAt","updatedAt"],"additionalProperties":false},"transferHandoff":{"anyOf":[{"type":"object","properties":{"handoffId":{"type":"string"},"reason":{"type":"string"},"fromPersonaId":{"type":"string"},"toPersonaId":{"type":"string"},"fromChannel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"toChannel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"transferMode":{"type":"string","enum":["warm_transfer","cold_transfer","callback","async_followup"]},"summary":{"type":"string"},"keyFacts":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string"},"transcriptExcerpt":{"type":"string"}},"required":["handoffId","reason","fromPersonaId","fromChannel","transferMode","summary","keyFacts","timestamp"],"additionalProperties":false},{"type":"null"}]},"entitlementCheck":{"type":"object","properties":{"policyId":{"type":"string"},"decision":{"type":"string","enum":["allow","deny","conditional"]},"reasonCode":{"type":"string"},"reason":{"type":"string"},"grantedCapabilities":{"type":"array","items":{"type":"string"}},"deniedCapabilities":{"type":"array","items":{"type":"string"}},"obligations":{"type":"array","items":{"type":"string"}},"evaluatedAt":{"type":"string"}},"required":["policyId","decision","reasonCode","reason","grantedCapabilities","deniedCapabilities","obligations","evaluatedAt"],"additionalProperties":false},"consentRetention":{"type":"object","properties":{"consentStatus":{"type":"string","enum":["granted","denied","unknown"]},"consentSource":{"type":"string"},"transcriptRetention":{"type":"string","enum":["full","metadata_only","none"]},"artifactRetentionDays":{"type":"integer","minimum":0,"maximum":9007199254740991},"artifactExpiresAt":{"type":"string"},"retentionReason":{"type":"string"},"enforcedAt":{"type":"string"},"redacted":{"type":"boolean"}},"required":["consentStatus","consentSource","transcriptRetention","artifactRetentionDays","artifactExpiresAt","retentionReason","enforcedAt","redacted"],"additionalProperties":false},"bookingRequest":{"anyOf":[{"type":"object","properties":{"callerType":{"type":"string","enum":["new","existing","returning","unknown"]},"reason":{"type":"string"},"urgency":{"type":"string","enum":["routine","soon","urgent"]},"preferredWindows":{"type":"array","items":{"type":"string"}},"serviceLine":{"type":"string"},"location":{"type":"string"},"providerRole":{"type":"string"},"durationMinutes":{"type":"number"},"timezone":{"type":"string"},"followUpChannel":{"type":"string","enum":["voice","sms","email","web"]},"healthcare":{"type":"object","properties":{"insuranceProvider":{"type":"string"},"memberId":{"type":"string"},"referralRequired":{"type":"boolean"},"visitType":{"type":"string"},"consentComplete":{"type":"boolean"}},"additionalProperties":false},"accounting":{"type":"object","properties":{"entityType":{"type":"string"},"serviceType":{"type":"string"},"taxTopic":{"type":"string"},"bookkeepingNeeds":{"type":"string"},"documentsComplete":{"type":"boolean"}},"additionalProperties":false}},"required":["preferredWindows"],"additionalProperties":false},{"type":"null"}]},"bookingQualification":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ready","missing_info","needs_review"]},"missingFields":{"type":"array","items":{"type":"string"}},"missingQualifiers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["reason","preferred_windows","duration_minutes","insurance_provider","member_id","consent_complete","entity_type","service_type","documents_pending","prereq_documents","review_required"]},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"resolutionHint":{"type":"string"}},"required":["code","category","label"],"additionalProperties":false}},"reviewFlags":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["reason","preferred_windows","duration_minutes","insurance_provider","member_id","consent_complete","entity_type","service_type","documents_pending","prereq_documents","review_required"]},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"resolutionHint":{"type":"string"}},"required":["code","category","label"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"string"}},"requiredItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}},"completedItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}},"blockingItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}}},"required":["status","missingFields","missingQualifiers","reviewFlags","notes","requiredItems","completedItems","blockingItems"],"additionalProperties":false},{"type":"null"}]},"availabilitySuggestions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"rank":{"type":"number"},"score":{"type":"number"},"providerId":{"type":"string"},"source":{"type":"string","enum":["calendar","stub","admin_override"]},"reasonCodes":{"type":"array","items":{"type":"string","enum":["scheduled_slot_preserved","preferred_window_primary","preferred_window_secondary","service_line_alignment","urgency_priority","callback_continuity","default_policy"]}},"reasons":{"type":"array","items":{"type":"string"}},"connectorStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"]},"capacityHint":{"type":"string"}},"required":["id","start","end","rank","score","source","reasonCodes","reasons"],"additionalProperties":false}},"bookingOutcome":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]},"nextReminderDueAt":{"type":"string"},"reminderAttemptCount":{"type":"number"},"lastReminderResult":{"type":"string","enum":["not_sent","queued","sent","failed"]},"backfillCandidateCount":{"type":"number"},"reminderScheduledFor":{"type":"string"},"reminderAttempts":{"type":"number"},"lastTransitionAction":{"type":"string","enum":["confirm","request_reschedule","cancel","mark_no_show","send_reminder","mark_reminder_failed","complete_no_show_recovery"]},"externalEventId":{"type":"string"},"externalProvider":{"type":"string"},"confirmationCode":{"type":"string"},"updatedAt":{"type":"string"},"bookingOrchestration":{"type":"object","properties":{"workflowId":{"type":"string"},"phase":{"type":"string","enum":["reminder_pending","completed","cancelled"]},"updatedAt":{"type":"string"}},"required":["workflowId","phase","updatedAt"],"additionalProperties":false},"approvalStatus":{"type":"string","enum":["not_required","pending","approved","rejected"]},"approvalRequestedAt":{"type":"string"},"approvalResolvedAt":{"type":"string"},"approvalResolvedBy":{"type":"string"},"approvalNotes":{"type":"string"}},"required":["status","updatedAt"],"additionalProperties":false},{"type":"null"}]},"bookingExceptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"reasonCode":{"type":"string","enum":["no_slot","missing_qualifier","connector_unavailable","customer_unresponsive","booking_writeback_failed","reminder_delivery_failed","auth_verification_failed","core_banking_timeout","complaint_system_degraded","ambiguous_multilingual_transcript","ambiguous_urdu_english","digital_handoff_failed"]},"reasonGroup":{"type":"string","enum":["scheduling","qualification","reminder_follow_up","connector","customer_responsiveness"]},"status":{"type":"string","enum":["open","resolved"]},"title":{"type":"string"},"message":{"type":"string"},"sessionId":{"type":"string"},"tenantId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"assignedTo":{"type":"string"},"assigneeDisplay":{"type":"string"},"resolvedAt":{"type":"string"},"resolutionNote":{"type":"string"},"lastAction":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]},"connectorKind":{"type":"string","enum":["calendar","telephony","ehr","erp","webhook"]},"connectorProviderId":{"type":"string"},"bookingSnapshot":{"type":"object","properties":{"bookingStatus":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"bookingOutcomeStatus":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"qualificationStatus":{"type":"string","enum":["ready","missing_info","needs_review"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]}},"additionalProperties":false},"relatedSuggestionIds":{"type":"array","items":{"type":"string"}},"suggestedActions":{"type":"array","items":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]}},"diagnostics":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"remediationSteps":{"type":"array","items":{"type":"object","properties":{"step":{"type":"number"},"label":{"type":"string"},"detail":{"type":"string"},"action":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]}},"required":["step","label","detail"],"additionalProperties":false}}},"required":["id","reasonCode","reasonGroup","status","title","message","sessionId","tenantId","createdAt","updatedAt","suggestedActions"],"additionalProperties":false}},"domainModuleId":{"anyOf":[{"type":"string"},{"type":"null"}]},"domainPayload":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"healthcareIntakePayload":{"anyOf":[{"type":"object","properties":{"patient":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"dateOfBirth":{"type":"string"},"phone":{"type":"string"}},"required":["firstName","lastName","dateOfBirth"],"additionalProperties":false},"visit":{"type":"object","properties":{"reasonForVisit":{"type":"string"},"chiefComplaint":{"type":"string"},"preferredDate":{"type":"string"}},"required":["reasonForVisit"],"additionalProperties":false},"insurance":{"type":"object","properties":{"provider":{"type":"string"},"memberId":{"type":"string"},"groupNumber":{"type":"string"},"planName":{"type":"string"}},"required":["provider"],"additionalProperties":false},"consent":{"type":"object","properties":{"treatmentAccepted":{"type":"boolean"},"privacyAcknowledged":{"type":"boolean"},"recordedAt":{"type":"string"}},"required":["treatmentAccepted","privacyAcknowledged","recordedAt"],"additionalProperties":false},"clinical":{"type":"object","properties":{"allergies":{"type":"array","items":{"type":"string"}},"medications":{"type":"array","items":{"type":"string"}},"triageLevel":{"type":"string","enum":["routine","urgent","emergent"]}},"required":["allergies","medications","triageLevel"],"additionalProperties":false}},"required":["patient","visit","insurance","consent","clinical"],"additionalProperties":false},{"type":"null"}]},"accountingArCollectionsPayload":{"anyOf":[{"type":"object","properties":{"debtor":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"required":["name","phone"],"additionalProperties":false},"account":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false},"accounts":{"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false}},"collection":{"type":"object","properties":{"reason":{"type":"string"},"paymentIntent":{"type":"string","enum":["ready_to_pay","promise_to_pay","disputes_balance","needs_review"]},"promiseDate":{"type":"string"},"disputeReason":{"type":"string"},"callbackRequested":{"type":"boolean"},"callbackWindow":{"type":"string"},"escalationTarget":{"type":"string"},"notes":{"type":"string"}},"required":["reason","paymentIntent","callbackRequested"],"additionalProperties":false}},"required":["debtor","account","collection"],"additionalProperties":false},{"type":"null"}]},"integrationOutcomes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["record_system","scheduler","notification","webhook","crm","billing","knowledge_source","calendar","ehr","erp"]},"providerId":{"type":"string"},"action":{"type":"string"},"status":{"type":"string","enum":["sent","failed"]},"summary":{"type":"string"},"attemptedAt":{"type":"string"},"retryCount":{"type":"number"},"responseCode":{"type":"number"},"errorMessage":{"type":"string"},"externalId":{"type":"string"},"artifactUrl":{"type":"string"},"payloadPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"correlationId":{"type":"string"},"idempotencyKey":{"type":"string"},"startedAt":{"type":"string"},"completedAt":{"type":"string"},"retryable":{"type":"boolean"}},"required":["id","kind","providerId","action","status","summary","attemptedAt","retryCount","payloadPreview"],"additionalProperties":false}},"duration":{"type":"number"},"tokenUsage":{"type":"object","properties":{"inputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"outputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalTokens":{"type":"integer","minimum":0,"maximum":9007199254740991}},"additionalProperties":false},"realtimeSnapshot":{"anyOf":[{"type":"object","properties":{"personaId":{"type":"string"},"realtimeDeployment":{"type":"string"},"transcriptionModel":{"type":"string"},"transcriptionLanguage":{"type":"string"},"voice":{"type":"string"},"sessionHints":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"reportedAt":{"type":"string"},"clientBuild":{"type":"string"}},"required":["personaId","reportedAt"],"additionalProperties":false},{"type":"null"}]},"latencyMetrics":{"type":"object","properties":{"ttfwP50":{"description":"Time to First Word - 50th percentile (ms)","type":"number"},"ttfwP90":{"description":"Time to First Word - 90th percentile (ms)","type":"number"},"ttfwP99":{"description":"Time to First Word - 99th percentile (ms)","type":"number"},"latencyP50":{"description":"Response latency - 50th percentile (ms)","type":"number"},"latencyP90":{"description":"Response latency - 90th percentile (ms)","type":"number"},"latencyP99":{"description":"Response latency - 99th percentile (ms)","type":"number"},"userInterruptions":{"description":"Number of user interruptions/barge-ins","type":"number"}},"additionalProperties":false},"assertionSummary":{"anyOf":[{"type":"object","properties":{"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"totalAssertions":{"type":"number"},"passedAssertions":{"type":"number"},"failedAssertions":{"type":"number"},"criticalFailures":{"type":"number"},"warningFailures":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{"assertionId":{"type":"string"},"assertionName":{"type":"string"},"passed":{"type":"boolean"},"severity":{"type":"string","enum":["critical","warning","info"]},"actualValue":{},"expectedValue":{},"errorMessage":{"type":"string"},"evaluatedAt":{"type":"string"}},"required":["assertionId","assertionName","passed","severity","evaluatedAt"],"additionalProperties":false}},"evaluatedAt":{"type":"string"}},"required":["sessionId","scenarioId","totalAssertions","passedAssertions","failedAssertions","criticalFailures","warningFailures","results","evaluatedAt"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"expiresAt":{"type":"string"}},"required":["id","scenarioId","scenarioTitle","transcript","timelineEvents","toolsUsed","beatsCompleted","totalBeats","leadScore","leadTier","extractedData","integrationOutcomes","duration","createdAt","expiresAt"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/realtime-snapshot":{"patch":{"tags":["Sessions"],"summary":"Patch Realtime configuration snapshot for a session","description":"Stores client-reported effective Realtime settings (persona, deployment name, transcription model, voice) for operator visibility (RT-05). Cookie `session_access` or `x-session-access`, or admin tenant auth. Payload must not contain API keys or ephemeral tokens.","operationId":"patchSessionRealtimeSnapshot","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID"},"required":true,"description":"Session ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"personaId":{"type":"string"},"realtimeDeployment":{"type":"string"},"transcriptionModel":{"type":"string"},"transcriptionLanguage":{"type":"string"},"voice":{"type":"string"},"sessionHints":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"reportedAt":{"type":"string"},"clientBuild":{"type":"string"}}}}}},"responses":{"200":{"description":"Snapshot updated","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"snapshot":{"type":"object","properties":{"personaId":{"type":"string"},"realtimeDeployment":{"type":"string"},"transcriptionModel":{"type":"string"},"transcriptionLanguage":{"type":"string"},"voice":{"type":"string"},"sessionHints":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"reportedAt":{"type":"string"},"clientBuild":{"type":"string"}},"required":["personaId","reportedAt"],"additionalProperties":false}},"required":["sessionId","snapshot"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/booking-lifecycle":{"patch":{"tags":["Sessions"],"summary":"Apply an explicit booking lifecycle transition","description":"Updates the shared scheduling lifecycle for a session with an explicit transition such as confirm, reschedule, cancel, no-show recovery, or reminder state updates. Public session flows may use the `session_access` cookie or `x-session-access` header; admin flows may use Clerk-authenticated tenant access.","operationId":"patchSessionBookingLifecycle","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID returned from /finalize"},"required":true,"description":"Session ID returned from /finalize"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["confirm","request_reschedule","cancel","mark_no_show","send_reminder","mark_reminder_failed","complete_no_show_recovery"]},"scheduledFor":{"type":"string"},"selectedSuggestionId":{"type":"string"},"referenceId":{"type":"string"},"note":{"type":"string"}},"required":["action"]}}}},"responses":{"200":{"description":"Updated session with booking lifecycle state applied","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"session":{"type":"object","properties":{"id":{"type":"string"},"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"companyName":{"type":"string"},"requestedLocale":{"type":"string"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"text":{"type":"string"},"timestamp":{"type":"number"}},"required":["role","text","timestamp"],"additionalProperties":false}},"timelineEvents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"system":{"type":"string"},"timestamp":{"type":"string"}},"required":["id","type","title","description","system","timestamp"],"additionalProperties":false}},"toolsUsed":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"leadScore":{"type":"number"},"leadTier":{"type":"string"},"tenantId":{"type":"string"},"extractedData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"interactionSummary":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"contact":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"intent":{"type":"string"},"disposition":{"type":"string","enum":["resolved","booked","qualified","follow_up_required","escalated","abandoned"]},"telephony":{"type":"object","properties":{"requested":{"type":"boolean"},"mode":{"type":"string","enum":["live_transfer","callback"]},"status":{"type":"string","enum":["not_required","pending","queued","completed","failed"]},"target":{"type":"string"},"phoneNumber":{"type":"string"},"timeWindow":{"type":"string"},"providerId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"escalation":{"type":"object","properties":{"requested":{"type":"boolean"},"reason":{"type":"string"},"target":{"type":"string"},"status":{"type":"string","enum":["pending","completed","not_required"]}},"required":["requested"],"additionalProperties":false},"booking":{"type":"object","properties":{"requested":{"type":"boolean"},"status":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"scheduledFor":{"type":"string"},"referenceId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"summary":{"type":"string"},"nextAction":{"type":"string"}},"additionalProperties":false},{"type":"null"}]},"workflowPolicy":{"type":"object","properties":{"workflowProfileId":{"type":"string"},"workflowDefinitionId":{"type":"string"},"workflowVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"routingTag":{"type":"string","enum":["standard","after_hours","existing_account","payment_path","dispute_path"]},"state":{"type":"string","enum":["active","handoff","completed","fallback","retry","escalation"]},"resolutionReason":{"type":"string"},"businessHoursOpen":{"type":"boolean"},"evaluatedAt":{"type":"string"},"experiment":{"type":"object","properties":{"experimentId":{"type":"string"},"variantId":{"type":"string"},"assignmentHash":{"type":"integer","minimum":0,"maximum":9007199254740991},"assignedAt":{"type":"string"}},"required":["experimentId","variantId","assignmentHash","assignedAt"],"additionalProperties":false}},"required":["workflowProfileId","workflowDefinitionId","workflowVersion","routingTag","state","resolutionReason","businessHoursOpen","evaluatedAt"],"additionalProperties":false},"omnichannelThread":{"type":"object","properties":{"threadId":{"type":"string"},"sessionId":{"type":"string"},"tenantId":{"type":"string"},"correlationId":{"type":"string"},"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["threadId","sessionId","tenantId","correlationId","channel","createdAt","updatedAt"],"additionalProperties":false},"transferHandoff":{"anyOf":[{"type":"object","properties":{"handoffId":{"type":"string"},"reason":{"type":"string"},"fromPersonaId":{"type":"string"},"toPersonaId":{"type":"string"},"fromChannel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"toChannel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"transferMode":{"type":"string","enum":["warm_transfer","cold_transfer","callback","async_followup"]},"summary":{"type":"string"},"keyFacts":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string"},"transcriptExcerpt":{"type":"string"}},"required":["handoffId","reason","fromPersonaId","fromChannel","transferMode","summary","keyFacts","timestamp"],"additionalProperties":false},{"type":"null"}]},"entitlementCheck":{"type":"object","properties":{"policyId":{"type":"string"},"decision":{"type":"string","enum":["allow","deny","conditional"]},"reasonCode":{"type":"string"},"reason":{"type":"string"},"grantedCapabilities":{"type":"array","items":{"type":"string"}},"deniedCapabilities":{"type":"array","items":{"type":"string"}},"obligations":{"type":"array","items":{"type":"string"}},"evaluatedAt":{"type":"string"}},"required":["policyId","decision","reasonCode","reason","grantedCapabilities","deniedCapabilities","obligations","evaluatedAt"],"additionalProperties":false},"consentRetention":{"type":"object","properties":{"consentStatus":{"type":"string","enum":["granted","denied","unknown"]},"consentSource":{"type":"string"},"transcriptRetention":{"type":"string","enum":["full","metadata_only","none"]},"artifactRetentionDays":{"type":"integer","minimum":0,"maximum":9007199254740991},"artifactExpiresAt":{"type":"string"},"retentionReason":{"type":"string"},"enforcedAt":{"type":"string"},"redacted":{"type":"boolean"}},"required":["consentStatus","consentSource","transcriptRetention","artifactRetentionDays","artifactExpiresAt","retentionReason","enforcedAt","redacted"],"additionalProperties":false},"bookingRequest":{"anyOf":[{"type":"object","properties":{"callerType":{"type":"string","enum":["new","existing","returning","unknown"]},"reason":{"type":"string"},"urgency":{"type":"string","enum":["routine","soon","urgent"]},"preferredWindows":{"type":"array","items":{"type":"string"}},"serviceLine":{"type":"string"},"location":{"type":"string"},"providerRole":{"type":"string"},"durationMinutes":{"type":"number"},"timezone":{"type":"string"},"followUpChannel":{"type":"string","enum":["voice","sms","email","web"]},"healthcare":{"type":"object","properties":{"insuranceProvider":{"type":"string"},"memberId":{"type":"string"},"referralRequired":{"type":"boolean"},"visitType":{"type":"string"},"consentComplete":{"type":"boolean"}},"additionalProperties":false},"accounting":{"type":"object","properties":{"entityType":{"type":"string"},"serviceType":{"type":"string"},"taxTopic":{"type":"string"},"bookkeepingNeeds":{"type":"string"},"documentsComplete":{"type":"boolean"}},"additionalProperties":false}},"required":["preferredWindows"],"additionalProperties":false},{"type":"null"}]},"bookingQualification":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ready","missing_info","needs_review"]},"missingFields":{"type":"array","items":{"type":"string"}},"missingQualifiers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["reason","preferred_windows","duration_minutes","insurance_provider","member_id","consent_complete","entity_type","service_type","documents_pending","prereq_documents","review_required"]},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"resolutionHint":{"type":"string"}},"required":["code","category","label"],"additionalProperties":false}},"reviewFlags":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["reason","preferred_windows","duration_minutes","insurance_provider","member_id","consent_complete","entity_type","service_type","documents_pending","prereq_documents","review_required"]},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"resolutionHint":{"type":"string"}},"required":["code","category","label"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"string"}},"requiredItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}},"completedItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}},"blockingItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}}},"required":["status","missingFields","missingQualifiers","reviewFlags","notes","requiredItems","completedItems","blockingItems"],"additionalProperties":false},{"type":"null"}]},"availabilitySuggestions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"rank":{"type":"number"},"score":{"type":"number"},"providerId":{"type":"string"},"source":{"type":"string","enum":["calendar","stub","admin_override"]},"reasonCodes":{"type":"array","items":{"type":"string","enum":["scheduled_slot_preserved","preferred_window_primary","preferred_window_secondary","service_line_alignment","urgency_priority","callback_continuity","default_policy"]}},"reasons":{"type":"array","items":{"type":"string"}},"connectorStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"]},"capacityHint":{"type":"string"}},"required":["id","start","end","rank","score","source","reasonCodes","reasons"],"additionalProperties":false}},"bookingOutcome":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]},"nextReminderDueAt":{"type":"string"},"reminderAttemptCount":{"type":"number"},"lastReminderResult":{"type":"string","enum":["not_sent","queued","sent","failed"]},"backfillCandidateCount":{"type":"number"},"reminderScheduledFor":{"type":"string"},"reminderAttempts":{"type":"number"},"lastTransitionAction":{"type":"string","enum":["confirm","request_reschedule","cancel","mark_no_show","send_reminder","mark_reminder_failed","complete_no_show_recovery"]},"externalEventId":{"type":"string"},"externalProvider":{"type":"string"},"confirmationCode":{"type":"string"},"updatedAt":{"type":"string"},"bookingOrchestration":{"type":"object","properties":{"workflowId":{"type":"string"},"phase":{"type":"string","enum":["reminder_pending","completed","cancelled"]},"updatedAt":{"type":"string"}},"required":["workflowId","phase","updatedAt"],"additionalProperties":false},"approvalStatus":{"type":"string","enum":["not_required","pending","approved","rejected"]},"approvalRequestedAt":{"type":"string"},"approvalResolvedAt":{"type":"string"},"approvalResolvedBy":{"type":"string"},"approvalNotes":{"type":"string"}},"required":["status","updatedAt"],"additionalProperties":false},{"type":"null"}]},"bookingExceptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"reasonCode":{"type":"string","enum":["no_slot","missing_qualifier","connector_unavailable","customer_unresponsive","booking_writeback_failed","reminder_delivery_failed","auth_verification_failed","core_banking_timeout","complaint_system_degraded","ambiguous_multilingual_transcript","ambiguous_urdu_english","digital_handoff_failed"]},"reasonGroup":{"type":"string","enum":["scheduling","qualification","reminder_follow_up","connector","customer_responsiveness"]},"status":{"type":"string","enum":["open","resolved"]},"title":{"type":"string"},"message":{"type":"string"},"sessionId":{"type":"string"},"tenantId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"assignedTo":{"type":"string"},"assigneeDisplay":{"type":"string"},"resolvedAt":{"type":"string"},"resolutionNote":{"type":"string"},"lastAction":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]},"connectorKind":{"type":"string","enum":["calendar","telephony","ehr","erp","webhook"]},"connectorProviderId":{"type":"string"},"bookingSnapshot":{"type":"object","properties":{"bookingStatus":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"bookingOutcomeStatus":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"qualificationStatus":{"type":"string","enum":["ready","missing_info","needs_review"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]}},"additionalProperties":false},"relatedSuggestionIds":{"type":"array","items":{"type":"string"}},"suggestedActions":{"type":"array","items":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]}},"diagnostics":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"remediationSteps":{"type":"array","items":{"type":"object","properties":{"step":{"type":"number"},"label":{"type":"string"},"detail":{"type":"string"},"action":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]}},"required":["step","label","detail"],"additionalProperties":false}}},"required":["id","reasonCode","reasonGroup","status","title","message","sessionId","tenantId","createdAt","updatedAt","suggestedActions"],"additionalProperties":false}},"domainModuleId":{"anyOf":[{"type":"string"},{"type":"null"}]},"domainPayload":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"healthcareIntakePayload":{"anyOf":[{"type":"object","properties":{"patient":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"dateOfBirth":{"type":"string"},"phone":{"type":"string"}},"required":["firstName","lastName","dateOfBirth"],"additionalProperties":false},"visit":{"type":"object","properties":{"reasonForVisit":{"type":"string"},"chiefComplaint":{"type":"string"},"preferredDate":{"type":"string"}},"required":["reasonForVisit"],"additionalProperties":false},"insurance":{"type":"object","properties":{"provider":{"type":"string"},"memberId":{"type":"string"},"groupNumber":{"type":"string"},"planName":{"type":"string"}},"required":["provider"],"additionalProperties":false},"consent":{"type":"object","properties":{"treatmentAccepted":{"type":"boolean"},"privacyAcknowledged":{"type":"boolean"},"recordedAt":{"type":"string"}},"required":["treatmentAccepted","privacyAcknowledged","recordedAt"],"additionalProperties":false},"clinical":{"type":"object","properties":{"allergies":{"type":"array","items":{"type":"string"}},"medications":{"type":"array","items":{"type":"string"}},"triageLevel":{"type":"string","enum":["routine","urgent","emergent"]}},"required":["allergies","medications","triageLevel"],"additionalProperties":false}},"required":["patient","visit","insurance","consent","clinical"],"additionalProperties":false},{"type":"null"}]},"accountingArCollectionsPayload":{"anyOf":[{"type":"object","properties":{"debtor":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"required":["name","phone"],"additionalProperties":false},"account":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false},"accounts":{"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false}},"collection":{"type":"object","properties":{"reason":{"type":"string"},"paymentIntent":{"type":"string","enum":["ready_to_pay","promise_to_pay","disputes_balance","needs_review"]},"promiseDate":{"type":"string"},"disputeReason":{"type":"string"},"callbackRequested":{"type":"boolean"},"callbackWindow":{"type":"string"},"escalationTarget":{"type":"string"},"notes":{"type":"string"}},"required":["reason","paymentIntent","callbackRequested"],"additionalProperties":false}},"required":["debtor","account","collection"],"additionalProperties":false},{"type":"null"}]},"integrationOutcomes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["record_system","scheduler","notification","webhook","crm","billing","knowledge_source","calendar","ehr","erp"]},"providerId":{"type":"string"},"action":{"type":"string"},"status":{"type":"string","enum":["sent","failed"]},"summary":{"type":"string"},"attemptedAt":{"type":"string"},"retryCount":{"type":"number"},"responseCode":{"type":"number"},"errorMessage":{"type":"string"},"externalId":{"type":"string"},"artifactUrl":{"type":"string"},"payloadPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"correlationId":{"type":"string"},"idempotencyKey":{"type":"string"},"startedAt":{"type":"string"},"completedAt":{"type":"string"},"retryable":{"type":"boolean"}},"required":["id","kind","providerId","action","status","summary","attemptedAt","retryCount","payloadPreview"],"additionalProperties":false}},"duration":{"type":"number"},"tokenUsage":{"type":"object","properties":{"inputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"outputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalTokens":{"type":"integer","minimum":0,"maximum":9007199254740991}},"additionalProperties":false},"realtimeSnapshot":{"anyOf":[{"type":"object","properties":{"personaId":{"type":"string"},"realtimeDeployment":{"type":"string"},"transcriptionModel":{"type":"string"},"transcriptionLanguage":{"type":"string"},"voice":{"type":"string"},"sessionHints":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"reportedAt":{"type":"string"},"clientBuild":{"type":"string"}},"required":["personaId","reportedAt"],"additionalProperties":false},{"type":"null"}]},"latencyMetrics":{"type":"object","properties":{"ttfwP50":{"description":"Time to First Word - 50th percentile (ms)","type":"number"},"ttfwP90":{"description":"Time to First Word - 90th percentile (ms)","type":"number"},"ttfwP99":{"description":"Time to First Word - 99th percentile (ms)","type":"number"},"latencyP50":{"description":"Response latency - 50th percentile (ms)","type":"number"},"latencyP90":{"description":"Response latency - 90th percentile (ms)","type":"number"},"latencyP99":{"description":"Response latency - 99th percentile (ms)","type":"number"},"userInterruptions":{"description":"Number of user interruptions/barge-ins","type":"number"}},"additionalProperties":false},"assertionSummary":{"anyOf":[{"type":"object","properties":{"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"totalAssertions":{"type":"number"},"passedAssertions":{"type":"number"},"failedAssertions":{"type":"number"},"criticalFailures":{"type":"number"},"warningFailures":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{"assertionId":{"type":"string"},"assertionName":{"type":"string"},"passed":{"type":"boolean"},"severity":{"type":"string","enum":["critical","warning","info"]},"actualValue":{},"expectedValue":{},"errorMessage":{"type":"string"},"evaluatedAt":{"type":"string"}},"required":["assertionId","assertionName","passed","severity","evaluatedAt"],"additionalProperties":false}},"evaluatedAt":{"type":"string"}},"required":["sessionId","scenarioId","totalAssertions","passedAssertions","failedAssertions","criticalFailures","warningFailures","results","evaluatedAt"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"expiresAt":{"type":"string"}},"required":["id","scenarioId","scenarioTitle","transcript","timelineEvents","toolsUsed","beatsCompleted","totalBeats","leadScore","leadTier","extractedData","integrationOutcomes","duration","createdAt","expiresAt"],"additionalProperties":false}},"required":["success","session"],"additionalProperties":false}}}},"400":{"description":"Validation error for lifecycle transition input","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/cost":{"get":{"tags":["Sessions"],"summary":"Get token usage and estimated cost for a session","description":"Returns cumulative token counts and estimated USD cost. Public demo/session flows use the `session_access` cookie or `x-session-access` header. Admin review flows may also use a Clerk-authenticated admin session for the matching tenant.","operationId":"getSessionCost","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID returned from /finalize"},"required":true,"description":"Session ID returned from /finalize"}],"responses":{"200":{"description":"Token usage and estimated cost","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"tokenUsage":{"type":"object","properties":{"inputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"outputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalTokens":{"type":"integer","minimum":0,"maximum":9007199254740991}},"additionalProperties":false},"estimatedCostUsd":{"type":"number"}},"required":["sessionId"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/results":{"get":{"tags":["Sessions"],"summary":"Fetch server-authoritative session results (ROI, lead score, systems updated)","description":"Returns the canonical SessionResults DTO. Clients MUST consume these values instead of computing ROI or lead score locally. Closes F2 client-side tamper vector.","operationId":"getSessionResults","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID returned from /finalize"},"required":true,"description":"Session ID returned from /finalize"}],"responses":{"200":{"description":"Server-computed SessionResults","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"results":{"type":"object","properties":{"roiBreakdown":{"type":"object","properties":{"timeSavedMinutes":{"type":"number"},"costSavedUsd":{"type":"number"},"efficiencyPct":{"type":"number"},"tasksAutomated":{"type":"number"},"manualTimeEstimateMinutes":{"type":"number"},"manualHours":{"type":"number"},"automatedHours":{"type":"number"},"grade":{"type":"string","enum":["A","B","C","D","F"]},"completionPct":{"type":"number"},"successRatePct":{"type":"number"},"impactMessage":{"type":"string"},"assumptions":{"type":"object","properties":{"hourlyRate":{"type":"number"},"manualTimePerTask":{"type":"number"}},"required":["hourlyRate","manualTimePerTask"],"additionalProperties":false}},"required":["timeSavedMinutes","costSavedUsd","efficiencyPct","tasksAutomated","manualTimeEstimateMinutes","manualHours","automatedHours","grade","completionPct","successRatePct","impactMessage","assumptions"],"additionalProperties":false},"leadScore":{"type":"object","properties":{"score":{"type":"number"},"tier":{"type":"string","enum":["hot","warm","cold"]},"breakdown":{"type":"object","properties":{"engagement":{"type":"number"},"intent":{"type":"number"},"action":{"type":"number"},"toolUsage":{"type":"number"}},"required":["engagement","intent","action","toolUsage"],"additionalProperties":false}},"required":["score","tier","breakdown"],"additionalProperties":false},"tier":{"type":"string","enum":["hot","warm","cold"]},"scoreLabel":{"type":"string"},"systemsUpdated":{"type":"array","items":{"type":"object","properties":{"system":{"type":"string"},"label":{"type":"string"},"updates":{"type":"number"},"lastUpdated":{"type":"string"},"keyChanges":{"type":"array","items":{"type":"string"}}},"required":["system","label","updates","lastUpdated","keyChanges"],"additionalProperties":false}},"isExpired":{"type":"boolean"},"completionPct":{"type":"number"},"computedAt":{"type":"string"}},"required":["roiBreakdown","leadScore","tier","scoreLabel","systemsUpdated","isExpired","completionPct","computedAt"],"additionalProperties":false}},"required":["sessionId","results"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/evidence-packs":{"get":{"tags":["Sessions"],"summary":"Download the signed Evidence Pack for a session","description":"Tellgence's signature audit artifact. Returns the versioned JSON bundle, ed25519 signature, and manifest (sha256 hashes + counts). Tampering with any byte of the canonicalized bundle invalidates the signature under /verify.","operationId":"getEvidencePacks","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID"},"required":true,"description":"Session ID"}],"responses":{"200":{"description":"Signed Evidence Pack (JSON bundle + signature + manifest)","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"bundle":{"type":"object","properties":{"version":{"type":"string","const":"1"},"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"tenantId":{"type":"string"},"generatedAt":{"type":"string"},"persona":{"type":"object","properties":{"id":{"type":"string"},"displayName":{"type":"string"},"voice":{"type":"string"}},"additionalProperties":false},"durationSeconds":{"type":"number"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"text":{"type":"string"},"timestamp":{"type":"number"}},"required":["role","text","timestamp"],"additionalProperties":false}},"reasoning":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"label":{"type":"string"}},"required":["at","label"],"additionalProperties":false}},"toolCalls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tool":{"type":"string"},"startedAt":{"type":"string"},"latencyMs":{"type":"number"},"status":{"type":"string","enum":["success","failed","pending"]},"inputsPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"outputsPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","tool","startedAt","status"],"additionalProperties":false}},"systemUpdates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"system":{"type":"string"},"recordId":{"type":"string"},"at":{"type":"string"},"description":{"type":"string"},"fieldsChanged":{"type":"array","items":{"type":"string"}}},"required":["id","system","at","description"],"additionalProperties":false}},"approvals":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"requestedAt":{"type":"string"},"reviewer":{"type":"string"},"decision":{"type":"string","enum":["approved","rejected","pending"]},"decidedAt":{"type":"string"},"note":{"type":"string"}},"required":["id","requestedAt"],"additionalProperties":false}},"results":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["version","sessionId","scenarioId","generatedAt","durationSeconds","transcript","reasoning","toolCalls","systemUpdates","approvals"],"additionalProperties":false},"signature":{"type":"object","properties":{"algorithm":{"type":"string","const":"ed25519"},"publicKeyId":{"type":"string"},"publicKeyPem":{"type":"string"},"signatureB64":{"type":"string"}},"required":["algorithm","publicKeyId","publicKeyPem","signatureB64"],"additionalProperties":false},"manifest":{"type":"object","properties":{"version":{"type":"string","const":"1"},"sessionId":{"type":"string"},"generatedAt":{"type":"string"},"bundleSha256":{"type":"string"},"packSha256":{"type":"string"},"bundleByteLength":{"type":"number"},"counts":{"type":"object","properties":{"toolCalls":{"type":"number"},"systemUpdates":{"type":"number"},"approvals":{"type":"number"},"transcriptItems":{"type":"number"},"reasoningEntries":{"type":"number"}},"required":["toolCalls","systemUpdates","approvals","transcriptItems","reasoningEntries"],"additionalProperties":false}},"required":["version","sessionId","generatedAt","bundleSha256","packSha256","bundleByteLength","counts"],"additionalProperties":false},"canonicalJson":{"type":"string"}},"required":["sessionId","bundle","signature","manifest","canonicalJson"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/evidence-packs.pdf":{"get":{"tags":["Sessions"],"summary":"Download the Evidence Pack as PDF","description":"Returns a PDF summary of the Evidence Pack. Currently falls back to the session-summary PDF builder — full pack PDF rendering is deferred (X-Voxops-Evidence-Pack-Pdf header signals fallback).","operationId":"getEvidencePacksPdf","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID"},"required":true,"description":"Session ID"}],"responses":{"200":{"description":"PDF bytes","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/evidence-packs/verify":{"post":{"tags":["Sessions"],"summary":"Verify an Evidence Pack signature","description":"Accepts a canonicalized JSON bundle (string or object) and an ed25519 signature + public key. Returns { valid: boolean, reason? }. Useful for third-party compliance verifiers who want to confirm integrity out-of-band.","operationId":"verifyEvidencePacks","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID (context only)"},"required":true,"description":"Session ID (context only)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"json":{"anyOf":[{"type":"string"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"signature":{"type":"object","properties":{"algorithm":{"type":"string","const":"ed25519"},"publicKeyPem":{"type":"string"},"signatureB64":{"type":"string"}},"required":["algorithm","publicKeyPem","signatureB64"]}},"required":["json","signature"]}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"},"reason":{"type":"string"},"publicKeyId":{"type":"string"}},"required":["valid"],"additionalProperties":false}}}},"400":{"description":"Malformed verify body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/evidence-pack":{"get":{"tags":["Sessions"],"summary":"Download the signed Evidence Pack for a session (compat alias)","description":"Compatibility alias for /evidence-packs. Prefer the plural canonical path for new integrations.","operationId":"getEvidencePack","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID"},"required":true,"description":"Session ID"}],"responses":{"200":{"description":"Signed Evidence Pack (JSON bundle + signature + manifest)","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"bundle":{"type":"object","properties":{"version":{"type":"string","const":"1"},"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"tenantId":{"type":"string"},"generatedAt":{"type":"string"},"persona":{"type":"object","properties":{"id":{"type":"string"},"displayName":{"type":"string"},"voice":{"type":"string"}},"additionalProperties":false},"durationSeconds":{"type":"number"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"text":{"type":"string"},"timestamp":{"type":"number"}},"required":["role","text","timestamp"],"additionalProperties":false}},"reasoning":{"type":"array","items":{"type":"object","properties":{"at":{"type":"string"},"label":{"type":"string"}},"required":["at","label"],"additionalProperties":false}},"toolCalls":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tool":{"type":"string"},"startedAt":{"type":"string"},"latencyMs":{"type":"number"},"status":{"type":"string","enum":["success","failed","pending"]},"inputsPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"outputsPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","tool","startedAt","status"],"additionalProperties":false}},"systemUpdates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"system":{"type":"string"},"recordId":{"type":"string"},"at":{"type":"string"},"description":{"type":"string"},"fieldsChanged":{"type":"array","items":{"type":"string"}}},"required":["id","system","at","description"],"additionalProperties":false}},"approvals":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"requestedAt":{"type":"string"},"reviewer":{"type":"string"},"decision":{"type":"string","enum":["approved","rejected","pending"]},"decidedAt":{"type":"string"},"note":{"type":"string"}},"required":["id","requestedAt"],"additionalProperties":false}},"results":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["version","sessionId","scenarioId","generatedAt","durationSeconds","transcript","reasoning","toolCalls","systemUpdates","approvals"],"additionalProperties":false},"signature":{"type":"object","properties":{"algorithm":{"type":"string","const":"ed25519"},"publicKeyId":{"type":"string"},"publicKeyPem":{"type":"string"},"signatureB64":{"type":"string"}},"required":["algorithm","publicKeyId","publicKeyPem","signatureB64"],"additionalProperties":false},"manifest":{"type":"object","properties":{"version":{"type":"string","const":"1"},"sessionId":{"type":"string"},"generatedAt":{"type":"string"},"bundleSha256":{"type":"string"},"packSha256":{"type":"string"},"bundleByteLength":{"type":"number"},"counts":{"type":"object","properties":{"toolCalls":{"type":"number"},"systemUpdates":{"type":"number"},"approvals":{"type":"number"},"transcriptItems":{"type":"number"},"reasoningEntries":{"type":"number"}},"required":["toolCalls","systemUpdates","approvals","transcriptItems","reasoningEntries"],"additionalProperties":false}},"required":["version","sessionId","generatedAt","bundleSha256","packSha256","bundleByteLength","counts"],"additionalProperties":false},"canonicalJson":{"type":"string"}},"required":["sessionId","bundle","signature","manifest","canonicalJson"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/evidence-pack.pdf":{"get":{"tags":["Sessions"],"summary":"Download the Evidence Pack as PDF (compat alias)","description":"Compatibility alias for /evidence-packs.pdf. Prefer the plural canonical path for new integrations.","operationId":"getEvidencePackPdf","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID"},"required":true,"description":"Session ID"}],"responses":{"200":{"description":"PDF bytes","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/evidence-pack/verify":{"post":{"tags":["Sessions"],"summary":"Verify an Evidence Pack signature (compat alias)","description":"Compatibility alias for /evidence-packs/verify. Prefer the plural canonical path for new integrations.","operationId":"verifyEvidencePack","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID (context only)"},"required":true,"description":"Session ID (context only)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"json":{"anyOf":[{"type":"string"},{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}]},"signature":{"type":"object","properties":{"algorithm":{"type":"string","const":"ed25519"},"publicKeyPem":{"type":"string"},"signatureB64":{"type":"string"}},"required":["algorithm","publicKeyPem","signatureB64"]}},"required":["json","signature"]}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"type":"object","properties":{"valid":{"type":"boolean"},"reason":{"type":"string"},"publicKeyId":{"type":"string"}},"required":["valid"],"additionalProperties":false}}}},"400":{"description":"Malformed verify body","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/pdf":{"get":{"tags":["Sessions"],"summary":"Download session as PDF","description":"Returns a PDF summary for a finalized session. Public demo/session flows use the `session_access` HttpOnly cookie or `x-session-access` header. Admin review flows may also use a Clerk-authenticated admin session for the matching tenant.","operationId":"getSessionPdf","parameters":[{"in":"path","name":"id","schema":{"type":"string","description":"Session ID returned from /finalize"},"required":true,"description":"Session ID returned from /finalize"}],"responses":{"200":{"description":"Session PDF bytes","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests — rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/sessions/{id}/state":{"get":{"tags":["Sessions"],"summary":"Get call state for a session","description":"Returns the current workflow phase, personas, completed/pending steps, handoff context, and execution metrics for a session. Creates an initial state if none exists. Public demo/session flows use the session_access cookie or x-session-access header. Admin review flows may also use a Clerk-authenticated admin session for the matching tenant.","operationId":"getSessionState","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Session ID returned from POST /api/sessions or /api/sessions/finalize"}],"responses":{"200":{"description":"Call state for the session","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string","example":"a1b2c3d4-5678-90ab-cdef-1234567890ab"},"workflowId":{"type":"string","example":"service-intake","description":"Workflow profile resolved from persona runtime config or legacy scenario mapping"},"workflowDefinitionId":{"example":"payment-resolution/payment_path/v1","type":"string"},"workflowRouting":{"type":"object","properties":{"tag":{"type":"string","enum":["standard","after_hours","existing_account","payment_path","dispute_path"]},"reason":{"type":"string"},"businessHoursOpen":{"type":"boolean"},"callerType":{"type":"string","enum":["new","existing","unknown"]},"intent":{"type":"string"}},"required":["tag","reason","businessHoursOpen"],"additionalProperties":false},"currentPhase":{"type":"string","enum":["greeting","qualification","data_capture","action","handoff","closure"],"description":"Current phase of the voice call workflow"},"currentPersonaId":{"type":"string","example":"healthcare_intake_specialist"},"completedSteps":{"default":[],"type":"array","items":{"type":"string"}},"pendingSteps":{"default":[],"type":"array","items":{"type":"string"}},"nextPersonaId":{"type":"string"},"handoffContext":{"type":"object","properties":{"fromPersonaId":{"type":"string"},"toPersonaId":{"type":"string"},"summary":{"type":"string"},"keyFacts":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"transcriptExcerpt":{"type":"string"}},"required":["fromPersonaId","toPersonaId","summary","keyFacts","timestamp"],"additionalProperties":false},"escalationReason":{"type":"string"},"escalationTimestamp":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"telephony":{"type":"object","properties":{"requestId":{"type":"string"},"mode":{"type":"string","enum":["live_transfer","callback"]},"status":{"type":"string","enum":["queued","completed","failed","callback_requested","initiated","ringing","answered","in_progress","busy","no_answer","canceled"]},"providerId":{"type":"string"},"target":{"type":"string"},"phoneNumber":{"type":"string"},"timeWindow":{"type":"string"},"callSid":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"callbackSource":{"type":"string"},"rawStatus":{"type":"string"},"lastEventAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"answeredBy":{"type":"string"},"machineDetectionDurationMs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"callDurationSec":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"terminalReason":{"type":"string"},"requestedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["requestId","mode","status","providerId","requestedAt"],"additionalProperties":false},"metrics":{"type":"object","properties":{"totalToolCallsAttempted":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"successfulToolCalls":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failedToolCalls":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"avgToolDurationMs":{"default":0,"type":"number"},"dataCapturedness":{"default":0,"type":"number","minimum":0,"maximum":100}},"required":["totalToolCallsAttempted","successfulToolCalls","failedToolCalls","avgToolDurationMs","dataCapturedness"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["sessionId","workflowId","currentPhase","currentPersonaId","completedSteps","pendingSteps","metrics","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["Sessions"],"summary":"Update call state for a session","description":"Partially updates the workflow state for an active call. Supports phase transitions, persona swaps, step completion, and escalation triggers. All fields are optional — only provided fields are mutated. Public demo/session flows use the session_access cookie or x-session-access header. Admin review flows may also use a Clerk-authenticated admin session for the matching tenant.","operationId":"patchSessionState","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Session ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"currentPhase":{"type":"string","enum":["greeting","qualification","data_capture","action","handoff","closure"],"description":"Current phase of the voice call workflow"},"currentPersonaId":{"description":"Switch the active persona for this session","type":"string"},"completedStep":{"description":"Step name to mark as completed (appended to completedSteps)","type":"string"},"pendingSteps":{"description":"Replace the entire pendingSteps array","type":"array","items":{"type":"string"}},"nextPersonaId":{"type":"string"},"escalationReason":{"description":"If set, triggers escalation logic and records the reason","type":"string"}}}}}},"responses":{"200":{"description":"Updated call state","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string","example":"a1b2c3d4-5678-90ab-cdef-1234567890ab"},"workflowId":{"type":"string","example":"service-intake","description":"Workflow profile resolved from persona runtime config or legacy scenario mapping"},"workflowDefinitionId":{"example":"payment-resolution/payment_path/v1","type":"string"},"workflowRouting":{"type":"object","properties":{"tag":{"type":"string","enum":["standard","after_hours","existing_account","payment_path","dispute_path"]},"reason":{"type":"string"},"businessHoursOpen":{"type":"boolean"},"callerType":{"type":"string","enum":["new","existing","unknown"]},"intent":{"type":"string"}},"required":["tag","reason","businessHoursOpen"],"additionalProperties":false},"currentPhase":{"type":"string","enum":["greeting","qualification","data_capture","action","handoff","closure"],"description":"Current phase of the voice call workflow"},"currentPersonaId":{"type":"string","example":"healthcare_intake_specialist"},"completedSteps":{"default":[],"type":"array","items":{"type":"string"}},"pendingSteps":{"default":[],"type":"array","items":{"type":"string"}},"nextPersonaId":{"type":"string"},"handoffContext":{"type":"object","properties":{"fromPersonaId":{"type":"string"},"toPersonaId":{"type":"string"},"summary":{"type":"string"},"keyFacts":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"transcriptExcerpt":{"type":"string"}},"required":["fromPersonaId","toPersonaId","summary","keyFacts","timestamp"],"additionalProperties":false},"escalationReason":{"type":"string"},"escalationTimestamp":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"telephony":{"type":"object","properties":{"requestId":{"type":"string"},"mode":{"type":"string","enum":["live_transfer","callback"]},"status":{"type":"string","enum":["queued","completed","failed","callback_requested","initiated","ringing","answered","in_progress","busy","no_answer","canceled"]},"providerId":{"type":"string"},"target":{"type":"string"},"phoneNumber":{"type":"string"},"timeWindow":{"type":"string"},"callSid":{"type":"string"},"sequenceNumber":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"callbackSource":{"type":"string"},"rawStatus":{"type":"string"},"lastEventAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"answeredBy":{"type":"string"},"machineDetectionDurationMs":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"callDurationSec":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"terminalReason":{"type":"string"},"requestedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["requestId","mode","status","providerId","requestedAt"],"additionalProperties":false},"metrics":{"type":"object","properties":{"totalToolCallsAttempted":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"successfulToolCalls":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"failedToolCalls":{"default":0,"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"avgToolDurationMs":{"default":0,"type":"number"},"dataCapturedness":{"default":0,"type":"number","minimum":0,"maximum":100}},"required":["totalToolCallsAttempted","successfulToolCalls","failedToolCalls","avgToolDurationMs","dataCapturedness"],"additionalProperties":false},"createdAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"},"updatedAt":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"}},"required":["sessionId","workflowId","currentPhase","currentPersonaId","completedSteps","pendingSteps","metrics","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Validation error — e.g. invalid currentPhase value","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session or call state not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tools":{"get":{"tags":["Tools"],"summary":"Get available tools for a persona","operationId":"getTools","parameters":[{"name":"personaId","in":"query","required":true,"schema":{"type":"string","example":"insurance_claims_intake"},"description":"Persona ID to get tools for"}],"responses":{"200":{"description":"Tools available for this persona","content":{"application/json":{"schema":{"type":"object","properties":{"personaId":{"type":"string"},"tools":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"required":["personaId","tools"],"additionalProperties":false}}}},"400":{"description":"Missing or invalid personaId","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/tools/execute":{"post":{"tags":["Tools"],"summary":"Execute a tool with error handling and retry","operationId":"executeTool","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"toolName":{"type":"string","description":"Tool to execute","example":"crm_create_lead"},"parameters":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"callId":{"type":"string"},"sessionId":{"type":"string"},"businessKey":{"description":"Optional business key for idempotency fingerprint","type":"string"},"idempotencyKey":{"description":"Override idempotency key; otherwise computed from tool + tenant + session + params","type":"string"},"skipValidation":{"description":"Skip parameter validation","type":"boolean"},"useRetry":{"description":"Enable retry logic (default: true)","type":"boolean"}},"required":["toolName"]}}}},"responses":{"200":{"description":"Tool execution result (success or error)","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"callId":{"type":"string"},"toolName":{"type":"string"},"result":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}]},"runtime":{"type":"object","properties":{"status":{"type":"string","enum":["allowed","pending_approval","denied","failed"]},"approvalId":{"type":"string"},"evidencePackId":{"type":"string"},"correlationId":{"type":"string"},"executionId":{"type":"string"},"idempotencyKey":{"type":"string"}},"required":["status"],"additionalProperties":false},"executionTime":{"description":"Execution time in milliseconds","type":"number"},"retries":{"description":"Number of retry attempts","type":"number"},"executionId":{"type":"string"},"idempotentReplay":{"type":"boolean"}},"required":["success","toolName","result","runtime"],"additionalProperties":{}}}}},"202":{"description":"Tool execution queued for human approval","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"status":{"type":"string","const":"pending_approval"},"message":{"type":"string"},"callId":{"type":"string"},"toolName":{"type":"string"},"result":{"type":"object","properties":{"approvalQueued":{"type":"boolean","const":true},"approvalId":{"type":"string"},"queue":{"type":"string"},"deduped":{"type":"boolean"}},"required":["approvalQueued","approvalId"],"additionalProperties":false},"runtime":{"type":"object","properties":{"status":{"type":"string","enum":["allowed","pending_approval","denied","failed"]},"approvalId":{"type":"string"},"evidencePackId":{"type":"string"},"correlationId":{"type":"string"},"executionId":{"type":"string"},"idempotencyKey":{"type":"string"}},"required":["status"],"additionalProperties":false}},"required":["success","status","message","toolName","result","runtime"],"additionalProperties":false}}}},"400":{"description":"Validation error or missing parameters","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Tool execution denied by policy","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":false},"error":{"type":"string","const":"Policy Denied"},"message":{"type":"string"},"callId":{"type":"string"},"toolName":{"type":"string"},"runtime":{"type":"object","properties":{"status":{"type":"string","enum":["allowed","pending_approval","denied","failed"]},"approvalId":{"type":"string"},"evidencePackId":{"type":"string"},"correlationId":{"type":"string"},"executionId":{"type":"string"},"idempotencyKey":{"type":"string"}},"required":["status"],"additionalProperties":false}},"required":["success","error","message","toolName","runtime"],"additionalProperties":false}}}},"500":{"description":"Server error during tool execution","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/integrations":{"get":{"tags":["Integrations"],"summary":"List available integration providers","description":"Returns all configured integration providers with auth fields and supported actions.","operationId":"getIntegrations","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Available integration providers","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"providers":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"tier":{"type":"string","enum":["demo","real","both"]},"description":{"type":"string"},"auth":{"type":"object","properties":{"kind":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"secret":{"type":"boolean"},"description":{"type":"string"}},"required":["key","label"],"additionalProperties":false}}},"required":["kind"],"additionalProperties":false},"actions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"inputSchema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","label","description","inputSchema"],"additionalProperties":false}}},"required":["id","name","tier","description","auth","actions"],"additionalProperties":false}},"releaseSafety":{"type":"object","properties":{"appMode":{"type":"string","enum":["demo","real","default"]},"readyForPilot":{"type":"boolean"},"blockers":{"type":"array","items":{"type":"string"}},"warnings":{"type":"array","items":{"type":"string"}},"persistence":{"type":"object","properties":{"mode":{"type":"string"},"provider":{"type":"string"},"productionSafe":{"type":"boolean"},"warning":{"type":"string"}},"required":["mode","provider","productionSafe"],"additionalProperties":false},"registry":{"type":"object","properties":{"totalProviders":{"type":"integer","minimum":0,"maximum":9007199254740991},"demoProviders":{"type":"integer","minimum":0,"maximum":9007199254740991},"realProviders":{"type":"integer","minimum":0,"maximum":9007199254740991},"dualModeProviders":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["totalProviders","demoProviders","realProviders","dualModeProviders"],"additionalProperties":false},"practiceConnectors":{"type":"object","properties":{"tenantId":{"anyOf":[{"type":"string"},{"type":"null"}]},"connectedCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"connectedKinds":{"type":"array","items":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]}},"disconnectedKinds":{"type":"array","items":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]}},"liveKinds":{"type":"array","items":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]}},"demoKinds":{"type":"array","items":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]}}},"required":["tenantId","connectedCount","connectedKinds","disconnectedKinds","liveKinds","demoKinds"],"additionalProperties":false}},"required":["appMode","readyForPilot","blockers","warnings","persistence","registry","practiceConnectors"],"additionalProperties":false}},"required":["success","providers","releaseSafety"],"additionalProperties":false}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/integrations/practice-connectors":{"get":{"tags":["Integrations"],"summary":"Get practice connector settings with health status","description":"Returns the current practice connector configuration for the authenticated tenant. Each connector includes an explicit healthStatus derived from the last test result and its age.","operationId":"getPracticeConnectorSettings","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Practice connector settings with derived health status","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenantId":{"type":"string"},"settings":{"type":"object","properties":{"tenantId":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"connectors":{"type":"object","properties":{"ehr":{"type":"object","properties":{"kind":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]},"providerId":{"type":"string"},"status":{"type":"string","enum":["connected","disconnected","reconnect_required","pending_auth","disabled"]},"connectedAt":{"type":"string"},"disconnectedAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"configPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"lastTest":{"type":"object","properties":{"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"summary":{"type":"string"},"errorMessage":{"type":"string"}},"required":["ok","checkedAt","summary"],"additionalProperties":false},"healthStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"],"description":"Derived connector health state. Healthy = last test passed within 7 days. Degraded = last test passed but stale. Unavailable = last test failed. Configured_unverified = connected but never tested or disconnected."}},"required":["kind","providerId","status","updatedAt","configPreview","healthStatus"],"additionalProperties":false},"calendar":{"type":"object","properties":{"kind":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]},"providerId":{"type":"string"},"status":{"type":"string","enum":["connected","disconnected","reconnect_required","pending_auth","disabled"]},"connectedAt":{"type":"string"},"disconnectedAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"configPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"lastTest":{"type":"object","properties":{"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"summary":{"type":"string"},"errorMessage":{"type":"string"}},"required":["ok","checkedAt","summary"],"additionalProperties":false},"healthStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"],"description":"Derived connector health state. Healthy = last test passed within 7 days. Degraded = last test passed but stale. Unavailable = last test failed. Configured_unverified = connected but never tested or disconnected."}},"required":["kind","providerId","status","updatedAt","configPreview","healthStatus"],"additionalProperties":false},"webhook":{"type":"object","properties":{"kind":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]},"providerId":{"type":"string"},"status":{"type":"string","enum":["connected","disconnected","reconnect_required","pending_auth","disabled"]},"connectedAt":{"type":"string"},"disconnectedAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"configPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"lastTest":{"type":"object","properties":{"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"summary":{"type":"string"},"errorMessage":{"type":"string"}},"required":["ok","checkedAt","summary"],"additionalProperties":false},"healthStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"],"description":"Derived connector health state. Healthy = last test passed within 7 days. Degraded = last test passed but stale. Unavailable = last test failed. Configured_unverified = connected but never tested or disconnected."}},"required":["kind","providerId","status","updatedAt","configPreview","healthStatus"],"additionalProperties":false},"erp":{"type":"object","properties":{"kind":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]},"providerId":{"type":"string"},"status":{"type":"string","enum":["connected","disconnected","reconnect_required","pending_auth","disabled"]},"connectedAt":{"type":"string"},"disconnectedAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"configPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"lastTest":{"type":"object","properties":{"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"summary":{"type":"string"},"errorMessage":{"type":"string"}},"required":["ok","checkedAt","summary"],"additionalProperties":false},"healthStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"],"description":"Derived connector health state. Healthy = last test passed within 7 days. Degraded = last test passed but stale. Unavailable = last test failed. Configured_unverified = connected but never tested or disconnected."}},"required":["kind","providerId","status","updatedAt","configPreview","healthStatus"],"additionalProperties":false},"telephony":{"type":"object","properties":{"kind":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]},"providerId":{"type":"string"},"status":{"type":"string","enum":["connected","disconnected","reconnect_required","pending_auth","disabled"]},"connectedAt":{"type":"string"},"disconnectedAt":{"type":"string"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"},"configPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"lastTest":{"type":"object","properties":{"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"summary":{"type":"string"},"errorMessage":{"type":"string"}},"required":["ok","checkedAt","summary"],"additionalProperties":false},"healthStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"],"description":"Derived connector health state. Healthy = last test passed within 7 days. Degraded = last test passed but stale. Unavailable = last test failed. Configured_unverified = connected but never tested or disconnected."}},"required":["kind","providerId","status","updatedAt","configPreview","healthStatus"],"additionalProperties":false}},"required":["ehr","calendar","webhook","erp","telephony"],"additionalProperties":false}},"required":["tenantId","updatedAt","connectors"],"additionalProperties":false}},"required":["success","tenantId","settings"],"additionalProperties":false}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/integrations/practice-connectors/{kind}":{"put":{"tags":["Integrations"],"summary":"Upsert a practice connector configuration","operationId":"upsertPracticeConnector","security":[{"bearerAuth":[]}],"parameters":[{"name":"kind","in":"path","required":true,"schema":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"providerId":{"type":"string"},"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["providerId","config"]}}}},"responses":{"200":{"description":"Connector updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenantId":{"type":"string"},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["success","tenantId","settings"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"delete":{"tags":["Integrations"],"summary":"Disconnect a practice connector","operationId":"deletePracticeConnector","security":[{"bearerAuth":[]}],"parameters":[{"name":"kind","in":"path","required":true,"schema":{"type":"string","enum":["ehr","calendar","webhook","erp","telephony"]}}],"responses":{"200":{"description":"Connector disconnected","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenantId":{"type":"string"},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["success","tenantId","settings"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/integrations/activity-log":{"get":{"tags":["Integrations"],"summary":"Get recent integration activity log entries","description":"Returns the most recent integration execution records for protected internal operations surfaces.","operationId":"getIntegrationActivityLog","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Recent integration activity records","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"providerId":{"type":"string"},"action":{"type":"string"},"timestamp":{"type":"string"},"success":{"type":"boolean"},"latencyMs":{"type":"number"},"errorMessage":{"type":"string"}},"required":["id","providerId","action","timestamp","success","latencyMs"],"additionalProperties":false}},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["success","entries","count"],"additionalProperties":false}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/integrations/{id}/test":{"post":{"tags":["Integrations"],"summary":"Test an integration provider connection","description":"Attempts to connect and run a health check for the selected provider using posted config.","operationId":"testIntegrationConnection","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Integration provider ID (for example, salesforce_mock)"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"responses":{"200":{"description":"Connection test completed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"providerId":{"type":"string"},"status":{"type":"string","enum":["connected","failed"]}},"required":["success","providerId","status"],"additionalProperties":false}}}},"400":{"description":"Connection test failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"},"success":{"type":"boolean","const":false}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Provider not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/integrations/{id}/actions/{actionId}/test":{"post":{"tags":["Integrations"],"summary":"Test a specific action on an integration provider","description":"Executes an action directly against the provider using posted parameters and configuration","operationId":"testIntegrationAction","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"actionId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"config":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"params":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["config","params"]}}}},"responses":{"200":{"description":"Action executed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"result":{}},"required":["success","result"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/onboarding/fast-start":{"get":{"tags":["Onboarding"],"summary":"List fast-start onboarding profiles","operationId":"listFastStartProfiles","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Fast-start onboarding profiles","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"companyName":{"type":"string"},"businessDescription":{"type":"string"},"primaryUseCase":{"type":"string","enum":["insurance","sales","healthcare","legal"]},"personaId":{"type":"string"},"greeting":{"type":"string"},"intakeFields":{"type":"array","items":{"type":"string"}},"summaryRecipients":{"type":"array","items":{"type":"string"}},"bookingLink":{"type":"string"},"escalationContact":{"type":"string"},"faqs":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"}},"required":["question","answer"],"additionalProperties":false}},"webhook":{"type":"object","properties":{"baseUrl":{"type":"string"},"secret":{"type":"string"},"headerName":{"type":"string"}},"required":["baseUrl"],"additionalProperties":false},"reviewedPersona":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"notes":{"type":"string"},"workflow":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"position":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","type","position","data"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"target":{"type":"string"},"sourceHandle":{"type":"string"},"label":{"type":"string"}},"required":["id","source","target"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"workflowDraftId":{"type":"string"},"publishedWorkflowId":{"type":"string"},"publishedWorkflowVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"checklist":{"type":"object","properties":{"profileConfigured":{"type":"boolean"},"destinationsConfigured":{"type":"boolean"},"destinationsTested":{"type":"boolean"},"personaReviewed":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"readyForGoLive":{"type":"boolean"}},"required":["profileConfigured","destinationsConfigured","destinationsTested","personaReviewed","testCallPassed","readyForGoLive"],"additionalProperties":false},"destinationStatus":{"type":"object","properties":{"email":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"}},"required":["kind","ok","checkedAt","message"],"additionalProperties":false},"webhook":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"}},"required":["kind","ok","checkedAt","message"],"additionalProperties":false}},"additionalProperties":false}},"required":["id","tenantId","companyName","businessDescription","primaryUseCase","personaId","greeting","intakeFields","summaryRecipients","faqs","reviewedPersona","testCallPassed","createdAt","updatedAt","checklist","destinationStatus"],"additionalProperties":false}},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["success","items","count"],"additionalProperties":false}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"post":{"tags":["Onboarding"],"summary":"Create a fast-start onboarding profile","operationId":"createFastStartProfile","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"companyName":{"type":"string","minLength":1},"businessDescription":{"type":"string","minLength":1},"primaryUseCase":{"type":"string","enum":["insurance","sales","healthcare","legal"]},"personaId":{"type":"string","minLength":1},"greeting":{"type":"string","minLength":1},"intakeFields":{"type":"array","items":{"type":"string"}},"summaryRecipients":{"type":"array","items":{"type":"string"}},"bookingLink":{"type":"string"},"escalationContact":{"type":"string"},"faqs":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"}},"required":["question","answer"]}},"webhook":{"type":"object","properties":{"baseUrl":{"type":"string"},"secret":{"type":"string"},"headerName":{"type":"string"}},"required":["baseUrl"]},"reviewedPersona":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"notes":{"type":"string"}},"required":["companyName","businessDescription","primaryUseCase","personaId","greeting"]}}}},"responses":{"201":{"description":"Fast-start profile created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"item":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"companyName":{"type":"string"},"businessDescription":{"type":"string"},"primaryUseCase":{"type":"string","enum":["insurance","sales","healthcare","legal"]},"personaId":{"type":"string"},"greeting":{"type":"string"},"intakeFields":{"type":"array","items":{"type":"string"}},"summaryRecipients":{"type":"array","items":{"type":"string"}},"bookingLink":{"type":"string"},"escalationContact":{"type":"string"},"faqs":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"}},"required":["question","answer"],"additionalProperties":false}},"webhook":{"type":"object","properties":{"baseUrl":{"type":"string"},"secret":{"type":"string"},"headerName":{"type":"string"}},"required":["baseUrl"],"additionalProperties":false},"reviewedPersona":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"notes":{"type":"string"},"workflow":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"position":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","type","position","data"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"target":{"type":"string"},"sourceHandle":{"type":"string"},"label":{"type":"string"}},"required":["id","source","target"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"workflowDraftId":{"type":"string"},"publishedWorkflowId":{"type":"string"},"publishedWorkflowVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"checklist":{"type":"object","properties":{"profileConfigured":{"type":"boolean"},"destinationsConfigured":{"type":"boolean"},"destinationsTested":{"type":"boolean"},"personaReviewed":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"readyForGoLive":{"type":"boolean"}},"required":["profileConfigured","destinationsConfigured","destinationsTested","personaReviewed","testCallPassed","readyForGoLive"],"additionalProperties":false},"destinationStatus":{"type":"object","properties":{"email":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"}},"required":["kind","ok","checkedAt","message"],"additionalProperties":false},"webhook":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"}},"required":["kind","ok","checkedAt","message"],"additionalProperties":false}},"additionalProperties":false}},"required":["id","tenantId","companyName","businessDescription","primaryUseCase","personaId","greeting","intakeFields","summaryRecipients","faqs","reviewedPersona","testCallPassed","createdAt","updatedAt","checklist","destinationStatus"],"additionalProperties":false}},"required":["success","item"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/onboarding/fast-start/{profileId}":{"get":{"tags":["Onboarding"],"summary":"Get a fast-start onboarding profile","operationId":"getFastStartProfile","security":[{"bearerAuth":[]}],"parameters":[{"name":"profileId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Fast-start profile","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"item":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"companyName":{"type":"string"},"businessDescription":{"type":"string"},"primaryUseCase":{"type":"string","enum":["insurance","sales","healthcare","legal"]},"personaId":{"type":"string"},"greeting":{"type":"string"},"intakeFields":{"type":"array","items":{"type":"string"}},"summaryRecipients":{"type":"array","items":{"type":"string"}},"bookingLink":{"type":"string"},"escalationContact":{"type":"string"},"faqs":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"}},"required":["question","answer"],"additionalProperties":false}},"webhook":{"type":"object","properties":{"baseUrl":{"type":"string"},"secret":{"type":"string"},"headerName":{"type":"string"}},"required":["baseUrl"],"additionalProperties":false},"reviewedPersona":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"notes":{"type":"string"},"workflow":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"position":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","type","position","data"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"target":{"type":"string"},"sourceHandle":{"type":"string"},"label":{"type":"string"}},"required":["id","source","target"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"workflowDraftId":{"type":"string"},"publishedWorkflowId":{"type":"string"},"publishedWorkflowVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"checklist":{"type":"object","properties":{"profileConfigured":{"type":"boolean"},"destinationsConfigured":{"type":"boolean"},"destinationsTested":{"type":"boolean"},"personaReviewed":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"readyForGoLive":{"type":"boolean"}},"required":["profileConfigured","destinationsConfigured","destinationsTested","personaReviewed","testCallPassed","readyForGoLive"],"additionalProperties":false},"destinationStatus":{"type":"object","properties":{"email":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"}},"required":["kind","ok","checkedAt","message"],"additionalProperties":false},"webhook":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"}},"required":["kind","ok","checkedAt","message"],"additionalProperties":false}},"additionalProperties":false}},"required":["id","tenantId","companyName","businessDescription","primaryUseCase","personaId","greeting","intakeFields","summaryRecipients","faqs","reviewedPersona","testCallPassed","createdAt","updatedAt","checklist","destinationStatus"],"additionalProperties":false}},"required":["success","item"],"additionalProperties":false}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Profile not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"patch":{"tags":["Onboarding"],"summary":"Update a fast-start onboarding profile","operationId":"updateFastStartProfile","security":[{"bearerAuth":[]}],"parameters":[{"name":"profileId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"companyName":{"type":"string","minLength":1},"businessDescription":{"type":"string","minLength":1},"primaryUseCase":{"type":"string","enum":["insurance","sales","healthcare","legal"]},"personaId":{"type":"string","minLength":1},"greeting":{"type":"string","minLength":1},"intakeFields":{"type":"array","items":{"type":"string"}},"summaryRecipients":{"type":"array","items":{"type":"string"}},"bookingLink":{"type":"string"},"escalationContact":{"type":"string"},"faqs":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"}},"required":["question","answer"]}},"webhook":{"type":"object","properties":{"baseUrl":{"type":"string"},"secret":{"type":"string"},"headerName":{"type":"string"}},"required":["baseUrl"]},"reviewedPersona":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"notes":{"type":"string"}}}}}},"responses":{"200":{"description":"Fast-start profile updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"item":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"companyName":{"type":"string"},"businessDescription":{"type":"string"},"primaryUseCase":{"type":"string","enum":["insurance","sales","healthcare","legal"]},"personaId":{"type":"string"},"greeting":{"type":"string"},"intakeFields":{"type":"array","items":{"type":"string"}},"summaryRecipients":{"type":"array","items":{"type":"string"}},"bookingLink":{"type":"string"},"escalationContact":{"type":"string"},"faqs":{"type":"array","items":{"type":"object","properties":{"question":{"type":"string"},"answer":{"type":"string"}},"required":["question","answer"],"additionalProperties":false}},"webhook":{"type":"object","properties":{"baseUrl":{"type":"string"},"secret":{"type":"string"},"headerName":{"type":"string"}},"required":["baseUrl"],"additionalProperties":false},"reviewedPersona":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"notes":{"type":"string"},"workflow":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"position":{"type":"object","properties":{"x":{"type":"number"},"y":{"type":"number"}},"required":["x","y"],"additionalProperties":false},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["id","type","position","data"],"additionalProperties":false}},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"target":{"type":"string"},"sourceHandle":{"type":"string"},"label":{"type":"string"}},"required":["id","source","target"],"additionalProperties":false}}},"required":["nodes","edges"],"additionalProperties":false},"workflowDraftId":{"type":"string"},"publishedWorkflowId":{"type":"string"},"publishedWorkflowVersion":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"checklist":{"type":"object","properties":{"profileConfigured":{"type":"boolean"},"destinationsConfigured":{"type":"boolean"},"destinationsTested":{"type":"boolean"},"personaReviewed":{"type":"boolean"},"testCallPassed":{"type":"boolean"},"readyForGoLive":{"type":"boolean"}},"required":["profileConfigured","destinationsConfigured","destinationsTested","personaReviewed","testCallPassed","readyForGoLive"],"additionalProperties":false},"destinationStatus":{"type":"object","properties":{"email":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"}},"required":["kind","ok","checkedAt","message"],"additionalProperties":false},"webhook":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"}},"required":["kind","ok","checkedAt","message"],"additionalProperties":false}},"additionalProperties":false}},"required":["id","tenantId","companyName","businessDescription","primaryUseCase","personaId","greeting","intakeFields","summaryRecipients","faqs","reviewedPersona","testCallPassed","createdAt","updatedAt","checklist","destinationStatus"],"additionalProperties":false}},"required":["success","item"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Profile not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cp/onboarding/fast-start/{profileId}/test-destination":{"post":{"tags":["Onboarding"],"summary":"Test a fast-start destination","operationId":"testFastStartDestination","security":[{"bearerAuth":[]}],"parameters":[{"name":"profileId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]}},"required":["kind"]}}}},"responses":{"200":{"description":"Destination test result","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"result":{"type":"object","properties":{"kind":{"type":"string","enum":["email","webhook"]},"ok":{"type":"boolean"},"checkedAt":{"type":"string"},"message":{"type":"string"},"profileId":{"type":"string"}},"required":["kind","ok","checkedAt","message","profileId"],"additionalProperties":false}},"required":["success","result"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Profile not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cp/onboarding/tenant-settings":{"get":{"tags":["Onboarding"],"summary":"Get tenant settings","description":"Returns general settings for the authenticated tenant.","operationId":"getTenantSettings","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Tenant settings","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["success","settings"],"additionalProperties":false}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"patch":{"tags":["Onboarding"],"summary":"Update tenant settings","description":"Updates general settings for the authenticated tenant.","operationId":"updateTenantSettings","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}},"responses":{"200":{"description":"Tenant settings updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"settings":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["success","settings"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Internal access required","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Admin access forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/scenarios":{"get":{"tags":["Scenarios"],"summary":"List demo scenarios","description":"Returns the full catalog of demo scenarios, optionally filtered by `industry`. The list is the authoritative source of truth — web/admin consume it via the generated client.","operationId":"getScenarios","parameters":[{"name":"industry","in":"query","required":false,"schema":{"type":"string","enum":["insurance","sales","healthcare","legal","accounting","banking","dental","veterinary"]},"description":"Optional industry filter. One of: insurance, sales, healthcare, legal, accounting, banking, dental, veterinary."},{"name":"visibility","in":"query","required":false,"schema":{"type":"string","enum":["core","proof"]},"description":"Optional public visibility filter. Only `core` and `proof` scenarios are exposed on this route."}],"responses":{"200":{"description":"Scenario catalog","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"industry":{"type":"string","enum":["insurance","sales","healthcare","legal","accounting","banking","dental","veterinary"]},"shortDescription":{"type":"string"},"longDescription":{"type":"string"},"heroImage":{"type":"string"},"agentSetKey":{"type":"string"},"seedData":{"type":"object","properties":{"customer":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"accountId":{"type":"string"}},"additionalProperties":false},"policy":{"type":"object","properties":{"policyNumber":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"coverageAmount":{"type":"string"}},"additionalProperties":false},"patient":{"type":"object","properties":{"name":{"type":"string"},"dob":{"type":"string"},"mrn":{"type":"string"},"insurance":{"type":"string"}},"additionalProperties":false},"lead":{"type":"object","properties":{"company":{"type":"string"},"interest":{"type":"string"},"source":{"type":"string"}},"additionalProperties":false},"matter":{"type":"object","properties":{"caseNumber":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"adverseParties":{"type":"array","items":{"type":"string"}},"priorCounsel":{"type":"string"},"employer":{"type":"string"},"separationDate":{"type":"string"},"residencyState":{"type":"string"},"childrenCount":{"type":"number"},"dvScreenResult":{"type":"string"}},"additionalProperties":false}},"additionalProperties":{},"description":"Seed data that boots the demo workspace."},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Tool name (matches registered tool handler)"},"description":{"type":"string"},"parameters":{"description":"JSON-Schema-lite parameter definition for demo UI cards.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name","description"],"additionalProperties":false,"description":"A single tool exposed by a scenario."}},"uiPanels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","description":"lucide-react icon name"},"type":{"anyOf":[{"type":"string","enum":["crm","ehr","claims","case-management","tasks","scheduling","legal","dispatch","policy","accounting"]},{"type":"string"}],"description":"Panel type. Union of the canonical enum with a string fallback so new verticals can ship panel kinds without a contract bump."},"productLabel":{"type":"string"},"logo":{"type":"string"}},"required":["id","title","icon","type"],"additionalProperties":false,"description":"A single UI panel rendered in the demo workspace."}},"scriptedBeats":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"triggerPhrase":{"type":"string"},"escalationTarget":{"type":"string"},"escalationContext":{"type":"array","items":{"type":"string"}},"escalationWaitMinutes":{"type":"number"}},"required":["id","title","description"],"additionalProperties":false,"description":"A single scripted narrative beat for the demo."}},"agentVoice":{"type":"string"},"companyName":{"type":"string"},"companyLogoUrl":{"type":"string"},"keyFeatures":{"type":"array","items":{"type":"string"}},"toolBeatMap":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"initialAgentNames":{"type":"array","items":{"type":"string"}},"duration":{"type":"string"},"hero":{"type":"boolean"},"defaultTone":{"type":"string","enum":["warm","professional","friendly"]},"hidden":{"type":"boolean"},"allowedPersonaIds":{"type":"array","items":{"type":"string"}},"demoLanguageDefaults":{"type":"object","properties":{"primary":{"type":"string"},"preset":{"type":"string","enum":["unified","bilingual_en_transcript"]}},"additionalProperties":false},"parameterization":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Opaque persona parameterization blob applied at session mint time (PersonaRuntimeOptions). Shape is authoritative on the server; clients forward unchanged."},"sessionTier":{"type":"string","enum":["standard","professional","premium"]},"visibility":{"type":"string","enum":["core","proof","exception","hidden-lab"]},"geography":{"type":"string","enum":["US","international","multi-region"]},"exceptionRationale":{"type":"string"},"verticalPacks":{"type":"array","items":{"type":"string"}},"packPriority":{"type":"number"},"packCallout":{"type":"string"}},"required":["id","slug","title","industry","shortDescription","longDescription","agentSetKey","seedData","tools","uiPanels","scriptedBeats","companyName"],"additionalProperties":false,"description":"Full scenario configuration consumed by the demo workspace."}},"count":{"type":"number"}},"required":["items","count"],"additionalProperties":false,"description":"List of scenarios with total count."}}}},"400":{"description":"Invalid visibility filter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/scenarios/{slug}":{"get":{"tags":["Scenarios"],"summary":"Get a single scenario by slug","description":"Returns the full `ScenarioConfig` for the given slug (e.g. 'healthcare-intake'). Returns 404 when no scenario matches.","operationId":"getScenarioBySlug","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"description":"Scenario slug identifier."}],"responses":{"200":{"description":"Scenario configuration","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"industry":{"type":"string","enum":["insurance","sales","healthcare","legal","accounting","banking","dental","veterinary"]},"shortDescription":{"type":"string"},"longDescription":{"type":"string"},"heroImage":{"type":"string"},"agentSetKey":{"type":"string"},"seedData":{"type":"object","properties":{"customer":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"accountId":{"type":"string"}},"additionalProperties":false},"policy":{"type":"object","properties":{"policyNumber":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"coverageAmount":{"type":"string"}},"additionalProperties":false},"patient":{"type":"object","properties":{"name":{"type":"string"},"dob":{"type":"string"},"mrn":{"type":"string"},"insurance":{"type":"string"}},"additionalProperties":false},"lead":{"type":"object","properties":{"company":{"type":"string"},"interest":{"type":"string"},"source":{"type":"string"}},"additionalProperties":false},"matter":{"type":"object","properties":{"caseNumber":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"adverseParties":{"type":"array","items":{"type":"string"}},"priorCounsel":{"type":"string"},"employer":{"type":"string"},"separationDate":{"type":"string"},"residencyState":{"type":"string"},"childrenCount":{"type":"number"},"dvScreenResult":{"type":"string"}},"additionalProperties":false}},"additionalProperties":{},"description":"Seed data that boots the demo workspace."},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Tool name (matches registered tool handler)"},"description":{"type":"string"},"parameters":{"description":"JSON-Schema-lite parameter definition for demo UI cards.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name","description"],"additionalProperties":false,"description":"A single tool exposed by a scenario."}},"uiPanels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","description":"lucide-react icon name"},"type":{"anyOf":[{"type":"string","enum":["crm","ehr","claims","case-management","tasks","scheduling","legal","dispatch","policy","accounting"]},{"type":"string"}],"description":"Panel type. Union of the canonical enum with a string fallback so new verticals can ship panel kinds without a contract bump."},"productLabel":{"type":"string"},"logo":{"type":"string"}},"required":["id","title","icon","type"],"additionalProperties":false,"description":"A single UI panel rendered in the demo workspace."}},"scriptedBeats":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"triggerPhrase":{"type":"string"},"escalationTarget":{"type":"string"},"escalationContext":{"type":"array","items":{"type":"string"}},"escalationWaitMinutes":{"type":"number"}},"required":["id","title","description"],"additionalProperties":false,"description":"A single scripted narrative beat for the demo."}},"agentVoice":{"type":"string"},"companyName":{"type":"string"},"companyLogoUrl":{"type":"string"},"keyFeatures":{"type":"array","items":{"type":"string"}},"toolBeatMap":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"initialAgentNames":{"type":"array","items":{"type":"string"}},"duration":{"type":"string"},"hero":{"type":"boolean"},"defaultTone":{"type":"string","enum":["warm","professional","friendly"]},"hidden":{"type":"boolean"},"allowedPersonaIds":{"type":"array","items":{"type":"string"}},"demoLanguageDefaults":{"type":"object","properties":{"primary":{"type":"string"},"preset":{"type":"string","enum":["unified","bilingual_en_transcript"]}},"additionalProperties":false},"parameterization":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Opaque persona parameterization blob applied at session mint time (PersonaRuntimeOptions). Shape is authoritative on the server; clients forward unchanged."},"sessionTier":{"type":"string","enum":["standard","professional","premium"]},"visibility":{"type":"string","enum":["core","proof","exception","hidden-lab"]},"geography":{"type":"string","enum":["US","international","multi-region"]},"exceptionRationale":{"type":"string"},"verticalPacks":{"type":"array","items":{"type":"string"}},"packPriority":{"type":"number"},"packCallout":{"type":"string"}},"required":["id","slug","title","industry","shortDescription","longDescription","agentSetKey","seedData","tools","uiPanels","scriptedBeats","companyName"],"additionalProperties":false,"description":"Full scenario configuration consumed by the demo workspace."}}}},"400":{"description":"Missing slug","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Scenario not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/doc":{"get":{"tags":["Meta"],"summary":"Swagger UI documentation","operationId":"getApiDocsUi","responses":{"200":{"description":"Swagger UI HTML","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/api/docs":{"get":{"tags":["Meta"],"summary":"Redirect docs entrypoint to Swagger UI","operationId":"redirectApiDocs","responses":{"302":{"description":"Redirects to /api/doc"}}}},"/api/docs/ui":{"get":{"tags":["Meta"],"summary":"Redirect docs UI alias to Swagger UI","operationId":"redirectApiDocsUi","responses":{"302":{"description":"Redirects to /api/doc"}}}},"/api/contact":{"post":{"tags":["Contact"],"summary":"Submit a contact form","operationId":"createContact","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","example":"Jane Smith"},"email":{"type":"string","example":"jane@acme.com"},"company":{"example":"Acme Corp","type":"string"},"role":{"example":"Practice Manager","type":"string"},"phone":{"example":"+1-555-0100","type":"string"},"primaryInterest":{"example":"Healthcare intake automation","type":"string"},"currentSystem":{"example":"Athenahealth + RingCentral","type":"string"},"implementationTimeline":{"example":"Within 30 days","type":"string"},"sourcePath":{"example":"/contact","type":"string"},"referrer":{"example":"https://www.google.com/","type":"string"},"utmSource":{"example":"google","type":"string"},"utmMedium":{"example":"cpc","type":"string"},"utmCampaign":{"example":"healthcare-intake","type":"string"},"message":{"type":"string","example":"I want a demo for my 200-person team."}},"required":["name","email","message"]}}}},"responses":{"200":{"description":"Message received","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/build-info":{"get":{"tags":["Meta"],"summary":"Build and deployment metadata","operationId":"getBuildInfo","responses":{"200":{"description":"Build info","content":{"application/json":{"schema":{"type":"object","properties":{"buildId":{"type":"string","example":"abc1234"},"deploymentTime":{"type":"string"},"version":{"type":"string","example":"1.0.0"}},"required":["buildId","deploymentTime","version"],"additionalProperties":{}}}}}}}},"/api/openapi.json":{"get":{"tags":["Meta"],"summary":"Raw OpenAPI specification document","operationId":"getOpenApiDocument","responses":{"200":{"description":"OpenAPI document","content":{"application/json":{"schema":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}}}}}},"/api/csrf":{"get":{"tags":["Meta"],"summary":"Get CSRF token for cookie-auth requests","operationId":"getCsrfToken","responses":{"200":{"description":"CSRF token issued","content":{"application/json":{"schema":{"type":"object","properties":{"csrfToken":{"type":"string","example":"a1b2c3d4e5f6"}},"required":["csrfToken"],"additionalProperties":false}}}}}}},"/api/cp/metrics":{"get":{"tags":["Metrics"],"summary":"Get overall dashboard metrics","description":"Returns aggregated usage and health metrics for the authenticated tenant.","operationId":"getDashboardMetrics","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Dashboard metrics","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"totalSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"activeSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalLeads":{"type":"integer","minimum":0,"maximum":9007199254740991},"errorRate":{"type":"number","minimum":0,"maximum":1},"systemHealth":{"type":"string","enum":["healthy","degraded","down"]}},"required":["success","totalSessions","activeSessions","totalLeads","errorRate","systemHealth"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/metrics/overview":{"get":{"tags":["Metrics"],"summary":"Pilot headline metrics overview","description":"Aggregates session and pilot counts for the authenticated tenant (spec 005 follow-up).","operationId":"getMetricsOverview","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Overview metrics","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenantId":{"type":"string"},"generatedAt":{"type":"string"},"callsHandled":{"type":"integer","minimum":0,"maximum":9007199254740991},"leadsCaptured":{"type":"integer","minimum":0,"maximum":9007199254740991},"activePilots":{"type":"integer","minimum":0,"maximum":9007199254740991},"bookingsRequested":{"type":"integer","minimum":0,"maximum":9007199254740991},"bookingsConfirmed":{"type":"integer","minimum":0,"maximum":9007199254740991},"documentsRequested":{"type":"integer","minimum":0,"maximum":9007199254740991},"paymentsFollowedUp":{"type":"integer","minimum":0,"maximum":9007199254740991},"exceptionsOpen":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["success","tenantId","generatedAt","callsHandled","leadsCaptured","activePilots","bookingsRequested","bookingsConfirmed","documentsRequested","paymentsFollowedUp","exceptionsOpen"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/metrics/summary":{"get":{"tags":["Metrics"],"summary":"Get 24 hour tenant metrics summary","description":"Returns summary counters and deltas for the authenticated tenant.","operationId":"getMetricsSummary","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Metrics summary","content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string"},"windowStart":{"type":"string"},"windowEnd":{"type":"string"},"callsToday":{"type":"integer","minimum":0,"maximum":9007199254740991},"callsTodayDelta":{"type":"number"},"avgLatencyMs":{"anyOf":[{"type":"number"},{"type":"null"}]},"avgLatencyMsDelta":{"anyOf":[{"type":"number"},{"type":"null"}]},"errorRatePct":{"anyOf":[{"type":"number"},{"type":"null"}]},"errorRatePctDelta":{"anyOf":[{"type":"number"},{"type":"null"}]},"activeScenarios":{"type":"integer","minimum":0,"maximum":9007199254740991},"cost24hUsd":{"anyOf":[{"type":"number"},{"type":"null"}]},"leadsNew":{"type":"integer","minimum":0,"maximum":9007199254740991},"leadsHot":{"type":"integer","minimum":0,"maximum":9007199254740991},"pilotsActive":{"type":"integer","minimum":0,"maximum":9007199254740991},"pilotsConverted":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["tenantId","windowStart","windowEnd","callsToday","callsTodayDelta","avgLatencyMs","avgLatencyMsDelta","errorRatePct","errorRatePctDelta","activeScenarios","cost24hUsd","leadsNew","leadsHot","pilotsActive","pilotsConverted"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/metrics/trends":{"get":{"tags":["Metrics"],"summary":"Get tenant metric trends","description":"Returns hour/day bucketed trend series for the authenticated tenant.","operationId":"getMetricsTrends","security":[{"bearerAuth":[]}],"parameters":[{"name":"window","in":"query","required":false,"schema":{"type":"string","enum":["24h","7d","30d"]},"description":"Trend window. Defaults to 24h."}],"responses":{"200":{"description":"Trend series","content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string"},"resolution":{"type":"string","enum":["hour","day"]},"series":{"type":"object","properties":{"callsByHour":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["t","value"],"additionalProperties":false}},"latencyByHour":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["t","value"],"additionalProperties":false}},"errorRateByHour":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["t","value"],"additionalProperties":false}},"activeScenariosByHour":{"type":"array","items":{"type":"object","properties":{"t":{"type":"string"},"value":{"anyOf":[{"type":"number"},{"type":"null"}]}},"required":["t","value"],"additionalProperties":false}}},"required":["callsByHour","latencyByHour","errorRateByHour","activeScenariosByHour"],"additionalProperties":false}},"required":["tenantId","resolution","series"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/metrics/scenario-health":{"get":{"tags":["Metrics"],"summary":"Get per-scenario health","description":"Returns 24 hour per-scenario health rows for the authenticated tenant.","operationId":"getScenarioHealth","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Scenario health","content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string"},"windowStart":{"type":"string"},"windowEnd":{"type":"string"},"rows":{"type":"array","items":{"type":"object","properties":{"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"industry":{"type":"string"},"callsLast24h":{"type":"integer","minimum":0,"maximum":9007199254740991},"completionRatePct":{"anyOf":[{"type":"number"},{"type":"null"}]},"avgDurationSeconds":{"anyOf":[{"type":"number"},{"type":"null"}]},"exceptionsOpen":{"type":"integer","minimum":0,"maximum":9007199254740991},"status":{"type":"string","enum":["healthy","degraded","unhealthy","no_data"]}},"required":["scenarioId","scenarioTitle","industry","callsLast24h","completionRatePct","avgDurationSeconds","exceptionsOpen","status"],"additionalProperties":false}}},"required":["tenantId","windowStart","windowEnd","rows"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/metrics/sessions/events":{"get":{"tags":["Metrics"],"summary":"Get recent session feed events","description":"Returns recent session feed events as JSON, or streams them when the client requests text/event-stream.","operationId":"getSessionFeedEvents","security":[{"bearerAuth":[]}],"parameters":[{"name":"since","in":"query","required":false,"schema":{"type":"string","format":"date-time"},"description":"Only return events newer than this ISO timestamp."}],"responses":{"200":{"description":"Recent session events","content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string"},"events":{"type":"array","items":{"type":"object","properties":{"eventType":{"type":"string","enum":["session.started","session.tool.invoked","session.completed","session.exception"]},"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"tenantId":{"type":"string"},"occurredAt":{"type":"string"},"toolName":{"type":"string"},"durationMs":{"type":"number"},"exceptionReasonCode":{"type":"string"}},"required":["eventType","sessionId","scenarioId","scenarioTitle","tenantId","occurredAt"],"additionalProperties":false}}},"required":["tenantId","events"],"additionalProperties":false}},"text/event-stream":{"schema":{"type":"string"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/metrics/pipeline":{"get":{"tags":["Metrics"],"summary":"Get real lead + pilot pipeline counters","description":"Returns durable lead and pilot counts per tenant (specs 001 + 002).","operationId":"getPipelineMetrics","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Pipeline counters","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenantId":{"type":"string"},"generatedAt":{"type":"string"},"leads":{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"last7d":{"type":"integer","minimum":0,"maximum":9007199254740991},"byStatus":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}},"byTier":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}}},"required":["total","last7d","byStatus","byTier"],"additionalProperties":false},"pilots":{"anyOf":[{"type":"object","properties":{"total":{"type":"integer","minimum":0,"maximum":9007199254740991},"activeOrSetup":{"type":"integer","minimum":0,"maximum":9007199254740991},"converted":{"type":"integer","minimum":0,"maximum":9007199254740991},"byStatus":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"integer","minimum":0,"maximum":9007199254740991}}},"required":["total","activeOrSetup","converted","byStatus"],"additionalProperties":false},{"type":"null"}]}},"required":["success","tenantId","generatedAt","leads","pilots"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/metrics/scenarios":{"get":{"tags":["Metrics"],"summary":"Get scenario-specific metrics","description":"Returns breakdown of metrics by scenario.","operationId":"getScenarioMetrics","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Scenario metrics","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"scenarios":{"type":"array","items":{"type":"object","properties":{"scenarioId":{"type":"string"},"totalSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"successfulOutcomes":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedOutcomes":{"type":"integer","minimum":0,"maximum":9007199254740991},"averageDurationSeconds":{"type":"number","minimum":0}},"required":["scenarioId","totalSessions","successfulOutcomes","failedOutcomes","averageDurationSeconds"],"additionalProperties":false}}},"required":["success","scenarios"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/public/slos":{"get":{"tags":["Public"],"summary":"Public per-scenario SLOs","description":"Aggregate latency, success-rate, and tool-call-success metrics per scenario. Publicly accessible (no auth) — designed to be embedded on /trust-center. Cache: public, max-age=300.","operationId":"getPublicSLOs","responses":{"200":{"description":"SLO snapshot covering every public scenario","content":{"application/json":{"schema":{"type":"object","properties":{"generatedAt":{"type":"string"},"scenarios":{"type":"array","items":{"type":"object","properties":{"slug":{"type":"string"},"title":{"type":"string"},"industry":{"type":"string"},"latencyP50Ms":{"type":"number","minimum":0},"latencyP95Ms":{"type":"number","minimum":0},"successRate":{"type":"number","minimum":0,"maximum":1},"toolCallSuccessRate":{"type":"number","minimum":0,"maximum":1},"sampleSize":{"type":"integer","minimum":0,"maximum":9007199254740991},"periodDays":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991}},"required":["slug","title","industry","latencyP50Ms","latencyP95Ms","successRate","toolCallSuccessRate","sampleSize","periodDays"],"additionalProperties":false}}},"required":["generatedAt","scenarios"],"additionalProperties":false}}}},"500":{"description":"Failed to build snapshot","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/workflows/trigger":{"post":{"tags":["Workflows"],"summary":"Trigger a workflow execution","description":"Manually triggers a workflow for a specific profile or session.","operationId":"triggerWorkflow","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"profileId":{"type":"string"},"sessionId":{"type":"string"},"action":{"type":"string"},"payload":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["action"]}}}},"responses":{"200":{"description":"Workflow triggered","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"executionId":{"type":"string"}},"required":["success","executionId"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/workflows/{profileId}":{"get":{"tags":["Workflows"],"summary":"Get workflow state","description":"Retrieves the current draft and published workflow state for a profile.","operationId":"getWorkflowState","security":[{"bearerAuth":[]}],"parameters":[{"name":"profileId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Workflow state","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"workflow":{"type":"object","properties":{"id":{"type":"string"},"profileId":{"type":"string"},"status":{"type":"string","enum":["draft","published","archived"]},"nodes":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"edges":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"updatedAt":{"type":"string"},"publishedAt":{"type":"string"}},"required":["id","profileId","status","nodes","edges","updatedAt"],"additionalProperties":false}},"required":["success","workflow"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/workflows/{profileId}/draft":{"put":{"tags":["Workflows"],"summary":"Update workflow draft","description":"Saves changes to the workflow draft without publishing.","operationId":"updateWorkflowDraft","security":[{"bearerAuth":[]}],"parameters":[{"name":"profileId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"nodes":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"edges":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"required":["nodes","edges"]}}}},"responses":{"200":{"description":"Draft updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"workflow":{"type":"object","properties":{"id":{"type":"string"},"profileId":{"type":"string"},"status":{"type":"string","enum":["draft","published","archived"]},"nodes":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"edges":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"updatedAt":{"type":"string"},"publishedAt":{"type":"string"}},"required":["id","profileId","status","nodes","edges","updatedAt"],"additionalProperties":false}},"required":["success","workflow"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/workflows/{profileId}/publish":{"post":{"tags":["Workflows"],"summary":"Publish workflow draft","description":"Publishes the current draft to be active for the profile.","operationId":"publishWorkflow","security":[{"bearerAuth":[]}],"parameters":[{"name":"profileId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Workflow published","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"workflow":{"type":"object","properties":{"id":{"type":"string"},"profileId":{"type":"string"},"status":{"type":"string","enum":["draft","published","archived"]},"nodes":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"edges":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"updatedAt":{"type":"string"},"publishedAt":{"type":"string"}},"required":["id","profileId","status","nodes","edges","updatedAt"],"additionalProperties":false}},"required":["success","workflow"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/leads":{"get":{"tags":["Control-plane Leads"],"summary":"List leads for the authenticated tenant","operationId":"cpListLeads","security":[{"bearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["new","contacted","pilot_requested","pilot_active","paid","lost"]}},{"name":"tier","in":"query","required":false,"schema":{"type":"string","enum":["hot","warm","cold"]}},{"name":"scenarioId","in":"query","required":false,"schema":{"type":"string"}},{"name":"since","in":"query","required":false,"schema":{"type":"string"},"description":"ISO-8601 lower bound"}],"responses":{"200":{"description":"Lead list","content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"leads":{"type":"array","items":{"type":"object","properties":{"leadId":{"type":"string","example":"LEAD-12345678"},"tenantId":{"type":"string","example":"default-practice"},"contact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"role":{"type":"string"},"phone":{"type":"string"}},"required":["email"],"additionalProperties":false},"attribution":{"type":"object","properties":{"source":{"type":"string"},"sourcePath":{"type":"string"},"referrer":{"type":"string"},"utmSource":{"type":"string"},"utmMedium":{"type":"string"},"utmCampaign":{"type":"string"}},"additionalProperties":false},"demo":{"type":"object","properties":{"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"sessionId":{"type":"string"},"sessionDurationSeconds":{"type":"number"},"toolsInvoked":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"reachedResults":{"type":"boolean"}},"additionalProperties":false},"score":{"type":"number"},"tier":{"type":"string","enum":["hot","warm","cold"]},"scoreLabel":{"type":"string"},"status":{"type":"string","enum":["new","contacted","pilot_requested","pilot_active","paid","lost"]},"crm":{"type":"object","properties":{"hubspotContactId":{"type":"string"},"hubspotDealId":{"type":"string"}},"additionalProperties":false},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"previousMidDemoLeadId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["leadId","tenantId","contact","attribution","demo","score","tier","scoreLabel","status","crm","notes","createdAt","updatedAt"],"additionalProperties":false}}},"required":["tenantId","count","leads"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/leads/export.csv":{"get":{"tags":["Control-plane Leads"],"summary":"Export tenant leads as CSV","operationId":"cpExportLeadsCsv","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"CSV stream","content":{"text/csv":{"schema":{"type":"string"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/leads/{leadId}":{"get":{"tags":["Control-plane Leads"],"summary":"Get a single lead by id","operationId":"cpGetLead","security":[{"bearerAuth":[]}],"parameters":[{"name":"leadId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Lead record","content":{"application/json":{"schema":{"type":"object","properties":{"leadId":{"type":"string","example":"LEAD-12345678"},"tenantId":{"type":"string","example":"default-practice"},"contact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"role":{"type":"string"},"phone":{"type":"string"}},"required":["email"],"additionalProperties":false},"attribution":{"type":"object","properties":{"source":{"type":"string"},"sourcePath":{"type":"string"},"referrer":{"type":"string"},"utmSource":{"type":"string"},"utmMedium":{"type":"string"},"utmCampaign":{"type":"string"}},"additionalProperties":false},"demo":{"type":"object","properties":{"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"sessionId":{"type":"string"},"sessionDurationSeconds":{"type":"number"},"toolsInvoked":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"reachedResults":{"type":"boolean"}},"additionalProperties":false},"score":{"type":"number"},"tier":{"type":"string","enum":["hot","warm","cold"]},"scoreLabel":{"type":"string"},"status":{"type":"string","enum":["new","contacted","pilot_requested","pilot_active","paid","lost"]},"crm":{"type":"object","properties":{"hubspotContactId":{"type":"string"},"hubspotDealId":{"type":"string"}},"additionalProperties":false},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"previousMidDemoLeadId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["leadId","tenantId","contact","attribution","demo","score","tier","scoreLabel","status","crm","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"patch":{"tags":["Control-plane Leads"],"summary":"Update a lead status","operationId":"cpPatchLead","security":[{"bearerAuth":[]}],"parameters":[{"name":"leadId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["new","contacted","pilot_requested","pilot_active","paid","lost"]}},"required":["status"]}}}},"responses":{"200":{"description":"Updated lead","content":{"application/json":{"schema":{"type":"object","properties":{"leadId":{"type":"string","example":"LEAD-12345678"},"tenantId":{"type":"string","example":"default-practice"},"contact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"role":{"type":"string"},"phone":{"type":"string"}},"required":["email"],"additionalProperties":false},"attribution":{"type":"object","properties":{"source":{"type":"string"},"sourcePath":{"type":"string"},"referrer":{"type":"string"},"utmSource":{"type":"string"},"utmMedium":{"type":"string"},"utmCampaign":{"type":"string"}},"additionalProperties":false},"demo":{"type":"object","properties":{"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"sessionId":{"type":"string"},"sessionDurationSeconds":{"type":"number"},"toolsInvoked":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"reachedResults":{"type":"boolean"}},"additionalProperties":false},"score":{"type":"number"},"tier":{"type":"string","enum":["hot","warm","cold"]},"scoreLabel":{"type":"string"},"status":{"type":"string","enum":["new","contacted","pilot_requested","pilot_active","paid","lost"]},"crm":{"type":"object","properties":{"hubspotContactId":{"type":"string"},"hubspotDealId":{"type":"string"}},"additionalProperties":false},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"previousMidDemoLeadId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["leadId","tenantId","contact","attribution","demo","score","tier","scoreLabel","status","crm","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/leads/{leadId}/notes":{"post":{"tags":["Control-plane Leads"],"summary":"Append an internal note to a lead","operationId":"cpAppendLeadNote","security":[{"bearerAuth":[]}],"parameters":[{"name":"leadId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1}},"required":["body"]}}}},"responses":{"201":{"description":"Note appended","content":{"application/json":{"schema":{"type":"object","properties":{"leadId":{"type":"string","example":"LEAD-12345678"},"tenantId":{"type":"string","example":"default-practice"},"contact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"company":{"type":"string"},"role":{"type":"string"},"phone":{"type":"string"}},"required":["email"],"additionalProperties":false},"attribution":{"type":"object","properties":{"source":{"type":"string"},"sourcePath":{"type":"string"},"referrer":{"type":"string"},"utmSource":{"type":"string"},"utmMedium":{"type":"string"},"utmCampaign":{"type":"string"}},"additionalProperties":false},"demo":{"type":"object","properties":{"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"sessionId":{"type":"string"},"sessionDurationSeconds":{"type":"number"},"toolsInvoked":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"reachedResults":{"type":"boolean"}},"additionalProperties":false},"score":{"type":"number"},"tier":{"type":"string","enum":["hot","warm","cold"]},"scoreLabel":{"type":"string"},"status":{"type":"string","enum":["new","contacted","pilot_requested","pilot_active","paid","lost"]},"crm":{"type":"object","properties":{"hubspotContactId":{"type":"string"},"hubspotDealId":{"type":"string"}},"additionalProperties":false},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"previousMidDemoLeadId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["leadId","tenantId","contact","attribution","demo","score","tier","scoreLabel","status","crm","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/auth/session":{"get":{"tags":["Control-plane Auth"],"summary":"Resolve the current control-plane session and tenant role","operationId":"cpGetAuthSession","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Resolved control-plane session","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"session":{"type":"object","properties":{"userId":{"type":"string"},"orgId":{"anyOf":[{"type":"string"},{"type":"null"}]},"tenantId":{"anyOf":[{"type":"string"},{"type":"null"}]},"isSuperAdmin":{"type":"boolean"},"role":{"anyOf":[{"type":"string","enum":["owner","admin","operator","viewer"]},{"type":"null"}]},"isOwner":{"type":"boolean"},"isAdmin":{"type":"boolean"},"canOperate":{"type":"boolean"},"hasTenantAccess":{"type":"boolean"},"accessState":{"type":"string","enum":["tenant_member","super_admin","no_tenant","no_membership","db_unavailable"]}},"required":["userId","orgId","tenantId","isSuperAdmin","role","isOwner","isAdmin","canOperate","hasTenantAccess","accessState"],"additionalProperties":false}},"required":["success","session"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/pilots":{"get":{"tags":["Control-plane Pilots"],"summary":"List pilots for the authenticated tenant","operationId":"cpListPilots","security":[{"bearerAuth":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","enum":["invited","setup","active","completed","converted","lost"]}},{"name":"verticalPack","in":"query","required":false,"schema":{"type":"string","enum":["accounting","healthcare","legal","service","platform"]}}],"responses":{"200":{"description":"Pilot list","content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991},"pilots":{"type":"array","items":{"type":"object","properties":{"pilotId":{"type":"string","example":"PILOT-AB12CDEF"},"tenantId":{"type":"string"},"sourceLeadId":{"type":"string"},"organizationName":{"type":"string"},"primaryContact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["name","email"],"additionalProperties":false},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","service","platform"]},"status":{"type":"string","enum":["invited","setup","active","completed","converted","lost"]},"successCriteria":{"type":"string"},"pilotStartDate":{"type":"string"},"pilotEndDate":{"type":"string"},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["pilotId","tenantId","organizationName","primaryContact","verticalPack","status","notes","createdAt","updatedAt"],"additionalProperties":false}}},"required":["tenantId","count","pilots"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"post":{"tags":["Control-plane Pilots"],"summary":"Create a pilot for the authenticated tenant","operationId":"cpCreatePilot","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organizationName":{"type":"string"},"primaryContact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["name","email"]},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","service","platform"]},"sourceLeadId":{"type":"string"},"successCriteria":{"type":"string"},"pilotStartDate":{"type":"string"},"pilotEndDate":{"type":"string"},"status":{"type":"string","enum":["invited","setup","active","completed","converted","lost"]}},"required":["organizationName","primaryContact","verticalPack"]}}}},"responses":{"201":{"description":"Pilot created","content":{"application/json":{"schema":{"type":"object","properties":{"pilotId":{"type":"string","example":"PILOT-AB12CDEF"},"tenantId":{"type":"string"},"sourceLeadId":{"type":"string"},"organizationName":{"type":"string"},"primaryContact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["name","email"],"additionalProperties":false},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","service","platform"]},"status":{"type":"string","enum":["invited","setup","active","completed","converted","lost"]},"successCriteria":{"type":"string"},"pilotStartDate":{"type":"string"},"pilotEndDate":{"type":"string"},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["pilotId","tenantId","organizationName","primaryContact","verticalPack","status","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/pilots/{pilotId}":{"get":{"tags":["Control-plane Pilots"],"summary":"Get a single pilot by id","operationId":"cpGetPilot","security":[{"bearerAuth":[]}],"parameters":[{"name":"pilotId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Pilot record with contract, ROI, and snapshots","content":{"application/json":{"schema":{"type":"object","properties":{"pilot":{"type":"object","properties":{"pilotId":{"type":"string","example":"PILOT-AB12CDEF"},"tenantId":{"type":"string"},"sourceLeadId":{"type":"string"},"organizationName":{"type":"string"},"primaryContact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["name","email"],"additionalProperties":false},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","service","platform"]},"status":{"type":"string","enum":["invited","setup","active","completed","converted","lost"]},"successCriteria":{"type":"string"},"pilotStartDate":{"type":"string"},"pilotEndDate":{"type":"string"},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["pilotId","tenantId","organizationName","primaryContact","verticalPack","status","notes","createdAt","updatedAt"],"additionalProperties":false},"contract":{"anyOf":[{"type":"object","properties":{"pilotId":{"type":"string"},"tenantId":{"type":"string"},"setupFeeUsd":{"type":"number"},"monthlyFeeUsd":{"type":"number"},"currency":{"type":"string","const":"USD"},"signedAt":{"type":"string"},"paidAt":{"type":"string"},"convertedToAnnualAt":{"type":"string"},"annualAcvUsd":{"type":"number"},"contractRef":{"type":"string"}},"required":["pilotId","tenantId","currency"],"additionalProperties":false},{"type":"null"}]},"roi":{"anyOf":[{"type":"object","properties":{"pilotId":{"type":"string"},"tenantId":{"type":"string"},"laborHourlyRateUsd":{"type":"number"},"averageManualHandleTimeMinutes":{"type":"number"},"baselineCallsPerWeek":{"type":"number"},"baselineMissedCallRatePct":{"type":"number"},"appointmentValueUsd":{"type":"number"},"collectionRecoveryValueUsd":{"type":"number"},"noShowRecoveryValueUsd":{"type":"number"},"afterHoursCaptureMultiplier":{"type":"number"},"notes":{"type":"string"},"updatedAt":{"type":"string"},"updatedByUserId":{"type":"string"}},"required":["pilotId","tenantId","laborHourlyRateUsd","averageManualHandleTimeMinutes","updatedAt"],"additionalProperties":false},{"type":"null"}]},"snapshots":{"type":"array","items":{"type":"object","properties":{"pilotId":{"type":"string"},"tenantId":{"type":"string"},"weekId":{"type":"string"},"weekStart":{"type":"string"},"weekEnd":{"type":"string"},"callsHandled":{"type":"integer","minimum":0,"maximum":9007199254740991},"missedCallsRecovered":{"type":"integer","minimum":0,"maximum":9007199254740991},"bookingsRequested":{"type":"integer","minimum":0,"maximum":9007199254740991},"bookingsConfirmed":{"type":"integer","minimum":0,"maximum":9007199254740991},"exceptionsOpen":{"type":"integer","minimum":0,"maximum":9007199254740991},"exceptionsResolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"estimatedTimeSavedHours":{"type":"number"},"estimatedValueRecoveredUsd":{"type":"number"},"createdAt":{"type":"string"}},"required":["pilotId","tenantId","weekId","weekStart","weekEnd","callsHandled","missedCallsRecovered","bookingsRequested","bookingsConfirmed","exceptionsOpen","exceptionsResolved","estimatedTimeSavedHours","estimatedValueRecoveredUsd","createdAt"],"additionalProperties":false}}},"required":["pilot","contract","roi","snapshots"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"patch":{"tags":["Control-plane Pilots"],"summary":"Update a pilot (partial)","operationId":"cpPatchPilot","security":[{"bearerAuth":[]}],"parameters":[{"name":"pilotId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organizationName":{"type":"string"},"primaryContact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["name","email"]},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","service","platform"]},"status":{"type":"string","enum":["invited","setup","active","completed","converted","lost"]},"successCriteria":{"type":"string"},"pilotStartDate":{"type":"string"},"pilotEndDate":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated pilot","content":{"application/json":{"schema":{"type":"object","properties":{"pilotId":{"type":"string","example":"PILOT-AB12CDEF"},"tenantId":{"type":"string"},"sourceLeadId":{"type":"string"},"organizationName":{"type":"string"},"primaryContact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["name","email"],"additionalProperties":false},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","service","platform"]},"status":{"type":"string","enum":["invited","setup","active","completed","converted","lost"]},"successCriteria":{"type":"string"},"pilotStartDate":{"type":"string"},"pilotEndDate":{"type":"string"},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["pilotId","tenantId","organizationName","primaryContact","verticalPack","status","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/pilots/{pilotId}/notes":{"post":{"tags":["Control-plane Pilots"],"summary":"Append an internal note to a pilot","operationId":"cpAppendPilotNote","security":[{"bearerAuth":[]}],"parameters":[{"name":"pilotId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"body":{"type":"string","minLength":1}},"required":["body"]}}}},"responses":{"201":{"description":"Note appended","content":{"application/json":{"schema":{"type":"object","properties":{"pilotId":{"type":"string","example":"PILOT-AB12CDEF"},"tenantId":{"type":"string"},"sourceLeadId":{"type":"string"},"organizationName":{"type":"string"},"primaryContact":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"}},"required":["name","email"],"additionalProperties":false},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","service","platform"]},"status":{"type":"string","enum":["invited","setup","active","completed","converted","lost"]},"successCriteria":{"type":"string"},"pilotStartDate":{"type":"string"},"pilotEndDate":{"type":"string"},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"authorUserId":{"type":"string"},"authorDisplayName":{"type":"string"},"body":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","body","createdAt"],"additionalProperties":false}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["pilotId","tenantId","organizationName","primaryContact","verticalPack","status","notes","createdAt","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/pilots/{pilotId}/contract":{"put":{"tags":["Control-plane Pilots"],"summary":"Upsert pilot commercial contract","operationId":"cpPutPilotContract","security":[{"bearerAuth":[]}],"parameters":[{"name":"pilotId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"setupFeeUsd":{"type":"number"},"monthlyFeeUsd":{"type":"number"},"signedAt":{"type":"string"},"paidAt":{"type":"string"},"convertedToAnnualAt":{"type":"string"},"annualAcvUsd":{"type":"number"},"contractRef":{"type":"string"}}}}}},"responses":{"200":{"description":"Contract saved","content":{"application/json":{"schema":{"type":"object","properties":{"pilotId":{"type":"string"},"tenantId":{"type":"string"},"setupFeeUsd":{"type":"number"},"monthlyFeeUsd":{"type":"number"},"currency":{"type":"string","const":"USD"},"signedAt":{"type":"string"},"paidAt":{"type":"string"},"convertedToAnnualAt":{"type":"string"},"annualAcvUsd":{"type":"number"},"contractRef":{"type":"string"}},"required":["pilotId","tenantId","currency"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/pilots/{pilotId}/roi":{"put":{"tags":["Control-plane Pilots"],"summary":"Upsert pilot ROI assumptions","operationId":"cpPutPilotRoi","security":[{"bearerAuth":[]}],"parameters":[{"name":"pilotId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"laborHourlyRateUsd":{"type":"number"},"averageManualHandleTimeMinutes":{"type":"number"},"baselineCallsPerWeek":{"type":"number"},"baselineMissedCallRatePct":{"type":"number"},"appointmentValueUsd":{"type":"number"},"collectionRecoveryValueUsd":{"type":"number"},"noShowRecoveryValueUsd":{"type":"number"},"afterHoursCaptureMultiplier":{"type":"number"},"notes":{"type":"string"}}}}}},"responses":{"200":{"description":"ROI assumptions saved","content":{"application/json":{"schema":{"type":"object","properties":{"pilotId":{"type":"string"},"tenantId":{"type":"string"},"laborHourlyRateUsd":{"type":"number"},"averageManualHandleTimeMinutes":{"type":"number"},"baselineCallsPerWeek":{"type":"number"},"baselineMissedCallRatePct":{"type":"number"},"appointmentValueUsd":{"type":"number"},"collectionRecoveryValueUsd":{"type":"number"},"noShowRecoveryValueUsd":{"type":"number"},"afterHoursCaptureMultiplier":{"type":"number"},"notes":{"type":"string"},"updatedAt":{"type":"string"},"updatedByUserId":{"type":"string"}},"required":["pilotId","tenantId","laborHourlyRateUsd","averageManualHandleTimeMinutes","updatedAt"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/pilots/{pilotId}/snapshots":{"get":{"tags":["Control-plane Pilots"],"summary":"List weekly metric snapshots for a pilot","operationId":"cpListPilotSnapshots","security":[{"bearerAuth":[]}],"parameters":[{"name":"pilotId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Snapshots","content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string"},"pilotId":{"type":"string"},"snapshots":{"type":"array","items":{"type":"object","properties":{"pilotId":{"type":"string"},"tenantId":{"type":"string"},"weekId":{"type":"string"},"weekStart":{"type":"string"},"weekEnd":{"type":"string"},"callsHandled":{"type":"integer","minimum":0,"maximum":9007199254740991},"missedCallsRecovered":{"type":"integer","minimum":0,"maximum":9007199254740991},"bookingsRequested":{"type":"integer","minimum":0,"maximum":9007199254740991},"bookingsConfirmed":{"type":"integer","minimum":0,"maximum":9007199254740991},"exceptionsOpen":{"type":"integer","minimum":0,"maximum":9007199254740991},"exceptionsResolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"estimatedTimeSavedHours":{"type":"number"},"estimatedValueRecoveredUsd":{"type":"number"},"createdAt":{"type":"string"}},"required":["pilotId","tenantId","weekId","weekStart","weekEnd","callsHandled","missedCallsRecovered","bookingsRequested","bookingsConfirmed","exceptionsOpen","exceptionsResolved","estimatedTimeSavedHours","estimatedValueRecoveredUsd","createdAt"],"additionalProperties":false}}},"required":["tenantId","pilotId","snapshots"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/pilots/{pilotId}/snapshot/recompute":{"post":{"tags":["Control-plane Pilots"],"summary":"Recompute weekly snapshot for a pilot","operationId":"cpPostPilotSnapshotRecompute","security":[{"bearerAuth":[]}],"parameters":[{"name":"pilotId","in":"path","required":true,"schema":{"type":"string"}},{"name":"weekId","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Snapshot upserted","content":{"application/json":{"schema":{"type":"object","properties":{"pilotId":{"type":"string"},"tenantId":{"type":"string"},"weekId":{"type":"string"},"weekStart":{"type":"string"},"weekEnd":{"type":"string"},"callsHandled":{"type":"integer","minimum":0,"maximum":9007199254740991},"missedCallsRecovered":{"type":"integer","minimum":0,"maximum":9007199254740991},"bookingsRequested":{"type":"integer","minimum":0,"maximum":9007199254740991},"bookingsConfirmed":{"type":"integer","minimum":0,"maximum":9007199254740991},"exceptionsOpen":{"type":"integer","minimum":0,"maximum":9007199254740991},"exceptionsResolved":{"type":"integer","minimum":0,"maximum":9007199254740991},"estimatedTimeSavedHours":{"type":"number"},"estimatedValueRecoveredUsd":{"type":"number"},"createdAt":{"type":"string"}},"required":["pilotId","tenantId","weekId","weekStart","weekEnd","callsHandled","missedCallsRecovered","bookingsRequested","bookingsConfirmed","exceptionsOpen","exceptionsResolved","estimatedTimeSavedHours","estimatedValueRecoveredUsd","createdAt"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions":{"get":{"tags":["Sessions CP"],"summary":"List sessions (Control Plane)","description":"Returns a paginated list of all sessions for the tenant.","operationId":"cpListSessions","security":[{"bearerAuth":[]}],"parameters":[{"name":"page","in":"query","schema":{"type":"integer"}},{"name":"limit","in":"query","schema":{"type":"integer"}}],"responses":{"200":{"description":"Sessions list","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"sessions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"companyName":{"type":"string"},"requestedLocale":{"type":"string"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"text":{"type":"string"},"timestamp":{"type":"number"}},"required":["role","text","timestamp"],"additionalProperties":false}},"timelineEvents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"system":{"type":"string"},"timestamp":{"type":"string"}},"required":["id","type","title","description","system","timestamp"],"additionalProperties":false}},"toolsUsed":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"leadScore":{"type":"number"},"leadTier":{"type":"string"},"tenantId":{"type":"string"},"extractedData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"interactionSummary":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"contact":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"intent":{"type":"string"},"disposition":{"type":"string","enum":["resolved","booked","qualified","follow_up_required","escalated","abandoned"]},"telephony":{"type":"object","properties":{"requested":{"type":"boolean"},"mode":{"type":"string","enum":["live_transfer","callback"]},"status":{"type":"string","enum":["not_required","pending","queued","completed","failed"]},"target":{"type":"string"},"phoneNumber":{"type":"string"},"timeWindow":{"type":"string"},"providerId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"escalation":{"type":"object","properties":{"requested":{"type":"boolean"},"reason":{"type":"string"},"target":{"type":"string"},"status":{"type":"string","enum":["pending","completed","not_required"]}},"required":["requested"],"additionalProperties":false},"booking":{"type":"object","properties":{"requested":{"type":"boolean"},"status":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"scheduledFor":{"type":"string"},"referenceId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"summary":{"type":"string"},"nextAction":{"type":"string"}},"additionalProperties":false},{"type":"null"}]},"workflowPolicy":{"type":"object","properties":{"workflowProfileId":{"type":"string"},"workflowDefinitionId":{"type":"string"},"workflowVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"routingTag":{"type":"string","enum":["standard","after_hours","existing_account","payment_path","dispute_path"]},"state":{"type":"string","enum":["active","handoff","completed","fallback","retry","escalation"]},"resolutionReason":{"type":"string"},"businessHoursOpen":{"type":"boolean"},"evaluatedAt":{"type":"string"},"experiment":{"type":"object","properties":{"experimentId":{"type":"string"},"variantId":{"type":"string"},"assignmentHash":{"type":"integer","minimum":0,"maximum":9007199254740991},"assignedAt":{"type":"string"}},"required":["experimentId","variantId","assignmentHash","assignedAt"],"additionalProperties":false}},"required":["workflowProfileId","workflowDefinitionId","workflowVersion","routingTag","state","resolutionReason","businessHoursOpen","evaluatedAt"],"additionalProperties":false},"omnichannelThread":{"type":"object","properties":{"threadId":{"type":"string"},"sessionId":{"type":"string"},"tenantId":{"type":"string"},"correlationId":{"type":"string"},"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["threadId","sessionId","tenantId","correlationId","channel","createdAt","updatedAt"],"additionalProperties":false},"transferHandoff":{"anyOf":[{"type":"object","properties":{"handoffId":{"type":"string"},"reason":{"type":"string"},"fromPersonaId":{"type":"string"},"toPersonaId":{"type":"string"},"fromChannel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"toChannel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"transferMode":{"type":"string","enum":["warm_transfer","cold_transfer","callback","async_followup"]},"summary":{"type":"string"},"keyFacts":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string"},"transcriptExcerpt":{"type":"string"}},"required":["handoffId","reason","fromPersonaId","fromChannel","transferMode","summary","keyFacts","timestamp"],"additionalProperties":false},{"type":"null"}]},"entitlementCheck":{"type":"object","properties":{"policyId":{"type":"string"},"decision":{"type":"string","enum":["allow","deny","conditional"]},"reasonCode":{"type":"string"},"reason":{"type":"string"},"grantedCapabilities":{"type":"array","items":{"type":"string"}},"deniedCapabilities":{"type":"array","items":{"type":"string"}},"obligations":{"type":"array","items":{"type":"string"}},"evaluatedAt":{"type":"string"}},"required":["policyId","decision","reasonCode","reason","grantedCapabilities","deniedCapabilities","obligations","evaluatedAt"],"additionalProperties":false},"consentRetention":{"type":"object","properties":{"consentStatus":{"type":"string","enum":["granted","denied","unknown"]},"consentSource":{"type":"string"},"transcriptRetention":{"type":"string","enum":["full","metadata_only","none"]},"artifactRetentionDays":{"type":"integer","minimum":0,"maximum":9007199254740991},"artifactExpiresAt":{"type":"string"},"retentionReason":{"type":"string"},"enforcedAt":{"type":"string"},"redacted":{"type":"boolean"}},"required":["consentStatus","consentSource","transcriptRetention","artifactRetentionDays","artifactExpiresAt","retentionReason","enforcedAt","redacted"],"additionalProperties":false},"bookingRequest":{"anyOf":[{"type":"object","properties":{"callerType":{"type":"string","enum":["new","existing","returning","unknown"]},"reason":{"type":"string"},"urgency":{"type":"string","enum":["routine","soon","urgent"]},"preferredWindows":{"type":"array","items":{"type":"string"}},"serviceLine":{"type":"string"},"location":{"type":"string"},"providerRole":{"type":"string"},"durationMinutes":{"type":"number"},"timezone":{"type":"string"},"followUpChannel":{"type":"string","enum":["voice","sms","email","web"]},"healthcare":{"type":"object","properties":{"insuranceProvider":{"type":"string"},"memberId":{"type":"string"},"referralRequired":{"type":"boolean"},"visitType":{"type":"string"},"consentComplete":{"type":"boolean"}},"additionalProperties":false},"accounting":{"type":"object","properties":{"entityType":{"type":"string"},"serviceType":{"type":"string"},"taxTopic":{"type":"string"},"bookkeepingNeeds":{"type":"string"},"documentsComplete":{"type":"boolean"}},"additionalProperties":false}},"required":["preferredWindows"],"additionalProperties":false},{"type":"null"}]},"bookingQualification":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ready","missing_info","needs_review"]},"missingFields":{"type":"array","items":{"type":"string"}},"missingQualifiers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["reason","preferred_windows","duration_minutes","insurance_provider","member_id","consent_complete","entity_type","service_type","documents_pending","prereq_documents","review_required"]},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"resolutionHint":{"type":"string"}},"required":["code","category","label"],"additionalProperties":false}},"reviewFlags":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["reason","preferred_windows","duration_minutes","insurance_provider","member_id","consent_complete","entity_type","service_type","documents_pending","prereq_documents","review_required"]},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"resolutionHint":{"type":"string"}},"required":["code","category","label"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"string"}},"requiredItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}},"completedItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}},"blockingItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}}},"required":["status","missingFields","missingQualifiers","reviewFlags","notes","requiredItems","completedItems","blockingItems"],"additionalProperties":false},{"type":"null"}]},"availabilitySuggestions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"rank":{"type":"number"},"score":{"type":"number"},"providerId":{"type":"string"},"source":{"type":"string","enum":["calendar","stub","admin_override"]},"reasonCodes":{"type":"array","items":{"type":"string","enum":["scheduled_slot_preserved","preferred_window_primary","preferred_window_secondary","service_line_alignment","urgency_priority","callback_continuity","default_policy"]}},"reasons":{"type":"array","items":{"type":"string"}},"connectorStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"]},"capacityHint":{"type":"string"}},"required":["id","start","end","rank","score","source","reasonCodes","reasons"],"additionalProperties":false}},"bookingOutcome":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]},"nextReminderDueAt":{"type":"string"},"reminderAttemptCount":{"type":"number"},"lastReminderResult":{"type":"string","enum":["not_sent","queued","sent","failed"]},"backfillCandidateCount":{"type":"number"},"reminderScheduledFor":{"type":"string"},"reminderAttempts":{"type":"number"},"lastTransitionAction":{"type":"string","enum":["confirm","request_reschedule","cancel","mark_no_show","send_reminder","mark_reminder_failed","complete_no_show_recovery"]},"externalEventId":{"type":"string"},"externalProvider":{"type":"string"},"confirmationCode":{"type":"string"},"updatedAt":{"type":"string"},"bookingOrchestration":{"type":"object","properties":{"workflowId":{"type":"string"},"phase":{"type":"string","enum":["reminder_pending","completed","cancelled"]},"updatedAt":{"type":"string"}},"required":["workflowId","phase","updatedAt"],"additionalProperties":false},"approvalStatus":{"type":"string","enum":["not_required","pending","approved","rejected"]},"approvalRequestedAt":{"type":"string"},"approvalResolvedAt":{"type":"string"},"approvalResolvedBy":{"type":"string"},"approvalNotes":{"type":"string"}},"required":["status","updatedAt"],"additionalProperties":false},{"type":"null"}]},"bookingExceptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"reasonCode":{"type":"string","enum":["no_slot","missing_qualifier","connector_unavailable","customer_unresponsive","booking_writeback_failed","reminder_delivery_failed","auth_verification_failed","core_banking_timeout","complaint_system_degraded","ambiguous_multilingual_transcript","ambiguous_urdu_english","digital_handoff_failed"]},"reasonGroup":{"type":"string","enum":["scheduling","qualification","reminder_follow_up","connector","customer_responsiveness"]},"status":{"type":"string","enum":["open","resolved"]},"title":{"type":"string"},"message":{"type":"string"},"sessionId":{"type":"string"},"tenantId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"assignedTo":{"type":"string"},"assigneeDisplay":{"type":"string"},"resolvedAt":{"type":"string"},"resolutionNote":{"type":"string"},"lastAction":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]},"connectorKind":{"type":"string","enum":["calendar","telephony","ehr","erp","webhook"]},"connectorProviderId":{"type":"string"},"bookingSnapshot":{"type":"object","properties":{"bookingStatus":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"bookingOutcomeStatus":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"qualificationStatus":{"type":"string","enum":["ready","missing_info","needs_review"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]}},"additionalProperties":false},"relatedSuggestionIds":{"type":"array","items":{"type":"string"}},"suggestedActions":{"type":"array","items":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]}},"diagnostics":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"remediationSteps":{"type":"array","items":{"type":"object","properties":{"step":{"type":"number"},"label":{"type":"string"},"detail":{"type":"string"},"action":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]}},"required":["step","label","detail"],"additionalProperties":false}}},"required":["id","reasonCode","reasonGroup","status","title","message","sessionId","tenantId","createdAt","updatedAt","suggestedActions"],"additionalProperties":false}},"domainModuleId":{"anyOf":[{"type":"string"},{"type":"null"}]},"domainPayload":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"healthcareIntakePayload":{"anyOf":[{"type":"object","properties":{"patient":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"dateOfBirth":{"type":"string"},"phone":{"type":"string"}},"required":["firstName","lastName","dateOfBirth"],"additionalProperties":false},"visit":{"type":"object","properties":{"reasonForVisit":{"type":"string"},"chiefComplaint":{"type":"string"},"preferredDate":{"type":"string"}},"required":["reasonForVisit"],"additionalProperties":false},"insurance":{"type":"object","properties":{"provider":{"type":"string"},"memberId":{"type":"string"},"groupNumber":{"type":"string"},"planName":{"type":"string"}},"required":["provider"],"additionalProperties":false},"consent":{"type":"object","properties":{"treatmentAccepted":{"type":"boolean"},"privacyAcknowledged":{"type":"boolean"},"recordedAt":{"type":"string"}},"required":["treatmentAccepted","privacyAcknowledged","recordedAt"],"additionalProperties":false},"clinical":{"type":"object","properties":{"allergies":{"type":"array","items":{"type":"string"}},"medications":{"type":"array","items":{"type":"string"}},"triageLevel":{"type":"string","enum":["routine","urgent","emergent"]}},"required":["allergies","medications","triageLevel"],"additionalProperties":false}},"required":["patient","visit","insurance","consent","clinical"],"additionalProperties":false},{"type":"null"}]},"accountingArCollectionsPayload":{"anyOf":[{"type":"object","properties":{"debtor":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"required":["name","phone"],"additionalProperties":false},"account":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false},"accounts":{"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false}},"collection":{"type":"object","properties":{"reason":{"type":"string"},"paymentIntent":{"type":"string","enum":["ready_to_pay","promise_to_pay","disputes_balance","needs_review"]},"promiseDate":{"type":"string"},"disputeReason":{"type":"string"},"callbackRequested":{"type":"boolean"},"callbackWindow":{"type":"string"},"escalationTarget":{"type":"string"},"notes":{"type":"string"}},"required":["reason","paymentIntent","callbackRequested"],"additionalProperties":false}},"required":["debtor","account","collection"],"additionalProperties":false},{"type":"null"}]},"integrationOutcomes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["record_system","scheduler","notification","webhook","crm","billing","knowledge_source","calendar","ehr","erp"]},"providerId":{"type":"string"},"action":{"type":"string"},"status":{"type":"string","enum":["sent","failed"]},"summary":{"type":"string"},"attemptedAt":{"type":"string"},"retryCount":{"type":"number"},"responseCode":{"type":"number"},"errorMessage":{"type":"string"},"externalId":{"type":"string"},"artifactUrl":{"type":"string"},"payloadPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"correlationId":{"type":"string"},"idempotencyKey":{"type":"string"},"startedAt":{"type":"string"},"completedAt":{"type":"string"},"retryable":{"type":"boolean"}},"required":["id","kind","providerId","action","status","summary","attemptedAt","retryCount","payloadPreview"],"additionalProperties":false}},"duration":{"type":"number"},"tokenUsage":{"type":"object","properties":{"inputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"outputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalTokens":{"type":"integer","minimum":0,"maximum":9007199254740991}},"additionalProperties":false},"realtimeSnapshot":{"anyOf":[{"type":"object","properties":{"personaId":{"type":"string"},"realtimeDeployment":{"type":"string"},"transcriptionModel":{"type":"string"},"transcriptionLanguage":{"type":"string"},"voice":{"type":"string"},"sessionHints":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"reportedAt":{"type":"string"},"clientBuild":{"type":"string"}},"required":["personaId","reportedAt"],"additionalProperties":false},{"type":"null"}]},"latencyMetrics":{"type":"object","properties":{"ttfwP50":{"description":"Time to First Word - 50th percentile (ms)","type":"number"},"ttfwP90":{"description":"Time to First Word - 90th percentile (ms)","type":"number"},"ttfwP99":{"description":"Time to First Word - 99th percentile (ms)","type":"number"},"latencyP50":{"description":"Response latency - 50th percentile (ms)","type":"number"},"latencyP90":{"description":"Response latency - 90th percentile (ms)","type":"number"},"latencyP99":{"description":"Response latency - 99th percentile (ms)","type":"number"},"userInterruptions":{"description":"Number of user interruptions/barge-ins","type":"number"}},"additionalProperties":false},"assertionSummary":{"anyOf":[{"type":"object","properties":{"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"totalAssertions":{"type":"number"},"passedAssertions":{"type":"number"},"failedAssertions":{"type":"number"},"criticalFailures":{"type":"number"},"warningFailures":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{"assertionId":{"type":"string"},"assertionName":{"type":"string"},"passed":{"type":"boolean"},"severity":{"type":"string","enum":["critical","warning","info"]},"actualValue":{},"expectedValue":{},"errorMessage":{"type":"string"},"evaluatedAt":{"type":"string"}},"required":["assertionId","assertionName","passed","severity","evaluatedAt"],"additionalProperties":false}},"evaluatedAt":{"type":"string"}},"required":["sessionId","scenarioId","totalAssertions","passedAssertions","failedAssertions","criticalFailures","warningFailures","results","evaluatedAt"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"expiresAt":{"type":"string"}},"required":["id","scenarioId","scenarioTitle","transcript","timelineEvents","toolsUsed","beatsCompleted","totalBeats","leadScore","leadTier","extractedData","integrationOutcomes","duration","createdAt","expiresAt"],"additionalProperties":false}},"count":{"type":"number"}},"required":["success","sessions","count"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/outbound":{"post":{"tags":["Sessions CP"],"summary":"Create outbound session","description":"Initiates an outbound call session.","operationId":"cpCreateOutboundSession","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phoneNumber":{"type":"string"},"scenarioId":{"type":"string"},"promptOverrides":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}}},"required":["phoneNumber","scenarioId"]}}}},"responses":{"200":{"description":"Outbound session created","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"sessionId":{"type":"string"}},"required":["success","sessionId"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/retry-all-integrations":{"post":{"tags":["Sessions CP"],"summary":"Retry all failed integrations","description":"Retries all failed integration executions across all sessions for the tenant.","operationId":"cpRetryAllIntegrations","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Retries queued","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"queuedCount":{"type":"number"}},"required":["success","queuedCount"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/exceptions":{"get":{"tags":["Sessions CP"],"summary":"List session exceptions","description":"Returns a list of session exceptions.","operationId":"cpListExceptions","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Exceptions list","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"exceptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"errorType":{"type":"string"},"errorMessage":{"type":"string"},"timestamp":{"type":"string"},"status":{"type":"string","enum":["open","resolved","ignored"]},"resolutionNotes":{"type":"string"}},"required":["id","sessionId","errorType","errorMessage","timestamp","status"],"additionalProperties":false}}},"required":["success","exceptions"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/exceptions/{id}":{"get":{"tags":["Sessions CP"],"summary":"Get exception details","description":"Returns details for a specific exception.","operationId":"cpGetException","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Exception details","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"exception":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"errorType":{"type":"string"},"errorMessage":{"type":"string"},"timestamp":{"type":"string"},"status":{"type":"string","enum":["open","resolved","ignored"]},"resolutionNotes":{"type":"string"}},"required":["id","sessionId","errorType","errorMessage","timestamp","status"],"additionalProperties":false}},"required":["success","exception"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/exceptions/{id}/action":{"post":{"tags":["Sessions CP"],"summary":"Take action on exception","description":"Resolve or ignore a session exception.","operationId":"cpActionException","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["resolve","ignore"]},"notes":{"type":"string"}},"required":["action"]}}}},"responses":{"200":{"description":"Action applied","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"exception":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"errorType":{"type":"string"},"errorMessage":{"type":"string"},"timestamp":{"type":"string"},"status":{"type":"string","enum":["open","resolved","ignored"]},"resolutionNotes":{"type":"string"}},"required":["id","sessionId","errorType","errorMessage","timestamp","status"],"additionalProperties":false}},"required":["success","exception"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/{id}":{"get":{"tags":["Sessions CP"],"summary":"Get session details","description":"Returns full details for a specific session.","operationId":"cpGetSession","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Session details","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"session":{"type":"object","properties":{"id":{"type":"string"},"scenarioId":{"type":"string"},"scenarioTitle":{"type":"string"},"companyName":{"type":"string"},"requestedLocale":{"type":"string"},"transcript":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string"},"text":{"type":"string"},"timestamp":{"type":"number"}},"required":["role","text","timestamp"],"additionalProperties":false}},"timelineEvents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"system":{"type":"string"},"timestamp":{"type":"string"}},"required":["id","type","title","description","system","timestamp"],"additionalProperties":false}},"toolsUsed":{"type":"array","items":{"type":"string"}},"beatsCompleted":{"type":"number"},"totalBeats":{"type":"number"},"leadScore":{"type":"number"},"leadTier":{"type":"string"},"tenantId":{"type":"string"},"extractedData":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"interactionSummary":{"anyOf":[{"type":"object","properties":{"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"contact":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"intent":{"type":"string"},"disposition":{"type":"string","enum":["resolved","booked","qualified","follow_up_required","escalated","abandoned"]},"telephony":{"type":"object","properties":{"requested":{"type":"boolean"},"mode":{"type":"string","enum":["live_transfer","callback"]},"status":{"type":"string","enum":["not_required","pending","queued","completed","failed"]},"target":{"type":"string"},"phoneNumber":{"type":"string"},"timeWindow":{"type":"string"},"providerId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"escalation":{"type":"object","properties":{"requested":{"type":"boolean"},"reason":{"type":"string"},"target":{"type":"string"},"status":{"type":"string","enum":["pending","completed","not_required"]}},"required":["requested"],"additionalProperties":false},"booking":{"type":"object","properties":{"requested":{"type":"boolean"},"status":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"scheduledFor":{"type":"string"},"referenceId":{"type":"string"}},"required":["requested"],"additionalProperties":false},"summary":{"type":"string"},"nextAction":{"type":"string"}},"additionalProperties":false},{"type":"null"}]},"workflowPolicy":{"type":"object","properties":{"workflowProfileId":{"type":"string"},"workflowDefinitionId":{"type":"string"},"workflowVersion":{"type":"integer","exclusiveMinimum":0,"maximum":9007199254740991},"routingTag":{"type":"string","enum":["standard","after_hours","existing_account","payment_path","dispute_path"]},"state":{"type":"string","enum":["active","handoff","completed","fallback","retry","escalation"]},"resolutionReason":{"type":"string"},"businessHoursOpen":{"type":"boolean"},"evaluatedAt":{"type":"string"},"experiment":{"type":"object","properties":{"experimentId":{"type":"string"},"variantId":{"type":"string"},"assignmentHash":{"type":"integer","minimum":0,"maximum":9007199254740991},"assignedAt":{"type":"string"}},"required":["experimentId","variantId","assignmentHash","assignedAt"],"additionalProperties":false}},"required":["workflowProfileId","workflowDefinitionId","workflowVersion","routingTag","state","resolutionReason","businessHoursOpen","evaluatedAt"],"additionalProperties":false},"omnichannelThread":{"type":"object","properties":{"threadId":{"type":"string"},"sessionId":{"type":"string"},"tenantId":{"type":"string"},"correlationId":{"type":"string"},"channel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"direction":{"type":"string","enum":["inbound","outbound"]},"participant":{"type":"object","properties":{"displayName":{"type":"string"},"phoneNumber":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"additionalProperties":false},"metadata":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["threadId","sessionId","tenantId","correlationId","channel","createdAt","updatedAt"],"additionalProperties":false},"transferHandoff":{"anyOf":[{"type":"object","properties":{"handoffId":{"type":"string"},"reason":{"type":"string"},"fromPersonaId":{"type":"string"},"toPersonaId":{"type":"string"},"fromChannel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"toChannel":{"type":"string","enum":["voice","phone","web","chat","sms","email"]},"transferMode":{"type":"string","enum":["warm_transfer","cold_transfer","callback","async_followup"]},"summary":{"type":"string"},"keyFacts":{"type":"array","items":{"type":"string"}},"timestamp":{"type":"string"},"transcriptExcerpt":{"type":"string"}},"required":["handoffId","reason","fromPersonaId","fromChannel","transferMode","summary","keyFacts","timestamp"],"additionalProperties":false},{"type":"null"}]},"entitlementCheck":{"type":"object","properties":{"policyId":{"type":"string"},"decision":{"type":"string","enum":["allow","deny","conditional"]},"reasonCode":{"type":"string"},"reason":{"type":"string"},"grantedCapabilities":{"type":"array","items":{"type":"string"}},"deniedCapabilities":{"type":"array","items":{"type":"string"}},"obligations":{"type":"array","items":{"type":"string"}},"evaluatedAt":{"type":"string"}},"required":["policyId","decision","reasonCode","reason","grantedCapabilities","deniedCapabilities","obligations","evaluatedAt"],"additionalProperties":false},"consentRetention":{"type":"object","properties":{"consentStatus":{"type":"string","enum":["granted","denied","unknown"]},"consentSource":{"type":"string"},"transcriptRetention":{"type":"string","enum":["full","metadata_only","none"]},"artifactRetentionDays":{"type":"integer","minimum":0,"maximum":9007199254740991},"artifactExpiresAt":{"type":"string"},"retentionReason":{"type":"string"},"enforcedAt":{"type":"string"},"redacted":{"type":"boolean"}},"required":["consentStatus","consentSource","transcriptRetention","artifactRetentionDays","artifactExpiresAt","retentionReason","enforcedAt","redacted"],"additionalProperties":false},"bookingRequest":{"anyOf":[{"type":"object","properties":{"callerType":{"type":"string","enum":["new","existing","returning","unknown"]},"reason":{"type":"string"},"urgency":{"type":"string","enum":["routine","soon","urgent"]},"preferredWindows":{"type":"array","items":{"type":"string"}},"serviceLine":{"type":"string"},"location":{"type":"string"},"providerRole":{"type":"string"},"durationMinutes":{"type":"number"},"timezone":{"type":"string"},"followUpChannel":{"type":"string","enum":["voice","sms","email","web"]},"healthcare":{"type":"object","properties":{"insuranceProvider":{"type":"string"},"memberId":{"type":"string"},"referralRequired":{"type":"boolean"},"visitType":{"type":"string"},"consentComplete":{"type":"boolean"}},"additionalProperties":false},"accounting":{"type":"object","properties":{"entityType":{"type":"string"},"serviceType":{"type":"string"},"taxTopic":{"type":"string"},"bookkeepingNeeds":{"type":"string"},"documentsComplete":{"type":"boolean"}},"additionalProperties":false}},"required":["preferredWindows"],"additionalProperties":false},{"type":"null"}]},"bookingQualification":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["ready","missing_info","needs_review"]},"missingFields":{"type":"array","items":{"type":"string"}},"missingQualifiers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["reason","preferred_windows","duration_minutes","insurance_provider","member_id","consent_complete","entity_type","service_type","documents_pending","prereq_documents","review_required"]},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"resolutionHint":{"type":"string"}},"required":["code","category","label"],"additionalProperties":false}},"reviewFlags":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["reason","preferred_windows","duration_minutes","insurance_provider","member_id","consent_complete","entity_type","service_type","documents_pending","prereq_documents","review_required"]},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"resolutionHint":{"type":"string"}},"required":["code","category","label"],"additionalProperties":false}},"notes":{"type":"array","items":{"type":"string"}},"requiredItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}},"completedItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}},"blockingItems":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"category":{"type":"string","enum":["shared","healthcare","accounting"]},"label":{"type":"string"},"status":{"type":"string","enum":["required","completed","blocking","review"]},"resolutionHint":{"type":"string"}},"required":["key","category","label","status"],"additionalProperties":false}}},"required":["status","missingFields","missingQualifiers","reviewFlags","notes","requiredItems","completedItems","blockingItems"],"additionalProperties":false},{"type":"null"}]},"availabilitySuggestions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"start":{"type":"string"},"end":{"type":"string"},"rank":{"type":"number"},"score":{"type":"number"},"providerId":{"type":"string"},"source":{"type":"string","enum":["calendar","stub","admin_override"]},"reasonCodes":{"type":"array","items":{"type":"string","enum":["scheduled_slot_preserved","preferred_window_primary","preferred_window_secondary","service_line_alignment","urgency_priority","callback_continuity","default_policy"]}},"reasons":{"type":"array","items":{"type":"string"}},"connectorStatus":{"type":"string","enum":["configured_unverified","healthy","degraded","unavailable","reconnect_required","blocked_by_tenant_config"]},"capacityHint":{"type":"string"}},"required":["id","start","end","rank","score","source","reasonCodes","reasons"],"additionalProperties":false}},"bookingOutcome":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]},"nextReminderDueAt":{"type":"string"},"reminderAttemptCount":{"type":"number"},"lastReminderResult":{"type":"string","enum":["not_sent","queued","sent","failed"]},"backfillCandidateCount":{"type":"number"},"reminderScheduledFor":{"type":"string"},"reminderAttempts":{"type":"number"},"lastTransitionAction":{"type":"string","enum":["confirm","request_reschedule","cancel","mark_no_show","send_reminder","mark_reminder_failed","complete_no_show_recovery"]},"externalEventId":{"type":"string"},"externalProvider":{"type":"string"},"confirmationCode":{"type":"string"},"updatedAt":{"type":"string"},"bookingOrchestration":{"type":"object","properties":{"workflowId":{"type":"string"},"phase":{"type":"string","enum":["reminder_pending","completed","cancelled"]},"updatedAt":{"type":"string"}},"required":["workflowId","phase","updatedAt"],"additionalProperties":false},"approvalStatus":{"type":"string","enum":["not_required","pending","approved","rejected"]},"approvalRequestedAt":{"type":"string"},"approvalResolvedAt":{"type":"string"},"approvalResolvedBy":{"type":"string"},"approvalNotes":{"type":"string"}},"required":["status","updatedAt"],"additionalProperties":false},{"type":"null"}]},"bookingExceptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"reasonCode":{"type":"string","enum":["no_slot","missing_qualifier","connector_unavailable","customer_unresponsive","booking_writeback_failed","reminder_delivery_failed","auth_verification_failed","core_banking_timeout","complaint_system_degraded","ambiguous_multilingual_transcript","ambiguous_urdu_english","digital_handoff_failed"]},"reasonGroup":{"type":"string","enum":["scheduling","qualification","reminder_follow_up","connector","customer_responsiveness"]},"status":{"type":"string","enum":["open","resolved"]},"title":{"type":"string"},"message":{"type":"string"},"sessionId":{"type":"string"},"tenantId":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"assignedTo":{"type":"string"},"assigneeDisplay":{"type":"string"},"resolvedAt":{"type":"string"},"resolutionNote":{"type":"string"},"lastAction":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]},"connectorKind":{"type":"string","enum":["calendar","telephony","ehr","erp","webhook"]},"connectorProviderId":{"type":"string"},"bookingSnapshot":{"type":"object","properties":{"bookingStatus":{"type":"string","enum":["not_requested","pending","scheduled","completed","follow_up_required","reschedule_requested","cancelled","no_show"]},"bookingOutcomeStatus":{"type":"string","enum":["captured","awaiting_qualification","availability_found","slot_selected","pending_approval","confirmed","reschedule_requested","cancelled","no_show_followup","exception"]},"qualificationStatus":{"type":"string","enum":["ready","missing_info","needs_review"]},"selectedSuggestionId":{"type":"string"},"scheduledFor":{"type":"string"},"reminderStatus":{"type":"string","enum":["not_configured","queued","sent","failed"]},"noShowRecoveryStatus":{"type":"string","enum":["not_needed","queued","completed"]},"waitlistStatus":{"type":"string","enum":["not_needed","recommended","queued","backfill_candidate"]}},"additionalProperties":false},"relatedSuggestionIds":{"type":"array","items":{"type":"string"}},"suggestedActions":{"type":"array","items":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]}},"diagnostics":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"remediationSteps":{"type":"array","items":{"type":"object","properties":{"step":{"type":"number"},"label":{"type":"string"},"detail":{"type":"string"},"action":{"type":"string","enum":["retry","retry_all_safe","override_slot","mark_resolved","request_callback","assign_escalate"]}},"required":["step","label","detail"],"additionalProperties":false}}},"required":["id","reasonCode","reasonGroup","status","title","message","sessionId","tenantId","createdAt","updatedAt","suggestedActions"],"additionalProperties":false}},"domainModuleId":{"anyOf":[{"type":"string"},{"type":"null"}]},"domainPayload":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"healthcareIntakePayload":{"anyOf":[{"type":"object","properties":{"patient":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"dateOfBirth":{"type":"string"},"phone":{"type":"string"}},"required":["firstName","lastName","dateOfBirth"],"additionalProperties":false},"visit":{"type":"object","properties":{"reasonForVisit":{"type":"string"},"chiefComplaint":{"type":"string"},"preferredDate":{"type":"string"}},"required":["reasonForVisit"],"additionalProperties":false},"insurance":{"type":"object","properties":{"provider":{"type":"string"},"memberId":{"type":"string"},"groupNumber":{"type":"string"},"planName":{"type":"string"}},"required":["provider"],"additionalProperties":false},"consent":{"type":"object","properties":{"treatmentAccepted":{"type":"boolean"},"privacyAcknowledged":{"type":"boolean"},"recordedAt":{"type":"string"}},"required":["treatmentAccepted","privacyAcknowledged","recordedAt"],"additionalProperties":false},"clinical":{"type":"object","properties":{"allergies":{"type":"array","items":{"type":"string"}},"medications":{"type":"array","items":{"type":"string"}},"triageLevel":{"type":"string","enum":["routine","urgent","emergent"]}},"required":["allergies","medications","triageLevel"],"additionalProperties":false}},"required":["patient","visit","insurance","consent","clinical"],"additionalProperties":false},{"type":"null"}]},"accountingArCollectionsPayload":{"anyOf":[{"type":"object","properties":{"debtor":{"type":"object","properties":{"name":{"type":"string"},"phone":{"type":"string"},"email":{"type":"string"},"organization":{"type":"string"}},"required":["name","phone"],"additionalProperties":false},"account":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false},"accounts":{"type":"array","items":{"type":"object","properties":{"invoiceId":{"type":"string"},"accountNumber":{"type":"string"},"balanceDue":{"type":"number"},"currency":{"type":"string"},"dueDate":{"type":"string"},"daysPastDue":{"type":"number"}},"required":["invoiceId","balanceDue","currency","daysPastDue"],"additionalProperties":false}},"collection":{"type":"object","properties":{"reason":{"type":"string"},"paymentIntent":{"type":"string","enum":["ready_to_pay","promise_to_pay","disputes_balance","needs_review"]},"promiseDate":{"type":"string"},"disputeReason":{"type":"string"},"callbackRequested":{"type":"boolean"},"callbackWindow":{"type":"string"},"escalationTarget":{"type":"string"},"notes":{"type":"string"}},"required":["reason","paymentIntent","callbackRequested"],"additionalProperties":false}},"required":["debtor","account","collection"],"additionalProperties":false},{"type":"null"}]},"integrationOutcomes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["record_system","scheduler","notification","webhook","crm","billing","knowledge_source","calendar","ehr","erp"]},"providerId":{"type":"string"},"action":{"type":"string"},"status":{"type":"string","enum":["sent","failed"]},"summary":{"type":"string"},"attemptedAt":{"type":"string"},"retryCount":{"type":"number"},"responseCode":{"type":"number"},"errorMessage":{"type":"string"},"externalId":{"type":"string"},"artifactUrl":{"type":"string"},"payloadPreview":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"correlationId":{"type":"string"},"idempotencyKey":{"type":"string"},"startedAt":{"type":"string"},"completedAt":{"type":"string"},"retryable":{"type":"boolean"}},"required":["id","kind","providerId","action","status","summary","attemptedAt","retryCount","payloadPreview"],"additionalProperties":false}},"duration":{"type":"number"},"tokenUsage":{"type":"object","properties":{"inputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"outputTokens":{"type":"integer","minimum":0,"maximum":9007199254740991},"totalTokens":{"type":"integer","minimum":0,"maximum":9007199254740991}},"additionalProperties":false},"realtimeSnapshot":{"anyOf":[{"type":"object","properties":{"personaId":{"type":"string"},"realtimeDeployment":{"type":"string"},"transcriptionModel":{"type":"string"},"transcriptionLanguage":{"type":"string"},"voice":{"type":"string"},"sessionHints":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"reportedAt":{"type":"string"},"clientBuild":{"type":"string"}},"required":["personaId","reportedAt"],"additionalProperties":false},{"type":"null"}]},"latencyMetrics":{"type":"object","properties":{"ttfwP50":{"description":"Time to First Word - 50th percentile (ms)","type":"number"},"ttfwP90":{"description":"Time to First Word - 90th percentile (ms)","type":"number"},"ttfwP99":{"description":"Time to First Word - 99th percentile (ms)","type":"number"},"latencyP50":{"description":"Response latency - 50th percentile (ms)","type":"number"},"latencyP90":{"description":"Response latency - 90th percentile (ms)","type":"number"},"latencyP99":{"description":"Response latency - 99th percentile (ms)","type":"number"},"userInterruptions":{"description":"Number of user interruptions/barge-ins","type":"number"}},"additionalProperties":false},"assertionSummary":{"anyOf":[{"type":"object","properties":{"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"totalAssertions":{"type":"number"},"passedAssertions":{"type":"number"},"failedAssertions":{"type":"number"},"criticalFailures":{"type":"number"},"warningFailures":{"type":"number"},"results":{"type":"array","items":{"type":"object","properties":{"assertionId":{"type":"string"},"assertionName":{"type":"string"},"passed":{"type":"boolean"},"severity":{"type":"string","enum":["critical","warning","info"]},"actualValue":{},"expectedValue":{},"errorMessage":{"type":"string"},"evaluatedAt":{"type":"string"}},"required":["assertionId","assertionName","passed","severity","evaluatedAt"],"additionalProperties":false}},"evaluatedAt":{"type":"string"}},"required":["sessionId","scenarioId","totalAssertions","passedAssertions","failedAssertions","criticalFailures","warningFailures","results","evaluatedAt"],"additionalProperties":false},{"type":"null"}]},"createdAt":{"type":"string"},"expiresAt":{"type":"string"}},"required":["id","scenarioId","scenarioTitle","transcript","timelineEvents","toolsUsed","beatsCompleted","totalBeats","leadScore","leadTier","extractedData","integrationOutcomes","duration","createdAt","expiresAt"],"additionalProperties":false}},"required":["success","session"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/{id}/booking-lifecycle":{"patch":{"tags":["Sessions CP"],"summary":"Update booking lifecycle","description":"Updates the booking lifecycle state for a session.","operationId":"cpUpdateBookingLifecycle","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"notes":{"type":"string"}},"required":["status"]}}}},"responses":{"200":{"description":"Booking lifecycle updated","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true}},"required":["success"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/{id}/tool-executions":{"get":{"tags":["Sessions CP"],"summary":"List tool executions for a session","description":"Returns persisted tool execution rows for this session (partition scan + filter) plus any matching in-memory journals.","operationId":"cpListSessionToolExecutions","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tool execution summaries","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"persisted":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"memory":{"type":"array","items":{"type":"object","properties":{"executionId":{"type":"string"},"toolName":{"type":"string"},"sessionId":{"type":"string"},"status":{"type":"string"},"startedAt":{"type":"string"},"source":{"type":"string","const":"memory"}},"required":["executionId","toolName","status","startedAt","source"],"additionalProperties":false}}},"required":["sessionId","persisted","memory"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/{id}/booking-workflow/evidence":{"get":{"tags":["Sessions CP"],"summary":"Booking workflow evidence pack","description":"Returns booking outcome, booking/relevant exceptions, and the durable booking workflow ledger (Temporal internal callbacks).","operationId":"cpGetBookingWorkflowEvidence","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Evidence bundle","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"bookingOutcome":{"anyOf":[{},{"type":"null"}]},"bookingExceptions":{"type":"array","items":{}},"relevantExceptions":{"type":"array","items":{}},"ledger":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"sessionId":{"type":"string"},"eventType":{"type":"string"},"phase":{"type":"string"},"channel":{"type":"string"},"success":{"type":"boolean"},"detail":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"at":{"type":"string"}},"required":["id","sessionId","eventType","success","detail","at"],"additionalProperties":false}}},"required":["sessionId","bookingOutcome","bookingExceptions","relevantExceptions","ledger"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/{id}/booking-workflow/signal":{"post":{"tags":["Sessions CP"],"summary":"Signal Temporal booking workflow","description":"Sends a signal to the durable booking lifecycle workflow for this session (e.g. skipReminder). Requires Temporal enabled and FEATURE_BOOKING_TEMPORAL_ORCHESTRATION.","operationId":"cpSignalBookingWorkflow","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"signal":{"type":"string","enum":["skipReminder"]}},"required":["signal"]}}}},"responses":{"200":{"description":"Signal accepted","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"workflowId":{"type":"string"},"signal":{"type":"string"}},"required":["success","workflowId","signal"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"502":{"description":"Temporal signal failed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/{id}/cost":{"get":{"tags":["Sessions CP"],"summary":"Get session cost","description":"Returns the calculated cost for a session.","operationId":"cpGetSessionCost","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Session cost","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"cost":{"type":"number"},"currency":{"type":"string"}},"required":["success","cost","currency"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/{id}/pdf":{"get":{"tags":["Sessions CP"],"summary":"Get session PDF","description":"Downloads a PDF summary of the session.","operationId":"cpGetSessionPdf","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"PDF file","content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/sessions/{id}/retry-integration":{"post":{"tags":["Sessions CP"],"summary":"Retry integration","description":"Retries a specific failed integration for a session.","operationId":"cpRetryIntegration","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"integrationId":{"type":"string"},"action":{"type":"string"}},"required":["integrationId","action"]}}}},"responses":{"200":{"description":"Integration retried","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"result":{}},"required":["success","result"],"additionalProperties":false}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/tools/executions/{executionId}":{"get":{"tags":["Tools CP"],"summary":"Get persisted tool execution journal","description":"Returns a tool execution record from durable storage (when FEATURE_TOOL_EXECUTION_PERSISTENCE is enabled) or the in-process journal cache.","operationId":"cpGetToolExecution","security":[{"bearerAuth":[]}],"parameters":[{"name":"executionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Execution journal","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"type":"string","enum":["persisted","memory"]},"execution":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["source","execution"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Execution not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/verticals/packs":{"get":{"tags":["Control-plane Verticals"],"summary":"List vertical pack definitions","operationId":"cpListVerticalPacks","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Pack catalog","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"packs":{"type":"array","items":{"type":"object","properties":{"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","insurance","service","platform"]},"displayName":{"type":"string"},"positioning":{"type":"string"},"buyerPersona":{"type":"string"},"workflows":{"type":"array","items":{"type":"object","properties":{"workflowId":{"type":"string"},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal","insurance","service","platform"]},"title":{"type":"string"},"description":{"type":"string"},"primaryOutcome":{"type":"string","enum":["booking","document_collection","payment_followup","intake_completed","handoff_completed","exception_resolved"]},"requiredFields":{"type":"array","items":{"type":"string"}},"allowedToolIds":{"type":"array","items":{"type":"string"}},"blockedToolIds":{"type":"array","items":{"type":"string"}},"riskLevel":{"type":"string","enum":["low","medium","high"]},"handoffPolicy":{"type":"string","enum":["never","on_exception","before_mutation","always"]},"successMetricIds":{"type":"array","items":{"type":"string"}}},"required":["workflowId","verticalPack","title","description","primaryOutcome","requiredFields","allowedToolIds","riskLevel","handoffPolicy","successMetricIds"],"additionalProperties":false}},"defaultLocale":{"type":"string"},"supportedLocales":{"type":"array","items":{"type":"string"}}},"required":["verticalPack","displayName","positioning","buyerPersona","workflows","defaultLocale","supportedLocales"],"additionalProperties":false}}},"required":["success","packs"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/scenarios":{"get":{"tags":["Control-plane Scenarios"],"summary":"List full scenario catalog","description":"Returns the full scenario catalog for admin/control-plane use, including hidden and exception scenarios. Optional filters: `industry`, `visibility`.","operationId":"cpGetScenarios","security":[{"bearerAuth":[]}],"parameters":[{"name":"industry","in":"query","required":false,"schema":{"type":"string","enum":["insurance","sales","healthcare","legal","accounting","banking","dental","veterinary"]},"description":"Optional industry filter. One of: insurance, sales, healthcare, legal, accounting, banking, dental, veterinary."},{"name":"visibility","in":"query","required":false,"schema":{"type":"string","enum":["core","proof","exception","hidden-lab"]},"description":"Optional visibility filter for the full admin catalog."}],"responses":{"200":{"description":"Full scenario catalog","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"industry":{"type":"string","enum":["insurance","sales","healthcare","legal","accounting","banking","dental","veterinary"]},"shortDescription":{"type":"string"},"longDescription":{"type":"string"},"heroImage":{"type":"string"},"agentSetKey":{"type":"string"},"seedData":{"type":"object","properties":{"customer":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"accountId":{"type":"string"}},"additionalProperties":false},"policy":{"type":"object","properties":{"policyNumber":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"coverageAmount":{"type":"string"}},"additionalProperties":false},"patient":{"type":"object","properties":{"name":{"type":"string"},"dob":{"type":"string"},"mrn":{"type":"string"},"insurance":{"type":"string"}},"additionalProperties":false},"lead":{"type":"object","properties":{"company":{"type":"string"},"interest":{"type":"string"},"source":{"type":"string"}},"additionalProperties":false},"matter":{"type":"object","properties":{"caseNumber":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"adverseParties":{"type":"array","items":{"type":"string"}},"priorCounsel":{"type":"string"},"employer":{"type":"string"},"separationDate":{"type":"string"},"residencyState":{"type":"string"},"childrenCount":{"type":"number"},"dvScreenResult":{"type":"string"}},"additionalProperties":false}},"additionalProperties":{},"description":"Seed data that boots the demo workspace."},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Tool name (matches registered tool handler)"},"description":{"type":"string"},"parameters":{"description":"JSON-Schema-lite parameter definition for demo UI cards.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name","description"],"additionalProperties":false,"description":"A single tool exposed by a scenario."}},"uiPanels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","description":"lucide-react icon name"},"type":{"anyOf":[{"type":"string","enum":["crm","ehr","claims","case-management","tasks","scheduling","legal","dispatch","policy","accounting"]},{"type":"string"}],"description":"Panel type. Union of the canonical enum with a string fallback so new verticals can ship panel kinds without a contract bump."},"productLabel":{"type":"string"},"logo":{"type":"string"}},"required":["id","title","icon","type"],"additionalProperties":false,"description":"A single UI panel rendered in the demo workspace."}},"scriptedBeats":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"triggerPhrase":{"type":"string"},"escalationTarget":{"type":"string"},"escalationContext":{"type":"array","items":{"type":"string"}},"escalationWaitMinutes":{"type":"number"}},"required":["id","title","description"],"additionalProperties":false,"description":"A single scripted narrative beat for the demo."}},"agentVoice":{"type":"string"},"companyName":{"type":"string"},"companyLogoUrl":{"type":"string"},"keyFeatures":{"type":"array","items":{"type":"string"}},"toolBeatMap":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"initialAgentNames":{"type":"array","items":{"type":"string"}},"duration":{"type":"string"},"hero":{"type":"boolean"},"defaultTone":{"type":"string","enum":["warm","professional","friendly"]},"hidden":{"type":"boolean"},"allowedPersonaIds":{"type":"array","items":{"type":"string"}},"demoLanguageDefaults":{"type":"object","properties":{"primary":{"type":"string"},"preset":{"type":"string","enum":["unified","bilingual_en_transcript"]}},"additionalProperties":false},"parameterization":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Opaque persona parameterization blob applied at session mint time (PersonaRuntimeOptions). Shape is authoritative on the server; clients forward unchanged."},"sessionTier":{"type":"string","enum":["standard","professional","premium"]},"visibility":{"type":"string","enum":["core","proof","exception","hidden-lab"]},"geography":{"type":"string","enum":["US","international","multi-region"]},"exceptionRationale":{"type":"string"},"verticalPacks":{"type":"array","items":{"type":"string"}},"packPriority":{"type":"number"},"packCallout":{"type":"string"}},"required":["id","slug","title","industry","shortDescription","longDescription","agentSetKey","seedData","tools","uiPanels","scriptedBeats","companyName"],"additionalProperties":false,"description":"Full scenario configuration consumed by the demo workspace."}},"count":{"type":"number"}},"required":["items","count"],"additionalProperties":false,"description":"List of scenarios with total count."}}}},"400":{"description":"Invalid visibility filter","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/scenarios/{slug}":{"get":{"tags":["Control-plane Scenarios"],"summary":"Get a single scenario by slug (admin)","description":"Returns the full `ScenarioConfig` for the given slug, including hidden and exception scenarios.","operationId":"cpGetScenarioBySlug","security":[{"bearerAuth":[]}],"parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"},"description":"Scenario slug identifier."}],"responses":{"200":{"description":"Scenario configuration","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"industry":{"type":"string","enum":["insurance","sales","healthcare","legal","accounting","banking","dental","veterinary"]},"shortDescription":{"type":"string"},"longDescription":{"type":"string"},"heroImage":{"type":"string"},"agentSetKey":{"type":"string"},"seedData":{"type":"object","properties":{"customer":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"accountId":{"type":"string"}},"additionalProperties":false},"policy":{"type":"object","properties":{"policyNumber":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"coverageAmount":{"type":"string"}},"additionalProperties":false},"patient":{"type":"object","properties":{"name":{"type":"string"},"dob":{"type":"string"},"mrn":{"type":"string"},"insurance":{"type":"string"}},"additionalProperties":false},"lead":{"type":"object","properties":{"company":{"type":"string"},"interest":{"type":"string"},"source":{"type":"string"}},"additionalProperties":false},"matter":{"type":"object","properties":{"caseNumber":{"type":"string"},"type":{"type":"string"},"status":{"type":"string"},"adverseParties":{"type":"array","items":{"type":"string"}},"priorCounsel":{"type":"string"},"employer":{"type":"string"},"separationDate":{"type":"string"},"residencyState":{"type":"string"},"childrenCount":{"type":"number"},"dvScreenResult":{"type":"string"}},"additionalProperties":false}},"additionalProperties":{},"description":"Seed data that boots the demo workspace."},"tools":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","description":"Tool name (matches registered tool handler)"},"description":{"type":"string"},"parameters":{"description":"JSON-Schema-lite parameter definition for demo UI cards.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["name","description"],"additionalProperties":false,"description":"A single tool exposed by a scenario."}},"uiPanels":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"icon":{"type":"string","description":"lucide-react icon name"},"type":{"anyOf":[{"type":"string","enum":["crm","ehr","claims","case-management","tasks","scheduling","legal","dispatch","policy","accounting"]},{"type":"string"}],"description":"Panel type. Union of the canonical enum with a string fallback so new verticals can ship panel kinds without a contract bump."},"productLabel":{"type":"string"},"logo":{"type":"string"}},"required":["id","title","icon","type"],"additionalProperties":false,"description":"A single UI panel rendered in the demo workspace."}},"scriptedBeats":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"triggerPhrase":{"type":"string"},"escalationTarget":{"type":"string"},"escalationContext":{"type":"array","items":{"type":"string"}},"escalationWaitMinutes":{"type":"number"}},"required":["id","title","description"],"additionalProperties":false,"description":"A single scripted narrative beat for the demo."}},"agentVoice":{"type":"string"},"companyName":{"type":"string"},"companyLogoUrl":{"type":"string"},"keyFeatures":{"type":"array","items":{"type":"string"}},"toolBeatMap":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"string"}},"initialAgentNames":{"type":"array","items":{"type":"string"}},"duration":{"type":"string"},"hero":{"type":"boolean"},"defaultTone":{"type":"string","enum":["warm","professional","friendly"]},"hidden":{"type":"boolean"},"allowedPersonaIds":{"type":"array","items":{"type":"string"}},"demoLanguageDefaults":{"type":"object","properties":{"primary":{"type":"string"},"preset":{"type":"string","enum":["unified","bilingual_en_transcript"]}},"additionalProperties":false},"parameterization":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{},"description":"Opaque persona parameterization blob applied at session mint time (PersonaRuntimeOptions). Shape is authoritative on the server; clients forward unchanged."},"sessionTier":{"type":"string","enum":["standard","professional","premium"]},"visibility":{"type":"string","enum":["core","proof","exception","hidden-lab"]},"geography":{"type":"string","enum":["US","international","multi-region"]},"exceptionRationale":{"type":"string"},"verticalPacks":{"type":"array","items":{"type":"string"}},"packPriority":{"type":"number"},"packCallout":{"type":"string"}},"required":["id","slug","title","industry","shortDescription","longDescription","agentSetKey","seedData","tools","uiPanels","scriptedBeats","companyName"],"additionalProperties":false,"description":"Full scenario configuration consumed by the demo workspace."}}}},"400":{"description":"Missing slug","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Scenario not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cp/evidence-packs":{"get":{"tags":["Control-plane Evidence"],"summary":"List evidence index rows for tenant","operationId":"cpListEvidencePacks","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Evidence packs","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenantId":{"type":"string"},"evidencePacks":{"type":"array","items":{"type":"object","properties":{"evidenceIndexId":{"type":"string"},"tenantId":{"type":"string"},"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"outcome":{"type":"string","enum":["booking_requested","booking_confirmed","human_handoff","exception_open","completed","unknown"]},"status":{"type":"string","enum":["draft","complete","flagged"]},"summaryLine":{"type":"string"},"ingestionSummary":{"type":"object","properties":{"ingestionStatus":{"type":"string","enum":["not_started","processing","complete","partial","failed"]},"healthStatus":{"type":"string","enum":["healthy","degraded","unhealthy","unknown"]},"sourceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"indexedChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"retryableChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"citationCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"citationsBySource":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["source","count"],"additionalProperties":false}},"summary":{"type":"string"},"updatedAt":{"type":"string"}},"required":["ingestionStatus","healthStatus","sourceCount","indexedChunkCount","failedChunkCount","retryableChunkCount","citationCount","citationsBySource","summary","updatedAt"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["evidenceIndexId","tenantId","sessionId","scenarioId","outcome","status","summaryLine","createdAt","updatedAt"],"additionalProperties":false}}},"required":["success","tenantId","evidencePacks"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/evidence-packs/{id}":{"get":{"tags":["Control-plane Evidence"],"summary":"Get evidence index row by session id","operationId":"cpGetEvidencePack","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Evidence pack","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"evidencePack":{"type":"object","properties":{"evidenceIndexId":{"type":"string"},"tenantId":{"type":"string"},"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"outcome":{"type":"string","enum":["booking_requested","booking_confirmed","human_handoff","exception_open","completed","unknown"]},"status":{"type":"string","enum":["draft","complete","flagged"]},"summaryLine":{"type":"string"},"ingestionSummary":{"type":"object","properties":{"ingestionStatus":{"type":"string","enum":["not_started","processing","complete","partial","failed"]},"healthStatus":{"type":"string","enum":["healthy","degraded","unhealthy","unknown"]},"sourceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"indexedChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"retryableChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"citationCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"citationsBySource":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["source","count"],"additionalProperties":false}},"summary":{"type":"string"},"updatedAt":{"type":"string"}},"required":["ingestionStatus","healthStatus","sourceCount","indexedChunkCount","failedChunkCount","retryableChunkCount","citationCount","citationsBySource","summary","updatedAt"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["evidenceIndexId","tenantId","sessionId","scenarioId","outcome","status","summaryLine","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","evidencePack"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/evidence-packs/{id}/reindex":{"post":{"tags":["Control-plane Evidence"],"summary":"Recompute ingestion/citation evidence for a session","operationId":"cpPostEvidencePackReindex","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Evidence pack","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"evidencePack":{"type":"object","properties":{"evidenceIndexId":{"type":"string"},"tenantId":{"type":"string"},"sessionId":{"type":"string"},"scenarioId":{"type":"string"},"outcome":{"type":"string","enum":["booking_requested","booking_confirmed","human_handoff","exception_open","completed","unknown"]},"status":{"type":"string","enum":["draft","complete","flagged"]},"summaryLine":{"type":"string"},"ingestionSummary":{"type":"object","properties":{"ingestionStatus":{"type":"string","enum":["not_started","processing","complete","partial","failed"]},"healthStatus":{"type":"string","enum":["healthy","degraded","unhealthy","unknown"]},"sourceCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"indexedChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"failedChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"retryableChunkCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"citationCount":{"type":"integer","minimum":0,"maximum":9007199254740991},"citationsBySource":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string"},"count":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["source","count"],"additionalProperties":false}},"summary":{"type":"string"},"updatedAt":{"type":"string"}},"required":["ingestionStatus","healthStatus","sourceCount","indexedChunkCount","failedChunkCount","retryableChunkCount","citationCount","citationsBySource","summary","updatedAt"],"additionalProperties":false},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["evidenceIndexId","tenantId","sessionId","scenarioId","outcome","status","summaryLine","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","evidencePack"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/quality":{"get":{"tags":["Control-plane Quality"],"summary":"List quality scorecards for tenant","operationId":"cpListQualityScorecards","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Scorecards","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenantId":{"type":"string"},"scorecards":{"type":"array","items":{"type":"object","properties":{"qualityScoreId":{"type":"string"},"tenantId":{"type":"string"},"sessionId":{"type":"string"},"totalScore":{"type":"number"},"dimensions":{"type":"object","properties":{"goalCompletion":{"type":"number"},"intakeCompleteness":{"type":"number"},"toolCorrectness":{"type":"number"},"handoffCorrectness":{"type":"number"},"safetyCompliance":{"type":"number"},"callerExperience":{"type":"number"}},"required":["goalCompletion","intakeCompleteness","toolCorrectness","handoffCorrectness","safetyCompliance","callerExperience"],"additionalProperties":false},"qualitySummary":{"type":"object","properties":{"overallBand":{"type":"string","enum":["excellent","good","fair","needs_improvement"]},"pass":{"type":"boolean"},"scoreDeltaFromTarget":{"type":"number"},"strongestDimension":{"type":"string"},"weakestDimension":{"type":"string"},"targetScore":{"type":"number"},"evaluatedAt":{"type":"string"}},"required":["overallBand","pass","scoreDeltaFromTarget","strongestDimension","weakestDimension","targetScore","evaluatedAt"],"additionalProperties":false},"evaluatorVersion":{"type":"string"},"createdAt":{"type":"string"}},"required":["qualityScoreId","tenantId","sessionId","totalScore","dimensions","evaluatorVersion","createdAt"],"additionalProperties":false}}},"required":["success","tenantId","scorecards"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/quality/funnel":{"get":{"tags":["Control-plane Quality"],"summary":"Get quality and transfer funnel summary for tenant","operationId":"cpGetQualityFunnel","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Quality funnel summary","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"summary":{"type":"object","properties":{"tenantId":{"type":"string"},"generatedAt":{"type":"string"},"totalSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"scoredSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"passedSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"passRate":{"type":"number"},"transferRequestedSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"transferCompletedSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"transferCompletionRate":{"type":"number"},"fallbackSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"retrySessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"bandBreakdown":{"type":"object","properties":{"excellent":{"type":"integer","minimum":0,"maximum":9007199254740991},"good":{"type":"integer","minimum":0,"maximum":9007199254740991},"fair":{"type":"integer","minimum":0,"maximum":9007199254740991},"needsImprovement":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["excellent","good","fair","needsImprovement"],"additionalProperties":false},"knowledgeGap":{"type":"object","properties":{"evidenceIndexedSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"citationBackedSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"citationCoverageRate":{"type":"number"},"degradedIngestionSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"zeroCitationSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"retryableIngestionSessions":{"type":"integer","minimum":0,"maximum":9007199254740991},"topGapScenarios":{"type":"array","items":{"type":"object","properties":{"scenarioId":{"type":"string"},"sessions":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["scenarioId","sessions"],"additionalProperties":false}}},"required":["evidenceIndexedSessions","citationBackedSessions","citationCoverageRate","degradedIngestionSessions","zeroCitationSessions","retryableIngestionSessions","topGapScenarios"],"additionalProperties":false},"competitiveTargets":{"type":"object","properties":{"overallTargetScore":{"type":"number"},"currentAverageScore":{"type":"number"},"deltaToOverallTarget":{"type":"number"},"metrics":{"type":"array","items":{"type":"object","properties":{"metricId":{"type":"string","enum":["average_quality_score","pass_rate","transfer_completion_rate","citation_coverage_rate"]},"label":{"type":"string"},"currentValue":{"type":"number"},"targetValue":{"type":"number"},"deltaToTarget":{"type":"number"},"status":{"type":"string","enum":["on_track","at_risk","off_track"]}},"required":["metricId","label","currentValue","targetValue","deltaToTarget","status"],"additionalProperties":false}}},"required":["overallTargetScore","currentAverageScore","deltaToOverallTarget","metrics"],"additionalProperties":false},"differentiatorPackaging":{"type":"object","properties":{"generatedAt":{"type":"string"},"differentiators":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["transport_continuity","trusted_grounding","orchestration_resilience","handoff_execution"]},"label":{"type":"string"},"currentValue":{"type":"number"},"targetValue":{"type":"number"},"deltaToTarget":{"type":"number"},"status":{"type":"string","enum":["on_track","at_risk","off_track"]},"proof":{"type":"string"}},"required":["id","label","currentValue","targetValue","deltaToTarget","status","proof"],"additionalProperties":false}}},"required":["generatedAt","differentiators"],"additionalProperties":false}},"required":["tenantId","generatedAt","totalSessions","scoredSessions","passedSessions","passRate","transferRequestedSessions","transferCompletedSessions","transferCompletionRate","fallbackSessions","retrySessions","bandBreakdown","knowledgeGap","competitiveTargets","differentiatorPackaging"],"additionalProperties":false}},"required":["success","summary"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/quality/session/{sessionId}":{"get":{"tags":["Control-plane Quality"],"summary":"Get or compute quality scorecard for a session","operationId":"cpGetQualityScorecard","security":[{"bearerAuth":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Scorecard","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"scorecard":{"type":"object","properties":{"qualityScoreId":{"type":"string"},"tenantId":{"type":"string"},"sessionId":{"type":"string"},"totalScore":{"type":"number"},"dimensions":{"type":"object","properties":{"goalCompletion":{"type":"number"},"intakeCompleteness":{"type":"number"},"toolCorrectness":{"type":"number"},"handoffCorrectness":{"type":"number"},"safetyCompliance":{"type":"number"},"callerExperience":{"type":"number"}},"required":["goalCompletion","intakeCompleteness","toolCorrectness","handoffCorrectness","safetyCompliance","callerExperience"],"additionalProperties":false},"qualitySummary":{"type":"object","properties":{"overallBand":{"type":"string","enum":["excellent","good","fair","needs_improvement"]},"pass":{"type":"boolean"},"scoreDeltaFromTarget":{"type":"number"},"strongestDimension":{"type":"string"},"weakestDimension":{"type":"string"},"targetScore":{"type":"number"},"evaluatedAt":{"type":"string"}},"required":["overallBand","pass","scoreDeltaFromTarget","strongestDimension","weakestDimension","targetScore","evaluatedAt"],"additionalProperties":false},"evaluatorVersion":{"type":"string"},"createdAt":{"type":"string"}},"required":["qualityScoreId","tenantId","sessionId","totalScore","dimensions","evaluatorVersion","createdAt"],"additionalProperties":false}},"required":["success","scorecard"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/quality/session/{sessionId}/recompute":{"post":{"tags":["Control-plane Quality"],"summary":"Recompute quality scorecard for a session","operationId":"cpPostQualityRecompute","security":[{"bearerAuth":[]}],"parameters":[{"name":"sessionId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Scorecard","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"scorecard":{"type":"object","properties":{"qualityScoreId":{"type":"string"},"tenantId":{"type":"string"},"sessionId":{"type":"string"},"totalScore":{"type":"number"},"dimensions":{"type":"object","properties":{"goalCompletion":{"type":"number"},"intakeCompleteness":{"type":"number"},"toolCorrectness":{"type":"number"},"handoffCorrectness":{"type":"number"},"safetyCompliance":{"type":"number"},"callerExperience":{"type":"number"}},"required":["goalCompletion","intakeCompleteness","toolCorrectness","handoffCorrectness","safetyCompliance","callerExperience"],"additionalProperties":false},"qualitySummary":{"type":"object","properties":{"overallBand":{"type":"string","enum":["excellent","good","fair","needs_improvement"]},"pass":{"type":"boolean"},"scoreDeltaFromTarget":{"type":"number"},"strongestDimension":{"type":"string"},"weakestDimension":{"type":"string"},"targetScore":{"type":"number"},"evaluatedAt":{"type":"string"}},"required":["overallBand","pass","scoreDeltaFromTarget","strongestDimension","weakestDimension","targetScore","evaluatedAt"],"additionalProperties":false},"evaluatorVersion":{"type":"string"},"createdAt":{"type":"string"}},"required":["qualityScoreId","tenantId","sessionId","totalScore","dimensions","evaluatorVersion","createdAt"],"additionalProperties":false}},"required":["success","scorecard"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/attestations/{token}":{"post":{"tags":["Attestations"],"summary":"Submit weekly pilot outcome attestation","operationId":"postAttestationByToken","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"tenantId":{"type":"string"},"pilotId":{"type":"string"},"weekId":{"type":"string"},"attestedByEmail":{"type":"string"},"attestedByName":{"type":"string"},"acceptedMetrics":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"number"}},"freeFormNote":{"type":"string"}},"required":["pilotId","weekId","attestedByEmail"]}}}},"responses":{"201":{"description":"Attestation stored","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"attestation":{"type":"object","properties":{"attestationId":{"type":"string"},"token":{"type":"string"},"tenantId":{"type":"string"},"pilotId":{"type":"string"},"weekId":{"type":"string"},"attestedByEmail":{"type":"string"},"attestedByName":{"type":"string"},"acceptedMetrics":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"freeFormNote":{"type":"string"},"attestedAt":{"type":"string"}},"required":["attestationId","token","tenantId","pilotId","weekId","attestedByEmail","acceptedMetrics","attestedAt"],"additionalProperties":false}},"required":["success","attestation"],"additionalProperties":false}}}},"400":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"409":{"description":"Already attested","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/sessions/{id}/channel-events":{"get":{"tags":["Sessions"],"summary":"List channel events for a session","description":"Returns the ordered, append-only channel-event log for a session. Events are emitted by Twilio webhook callbacks (inbound, outbound, status transitions). Access is identical to GET /api/sessions/:id/state — session_access cookie, x-session-access header, or Clerk admin token.","operationId":"getSessionChannelEvents","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"},"description":"Session ID"}],"responses":{"200":{"description":"Channel events for the session","content":{"application/json":{"schema":{"type":"object","properties":{"sessionId":{"type":"string"},"events":{"type":"array","items":{"type":"object","properties":{"timestamp":{"type":"string","format":"date-time","pattern":"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$","description":"ISO-8601 UTC timestamp of the event."},"type":{"type":"string","enum":["inbound_received","outbound_initiated","call_status","call_completed","provider_error"],"description":"Normalized event type."},"status":{"type":"string","description":"Canonical status string (e.g. 'ringing', 'completed')."},"rawStatus":{"description":"Raw provider status string before normalization.","type":"string"},"callSid":{"description":"Twilio CallSid or equivalent provider reference.","type":"string"},"providerId":{"type":"string","description":"Provider identifier (e.g. 'twilio_voice')."},"label":{"type":"string","description":"Human-readable label for UI display."},"meta":{"description":"Optional freeform metadata for debugging.","type":"object","propertyNames":{"type":"string"},"additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}]}}},"required":["timestamp","type","status","providerId","label"],"additionalProperties":false}},"count":{"type":"integer","minimum":-9007199254740991,"maximum":9007199254740991}},"required":["sessionId","events","count"],"additionalProperties":false}}}},"401":{"description":"Unauthorized — access key mismatch","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Session not found or expired","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"429":{"description":"Too many requests","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Rate limit exceeded message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/cp/channels":{"get":{"tags":["Control-plane Channels"],"summary":"List configured voice channels (facade)","operationId":"cpListChannels","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Channels","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"channels":{"type":"array","items":{"type":"object","properties":{"channelConnectionId":{"type":"string"},"provider":{"type":"string"},"displayName":{"type":"string"},"status":{"type":"string"}},"required":["channelConnectionId","provider","displayName","status"],"additionalProperties":false}}},"required":["success","channels"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/tool-policy":{"get":{"tags":["Control-plane Tool policy"],"summary":"List tool policy rules","operationId":"cpListToolPolicy","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Policy rules","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"rules":{"type":"array","items":{"type":"object","properties":{"toolId":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"access":{"type":"string","enum":["global","tenant_optin","blocked"]},"hipaaImpact":{"type":"boolean"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"}},"required":["toolId","category","description","access","hipaaImpact","updatedAt"],"additionalProperties":false}}},"required":["success","rules"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/tool-policy/{toolId}":{"patch":{"tags":["Control-plane Tool policy"],"summary":"Update a tool policy rule","operationId":"cpUpdateToolPolicy","security":[{"bearerAuth":[]}],"parameters":[{"name":"toolId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated rule","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"rule":{"type":"object","properties":{"toolId":{"type":"string"},"category":{"type":"string"},"description":{"type":"string"},"access":{"type":"string","enum":["global","tenant_optin","blocked"]},"hipaaImpact":{"type":"boolean"},"updatedAt":{"type":"string"},"updatedBy":{"type":"string"}},"required":["toolId","category","description","access","hipaaImpact","updatedAt"],"additionalProperties":false}},"required":["success","rule"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/tool-policy/tenants/{tenantId}/overrides":{"get":{"tags":["Control-plane Tool policy"],"summary":"List tenant tool overrides","operationId":"cpListTenantToolOverrides","security":[{"bearerAuth":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Overrides","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"overrides":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"required":["success","overrides"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/tool-policy/tenants/{tenantId}/overrides/{toolId}":{"patch":{"tags":["Control-plane Tool policy"],"summary":"Set tenant override for a tool","operationId":"cpSetTenantToolOverride","security":[{"bearerAuth":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}},{"name":"toolId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Override set","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"override":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["success","override"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/tenants":{"get":{"tags":["Control-plane Tenants"],"summary":"List all tenant directory entries","operationId":"cpListTenants","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Tenant list","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenants":{"type":"array","items":{"type":"object","properties":{"tenantId":{"type":"string"},"displayName":{"type":"string"},"firstSeenAt":{"type":"string"},"lastActivityAt":{"type":"string"},"status":{"type":"string","enum":["active","paused","archived"]},"plan":{"type":"string","enum":["starter","growth","enterprise"]},"mrr":{"type":"number"},"callsThisMonth":{"type":"number"},"minutesThisMonth":{"type":"number"},"location":{"type":"string"},"industry":{"type":"string"}},"required":["tenantId","firstSeenAt","lastActivityAt","status"],"additionalProperties":false}}},"required":["success","tenants"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/tenants/{tenantId}":{"get":{"tags":["Control-plane Tenants"],"summary":"Get a tenant directory entry","operationId":"cpGetTenant","security":[{"bearerAuth":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tenant entry","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenant":{"type":"object","properties":{"tenantId":{"type":"string"},"displayName":{"type":"string"},"firstSeenAt":{"type":"string"},"lastActivityAt":{"type":"string"},"status":{"type":"string","enum":["active","paused","archived"]},"plan":{"type":"string","enum":["starter","growth","enterprise"]},"mrr":{"type":"number"},"callsThisMonth":{"type":"number"},"minutesThisMonth":{"type":"number"},"location":{"type":"string"},"industry":{"type":"string"}},"required":["tenantId","firstSeenAt","lastActivityAt","status"],"additionalProperties":false}},"required":["success","tenant"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"patch":{"tags":["Control-plane Tenants"],"summary":"Update tenant entry","operationId":"cpUpdateTenant","security":[{"bearerAuth":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated tenant","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenant":{"type":"object","properties":{"tenantId":{"type":"string"},"displayName":{"type":"string"},"firstSeenAt":{"type":"string"},"lastActivityAt":{"type":"string"},"status":{"type":"string","enum":["active","paused","archived"]},"plan":{"type":"string","enum":["starter","growth","enterprise"]},"mrr":{"type":"number"},"callsThisMonth":{"type":"number"},"minutesThisMonth":{"type":"number"},"location":{"type":"string"},"industry":{"type":"string"}},"required":["tenantId","firstSeenAt","lastActivityAt","status"],"additionalProperties":false}},"required":["success","tenant"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/feature-flags":{"get":{"tags":["Control-plane Feature Flags"],"summary":"List all feature flags","operationId":"cpListFeatureFlags","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Feature flags","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"flags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"scope":{"type":"string","enum":["global","per_tenant"]},"enabled":{"type":"boolean"},"rolloutPct":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","scope","enabled","createdAt","updatedAt"],"additionalProperties":false}}},"required":["success","flags"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/feature-flags/{name}":{"patch":{"tags":["Control-plane Feature Flags"],"summary":"Update a feature flag","operationId":"cpUpdateFeatureFlag","security":[{"bearerAuth":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated flag","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"flag":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"scope":{"type":"string","enum":["global","per_tenant"]},"enabled":{"type":"boolean"},"rolloutPct":{"type":"number"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","description","scope","enabled","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","flag"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/feature-flags/{name}/overrides":{"get":{"tags":["Control-plane Feature Flags"],"summary":"List per-tenant overrides for a flag","operationId":"cpListFlagOverrides","security":[{"bearerAuth":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Overrides","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"overrides":{"type":"array","items":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}}},"required":["success","overrides"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/feature-flags/{name}/overrides/{tenantId}":{"patch":{"tags":["Control-plane Feature Flags"],"summary":"Set tenant override for a flag","operationId":"cpSetFlagTenantOverride","security":[{"bearerAuth":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Override set","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"override":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}}},"required":["success","override"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/support":{"get":{"tags":["Control-plane Support"],"summary":"List support tickets","operationId":"cpListSupportTickets","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Support tickets","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tickets":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"subject":{"type":"string"},"description":{"type":"string"},"priority":{"type":"string","enum":["critical","high","normal","low"]},"status":{"type":"string","enum":["open","in_progress","resolved","waiting_on_tenant"]},"submittedBy":{"type":"string"},"assignee":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"resolvedAt":{"type":"string"}},"required":["id","tenantId","subject","description","priority","status","submittedBy","createdAt","updatedAt"],"additionalProperties":false}}},"required":["success","tickets"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"post":{"tags":["Control-plane Support"],"summary":"Create a support ticket","operationId":"cpCreateSupportTicket","security":[{"bearerAuth":[]}],"responses":{"201":{"description":"Created ticket","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"ticket":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"subject":{"type":"string"},"description":{"type":"string"},"priority":{"type":"string","enum":["critical","high","normal","low"]},"status":{"type":"string","enum":["open","in_progress","resolved","waiting_on_tenant"]},"submittedBy":{"type":"string"},"assignee":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"resolvedAt":{"type":"string"}},"required":["id","tenantId","subject","description","priority","status","submittedBy","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","ticket"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/support/{id}":{"get":{"tags":["Control-plane Support"],"summary":"Get a support ticket","operationId":"cpGetSupportTicket","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Ticket","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"ticket":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"subject":{"type":"string"},"description":{"type":"string"},"priority":{"type":"string","enum":["critical","high","normal","low"]},"status":{"type":"string","enum":["open","in_progress","resolved","waiting_on_tenant"]},"submittedBy":{"type":"string"},"assignee":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"resolvedAt":{"type":"string"}},"required":["id","tenantId","subject","description","priority","status","submittedBy","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","ticket"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"patch":{"tags":["Control-plane Support"],"summary":"Update a support ticket","operationId":"cpUpdateSupportTicket","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated ticket","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"ticket":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"subject":{"type":"string"},"description":{"type":"string"},"priority":{"type":"string","enum":["critical","high","normal","low"]},"status":{"type":"string","enum":["open","in_progress","resolved","waiting_on_tenant"]},"submittedBy":{"type":"string"},"assignee":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"resolvedAt":{"type":"string"}},"required":["id","tenantId","subject","description","priority","status","submittedBy","createdAt","updatedAt"],"additionalProperties":false}},"required":["success","ticket"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/audit":{"get":{"tags":["Control-plane Audit Log"],"summary":"List audit log events","operationId":"cpListAuditEvents","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Audit events","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"action":{"type":"string"},"actorId":{"type":"string"},"actorEmail":{"type":"string"},"tenantId":{"type":"string"},"targetId":{"type":"string"},"targetType":{"type":"string"},"changes":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"createdAt":{"type":"string"},"ip":{"type":"string"}},"required":["id","action","actorId","createdAt"],"additionalProperties":false}}},"required":["success","events"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/billing-ops":{"get":{"tags":["Control-plane Billing Ops"],"summary":"Cross-tenant billing summary","operationId":"cpListBillingOps","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Billing summary and records","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"summary":{"type":"object","properties":{"totalMrr":{"type":"number"},"totalCallsThisMonth":{"type":"number"},"totalMinutesThisMonth":{"type":"number"},"tenantCount":{"type":"number"}},"required":["totalMrr","totalCallsThisMonth","totalMinutesThisMonth","tenantCount"],"additionalProperties":false},"records":{"type":"array","items":{"type":"object","properties":{"tenantId":{"type":"string"},"displayName":{"type":"string"},"plan":{"type":"string","enum":["starter","growth","enterprise"]},"mrr":{"type":"number"},"callsThisMonth":{"type":"number"},"minutesThisMonth":{"type":"number"},"minutesLimit":{"type":"number"},"invoiceStatus":{"type":"string","enum":["current","overdue","payment_failed"]},"trialEndsAt":{"type":"string"},"nextBillingAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["tenantId","plan","mrr","callsThisMonth","minutesThisMonth","minutesLimit","invoiceStatus","nextBillingAt","updatedAt"],"additionalProperties":false}}},"required":["success","summary","records"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/billing-ops/{tenantId}":{"get":{"tags":["Control-plane Billing Ops"],"summary":"Get billing record for a tenant","operationId":"cpGetBillingRecord","security":[{"bearerAuth":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Billing record","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"record":{"type":"object","properties":{"tenantId":{"type":"string"},"displayName":{"type":"string"},"plan":{"type":"string","enum":["starter","growth","enterprise"]},"mrr":{"type":"number"},"callsThisMonth":{"type":"number"},"minutesThisMonth":{"type":"number"},"minutesLimit":{"type":"number"},"invoiceStatus":{"type":"string","enum":["current","overdue","payment_failed"]},"trialEndsAt":{"type":"string"},"nextBillingAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["tenantId","plan","mrr","callsThisMonth","minutesThisMonth","minutesLimit","invoiceStatus","nextBillingAt","updatedAt"],"additionalProperties":false}},"required":["success","record"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}},"patch":{"tags":["Control-plane Billing Ops"],"summary":"Update billing record for a tenant","operationId":"cpUpdateBillingRecord","security":[{"bearerAuth":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated billing record","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"record":{"type":"object","properties":{"tenantId":{"type":"string"},"displayName":{"type":"string"},"plan":{"type":"string","enum":["starter","growth","enterprise"]},"mrr":{"type":"number"},"callsThisMonth":{"type":"number"},"minutesThisMonth":{"type":"number"},"minutesLimit":{"type":"number"},"invoiceStatus":{"type":"string","enum":["current","overdue","payment_failed"]},"trialEndsAt":{"type":"string"},"nextBillingAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["tenantId","plan","mrr","callsThisMonth","minutesThisMonth","minutesLimit","invoiceStatus","nextBillingAt","updatedAt"],"additionalProperties":false}},"required":["success","record"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/compliance":{"get":{"tags":["Control-plane Compliance"],"summary":"List all compliance items (super-admin view)","operationId":"cpListCompliance","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Compliance items","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"framework":{"type":"string","enum":["HIPAA","SOC2","GDPR","CCPA"]},"control":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["attested","pending","overdue","not_applicable"]},"attestedBy":{"type":"string"},"attestedAt":{"type":"string"},"dueAt":{"type":"string"},"notes":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","tenantId","framework","control","description","status","updatedAt"],"additionalProperties":false}}},"required":["success","items"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/compliance/{tenantId}":{"get":{"tags":["Control-plane Compliance"],"summary":"Get compliance record for a tenant","operationId":"cpGetTenantCompliance","security":[{"bearerAuth":[]}],"parameters":[{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Tenant compliance items","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"tenantId":{"type":"string"},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"framework":{"type":"string","enum":["HIPAA","SOC2","GDPR","CCPA"]},"control":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["attested","pending","overdue","not_applicable"]},"attestedBy":{"type":"string"},"attestedAt":{"type":"string"},"dueAt":{"type":"string"},"notes":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","tenantId","framework","control","description","status","updatedAt"],"additionalProperties":false}}},"required":["success","tenantId","items"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/cp/compliance/item/{id}":{"patch":{"tags":["Control-plane Compliance"],"summary":"Update a compliance item","operationId":"cpUpdateComplianceItem","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Updated compliance item","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"item":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"framework":{"type":"string","enum":["HIPAA","SOC2","GDPR","CCPA"]},"control":{"type":"string"},"description":{"type":"string"},"status":{"type":"string","enum":["attested","pending","overdue","not_applicable"]},"attestedBy":{"type":"string"},"attestedAt":{"type":"string"},"dueAt":{"type":"string"},"notes":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","tenantId","framework","control","description","status","updatedAt"],"additionalProperties":false}},"required":["success","item"],"additionalProperties":false}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/verticals/accounting/workflows":{"get":{"tags":["Verticals"],"summary":"List accounting workflow definitions","operationId":"getAccountingWorkflows","responses":{"200":{"description":"Accounting workflows from vertical catalog","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal"]},"workflows":{"type":"array","items":{"type":"object","properties":{"workflowId":{"type":"string"},"verticalPack":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"primaryOutcome":{"type":"string","enum":["booking","document_collection","payment_followup","intake_completed","handoff_completed","exception_resolved"]},"requiredFields":{"type":"array","items":{"type":"string"}},"allowedToolIds":{"type":"array","items":{"type":"string"}},"blockedToolIds":{"type":"array","items":{"type":"string"}},"riskLevel":{"type":"string","enum":["low","medium","high"]},"handoffPolicy":{"type":"string","enum":["never","on_exception","before_mutation","always"]},"successMetricIds":{"type":"array","items":{"type":"string"}}},"required":["workflowId","verticalPack","title","description","primaryOutcome","requiredFields","allowedToolIds","riskLevel","handoffPolicy","successMetricIds"],"additionalProperties":false}}},"required":["success","verticalPack","workflows"],"additionalProperties":false}}}},"404":{"description":"Unknown vertical pack","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/verticals/healthcare/workflows":{"get":{"tags":["Verticals"],"summary":"List healthcare workflow definitions","operationId":"getHealthcareWorkflows","responses":{"200":{"description":"Healthcare workflows from vertical catalog","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal"]},"workflows":{"type":"array","items":{"type":"object","properties":{"workflowId":{"type":"string"},"verticalPack":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"primaryOutcome":{"type":"string","enum":["booking","document_collection","payment_followup","intake_completed","handoff_completed","exception_resolved"]},"requiredFields":{"type":"array","items":{"type":"string"}},"allowedToolIds":{"type":"array","items":{"type":"string"}},"blockedToolIds":{"type":"array","items":{"type":"string"}},"riskLevel":{"type":"string","enum":["low","medium","high"]},"handoffPolicy":{"type":"string","enum":["never","on_exception","before_mutation","always"]},"successMetricIds":{"type":"array","items":{"type":"string"}}},"required":["workflowId","verticalPack","title","description","primaryOutcome","requiredFields","allowedToolIds","riskLevel","handoffPolicy","successMetricIds"],"additionalProperties":false}}},"required":["success","verticalPack","workflows"],"additionalProperties":false}}}},"404":{"description":"Unknown vertical pack","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}},"/api/verticals/legal/workflows":{"get":{"tags":["Verticals"],"summary":"List legal workflow definitions","operationId":"getLegalWorkflows","responses":{"200":{"description":"Legal workflows from vertical catalog","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","const":true},"verticalPack":{"type":"string","enum":["accounting","healthcare","legal"]},"workflows":{"type":"array","items":{"type":"object","properties":{"workflowId":{"type":"string"},"verticalPack":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"primaryOutcome":{"type":"string","enum":["booking","document_collection","payment_followup","intake_completed","handoff_completed","exception_resolved"]},"requiredFields":{"type":"array","items":{"type":"string"}},"allowedToolIds":{"type":"array","items":{"type":"string"}},"blockedToolIds":{"type":"array","items":{"type":"string"}},"riskLevel":{"type":"string","enum":["low","medium","high"]},"handoffPolicy":{"type":"string","enum":["never","on_exception","before_mutation","always"]},"successMetricIds":{"type":"array","items":{"type":"string"}}},"required":["workflowId","verticalPack","title","description","primaryOutcome","requiredFields","allowedToolIds","riskLevel","handoffPolicy","successMetricIds"],"additionalProperties":false}}},"required":["success","verticalPack","workflows"],"additionalProperties":false}}}},"404":{"description":"Unknown vertical pack","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"Machine-readable error message"},"message":{"description":"Human-readable detail","type":"string"}},"required":["error"],"additionalProperties":{}}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Clerk JWT (`Authorization: Bearer <token>`) from an authenticated admin session."},"workflowSecret":{"type":"apiKey","in":"header","name":"x-tellgence-workflow-secret","description":"Plaintext value of `INTERNAL_WORKFLOW_CALLBACK_SECRET` (Temporal orchestrator → API only)."}}}}