{"openapi":"3.1.0","info":{"title":"Retell-Zep-GHL Integration (Refactored)","version":"0.1.0"},"paths":{"/":{"get":{"summary":"Root","description":"Root health check endpoint","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Root  Get"}}}}}}},"/health":{"get":{"summary":"Health Check","description":"Health check — returns only status (no integration details for security).","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Check Health Get"}}}}}}},"/retell/inbound":{"post":{"tags":["retell"],"summary":"Retell Inbound Webhook","description":"Retell inbound call webhook handler with tenant isolation.\n\nSignature verification is workspace-scoped: we parse the body to extract\n``to_number``, resolve the workspace, then verify ``x-retell-signature``\nagainst that workspace's Retell API key.\n\nPerformance targets:\n- Cached: 30-50ms\n- Uncached: 80-100ms","operationId":"retell_inbound_webhook_retell_inbound_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/retell/call-ended":{"post":{"tags":["retell"],"summary":"Retell Call Ended","description":"Handle call-ended webhook to store transcript in Zep with tenant isolation","operationId":"retell_call_ended_retell_call_ended_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Retell Call Ended Retell Call Ended Post"}}}}}}},"/retell/call-analyzed":{"post":{"tags":["retell"],"summary":"Retell Call Analyzed","description":"Handle call-analyzed webhook to store post-call analysis (summary, sentiment, success)","operationId":"retell_call_analyzed_retell_call_analyzed_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Retell Call Analyzed Retell Call Analyzed Post"}}}}}}},"/retell/chat":{"post":{"tags":["retell"],"summary":"Retell Chat Webhook","description":"Retell chat events for 2-way SMS (chat agent linked to a voice agent).\n\nEvents: chat_started, transcript_updated, chat_ended, chat_analyzed.\nEach event carries the full chat object — we upsert sms_chats +\nsms_messages on every event (idempotent), and dispatch post-chat\nworkflows on chat_ended / chat_analyzed.","operationId":"retell_chat_webhook_retell_chat_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Retell Chat Webhook Retell Chat Post"}}}}}}},"/retell/workflows/{webhook_key}":{"post":{"tags":["retell"],"summary":"Retell Workflow Webhook","description":"Per-workflow webhook endpoint. Lets a single Retell voice agent dispatch\nto several distinct workflows by pointing each custom function at its own\nunique URL: POST /retell/workflows/{webhook_key}.\n\nHMAC signature verification is workspace-scoped: we resolve the workflow\n(and therefore the workspace) from the URL path first, then verify the\n``x-retell-signature`` header against that workspace's own Retell API key\n(``workspace_integrations`` → ``workspaces.retell_api_key_encrypted``).\nThe 128-bit webhook_key URL is the primary bearer secret; HMAC is\ndefense-in-depth only (warn on mismatch, don't reject).","operationId":"retell_workflow_webhook_retell_workflows__webhook_key__post","parameters":[{"name":"webhook_key","in":"path","required":true,"schema":{"type":"string","title":"Webhook Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/voice/livekit/calls/started":{"post":{"tags":["voice"],"summary":"Livekit Call Started","operationId":"livekit_call_started_voice_livekit_calls_started_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Livekit Call Started Voice Livekit Calls Started Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/voice/livekit/tool-call":{"post":{"tags":["voice"],"summary":"Livekit Tool Call","operationId":"livekit_tool_call_voice_livekit_tool_call_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Livekit Tool Call Voice Livekit Tool Call Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/voice/livekit/caller/record":{"post":{"tags":["voice"],"summary":"Livekit Caller Record","description":"Record a caller who is not the person on file for their number.\n\nGHL contacts are keyed by phone, so upserting the new caller onto a number\nthat already belongs to a contact would rename the account holder. When the\nnumber is taken the existing contact is left untouched and gets a note\ninstead; only a number nobody owns becomes a new contact.","operationId":"livekit_caller_record_voice_livekit_caller_record_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Livekit Caller Record Voice Livekit Caller Record Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/voice/livekit/calls/ended":{"post":{"tags":["voice"],"summary":"Livekit Call Ended","operationId":"livekit_call_ended_voice_livekit_calls_ended_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Livekit Call Ended Voice Livekit Calls Ended Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/voice/livekit/webhook":{"post":{"tags":["voice"],"summary":"Livekit Webhook","operationId":"livekit_webhook_voice_livekit_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Livekit Webhook Voice Livekit Webhook Post"}}}}}}},"/api/voice/agents/{workspace_id}/options":{"get":{"tags":["voice"],"summary":"Get Options","description":"Choices the editor offers, plus whether the caller may save.","operationId":"get_options_api_voice_agents__workspace_id__options_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Options Api Voice Agents  Workspace Id  Options Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voice/agents/{workspace_id}":{"post":{"tags":["voice"],"summary":"Create Agent","operationId":"create_agent_api_voice_agents__workspace_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAgentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Agent Api Voice Agents  Workspace Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voice/agents/{workspace_id}/{agent_id}":{"patch":{"tags":["voice"],"summary":"Update Agent","operationId":"update_agent_api_voice_agents__workspace_id___agent_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentFields"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Agent Api Voice Agents  Workspace Id   Agent Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["voice"],"summary":"Delete Agent","description":"Soft delete: calls rows keep pointing at the agent for history.","operationId":"delete_agent_api_voice_agents__workspace_id___agent_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"Agent Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calling-rules/{workspace_id}":{"get":{"tags":["calling-rules"],"summary":"Get Rules","operationId":"get_rules_api_calling_rules__workspace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"scope","in":"query","required":false,"schema":{"enum":["workspace","campaign","voicepay_merchant","workflow"],"type":"string","default":"workspace","title":"Scope"}},{"name":"scope_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Rules Api Calling Rules  Workspace Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["calling-rules"],"summary":"Save Rules","operationId":"save_rules_api_calling_rules__workspace_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RulesBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Save Rules Api Calling Rules  Workspace Id  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["calling-rules"],"summary":"Delete Rules","description":"Drop the row so the scope inherits (workspace default → platform default).","operationId":"delete_rules_api_calling_rules__workspace_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"scope","in":"query","required":true,"schema":{"enum":["workspace","campaign","voicepay_merchant","workflow"],"type":"string","title":"Scope"}},{"name":"scope_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calling-rules/{workspace_id}/check":{"post":{"tags":["calling-rules"],"summary":"Check Number","operationId":"check_number_api_calling_rules__workspace_id__check_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Check Number Api Calling Rules  Workspace Id  Check Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/appointments/book":{"post":{"tags":["appointments"],"summary":"Book Appointment","description":"Book a new appointment\n\nRequest body:\n{\n    \"workspace_id\": \"uuid\",\n    \"contact_id\": \"ghl_contact_id\",\n    \"calendar_id\": \"optional_calendar_id\",\n    \"slot_time\": \"2024-01-15T14:00:00Z\",\n    \"title\": \"Appointment Title\",\n    \"notes\": \"Additional notes\",\n    \"customer_phone\": \"+15551234567\"\n}","operationId":"book_appointment_appointments_book_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Book Appointment Appointments Book Post"}}}}}}},"/appointments/reschedule":{"post":{"tags":["appointments"],"summary":"Reschedule Appointment","description":"Reschedule an existing appointment\n\nRequest body:\n{\n    \"workspace_id\": \"uuid\",\n    \"event_id\": \"appointment_id\",\n    \"new_start_time\": \"2024-01-16T15:00:00Z\"\n}","operationId":"reschedule_appointment_appointments_reschedule_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Reschedule Appointment Appointments Reschedule Post"}}}}}}},"/appointments/cancel":{"post":{"tags":["appointments"],"summary":"Cancel Appointment","description":"Cancel an appointment\n\nRequest body:\n{\n    \"workspace_id\": \"uuid\",\n    \"event_id\": \"appointment_id\"\n}","operationId":"cancel_appointment_appointments_cancel_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Cancel Appointment Appointments Cancel Post"}}}}}}},"/appointments/availability":{"get":{"tags":["appointments"],"summary":"Get Availability","description":"Get available appointment slots\n\nQuery parameters:\n- workspace_id: Workspace UUID (required)\n- calendar_id: GHL calendar ID (optional, uses workspace default)\n- start_date: Start date in YYYY-MM-DD format (optional, defaults to today)\n- end_date: End date in YYYY-MM-DD format (optional, defaults to 7 days from now)\n- timezone: Timezone string (optional, uses workspace default)","operationId":"get_availability_appointments_availability_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","description":"Workspace ID","title":"Workspace Id"},"description":"Workspace ID"},{"name":"calendar_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date"}},{"name":"timezone","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Availability Appointments Availability Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge/sync":{"post":{"tags":["knowledge"],"summary":"Sync Knowledge","description":"Sync knowledge entries to the workspace's Zep group graph.\n\nEach entry is serialised as JSON and added via ``zep_client.add_group_data``.","operationId":"sync_knowledge_knowledge_sync_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Sync Knowledge Knowledge Sync Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/knowledge/search":{"post":{"tags":["knowledge"],"summary":"Search Knowledge","description":"Search the workspace's Zep knowledge graph.","operationId":"search_knowledge_knowledge_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Search Knowledge Knowledge Search Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/knowledge/graph":{"post":{"tags":["knowledge"],"summary":"Get Knowledge Graph","description":"Return the full workspace knowledge graph (nodes + edges) for visualization.","operationId":"get_knowledge_graph_knowledge_graph_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GraphRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Knowledge Graph Knowledge Graph Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/knowledge/ingest":{"post":{"tags":["knowledge"],"summary":"Ingest Documents","description":"Extract text from uploaded documents, chunk it, optionally prepend an\nLLM-generated context line per chunk, and add to the workspace graph.","operationId":"ingest_documents_knowledge_ingest_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_ingest_documents_knowledge_ingest_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Ingest Documents Knowledge Ingest Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/activity/stream":{"get":{"tags":["activity"],"summary":"Activity Stream","description":"Get recent integration activity for a workspace.\n\nReturns entries from the Redis activity stream, newest first.\nEach entry includes: integration, action, status, duration_ms, error, metadata.","operationId":"activity_stream_activity_stream_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"integration","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by integration name","title":"Integration"},"description":"Filter by integration name"},{"name":"count","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"description":"Number of entries to return","default":50,"title":"Count"},"description":"Number of entries to return"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/templates":{"get":{"tags":["workflows"],"summary":"List Templates","description":"List all available workflow templates.","operationId":"list_templates_api_workflows_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Response List Templates Api Workflows Templates Get"}}}}}}},"/api/workflows/{workspace_id}/from-template":{"post":{"tags":["workflows"],"summary":"Create From Template","description":"Create a workflow from a template.","operationId":"create_from_template_api_workflows__workspace_id__from_template_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create From Template Api Workflows  Workspace Id  From Template Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/{workspace_id}/generate":{"post":{"tags":["workflows"],"summary":"Generate Workflow","description":"Generate a workflow DAG from a natural language description.","operationId":"generate_workflow_api_workflows__workspace_id__generate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Generate Workflow Api Workflows  Workspace Id  Generate Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/{workspace_id}":{"get":{"tags":["workflows"],"summary":"List Workflows","description":"List all workflows for a workspace.","operationId":"list_workflows_api_workflows__workspace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"is_active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Workflows Api Workflows  Workspace Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["workflows"],"summary":"Create Workflow","description":"Create a new workflow.","operationId":"create_workflow_api_workflows__workspace_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Workflow Api Workflows  Workspace Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/{workspace_id}/runs":{"get":{"tags":["workflows"],"summary":"List Runs","description":"List workflow runs for a workspace (paginated, filterable).","operationId":"list_runs_api_workflows__workspace_id__runs_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"workflow_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"started_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started After"}},{"name":"started_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started Before"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/{workspace_id}/runs/{run_id}":{"get":{"tags":["workflows"],"summary":"Get Run","description":"Get a single run with step logs.","operationId":"get_run_api_workflows__workspace_id__runs__run_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Run Api Workflows  Workspace Id  Runs  Run Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/{workspace_id}/runs/{run_id}/replay":{"post":{"tags":["workflows"],"summary":"Replay Run","description":"Replay a workflow run using the original trigger event.","operationId":"replay_run_api_workflows__workspace_id__runs__run_id__replay_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Replay Run Api Workflows  Workspace Id  Runs  Run Id  Replay Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/{workspace_id}/{workflow_id}":{"get":{"tags":["workflows"],"summary":"Get Workflow","description":"Get a single workflow with nodes and edges.","operationId":"get_workflow_api_workflows__workspace_id___workflow_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Workflow Api Workflows  Workspace Id   Workflow Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["workflows"],"summary":"Update Workflow","description":"Update a workflow (metadata, nodes, and edges).","operationId":"update_workflow_api_workflows__workspace_id___workflow_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Workflow Api Workflows  Workspace Id   Workflow Id  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["workflows"],"summary":"Delete Workflow","description":"Delete a workflow (cascades to nodes, edges, runs).","operationId":"delete_workflow_api_workflows__workspace_id___workflow_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Delete Workflow Api Workflows  Workspace Id   Workflow Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/{workspace_id}/{workflow_id}/activate":{"patch":{"tags":["workflows"],"summary":"Activate Workflow","description":"Toggle workflow active status.","operationId":"activate_workflow_api_workflows__workspace_id___workflow_id__activate_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Activate Workflow Api Workflows  Workspace Id   Workflow Id  Activate Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workflows/{workspace_id}/{workflow_id}/trigger":{"post":{"tags":["workflows"],"summary":"Trigger Workflow","description":"Manually trigger a workflow (for testing).\nReal-time workflows execute inline, post-call workflows run in background.","operationId":"trigger_workflow_api_workflows__workspace_id___workflow_id__trigger_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Trigger Workflow Api Workflows  Workspace Id   Workflow Id  Trigger Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/activity":{"get":{"tags":["observability"],"summary":"List Activity","description":"List activity log entries with optional filters.","operationId":"list_activity_api_observability__workspace_id__activity_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"integration_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Integration Type"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Date"}},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Date"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Activity Api Observability  Workspace Id  Activity Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/activity/stats":{"get":{"tags":["observability"],"summary":"Get Activity Stats","description":"Get aggregated activity stats for last 24 hours.","operationId":"get_activity_stats_api_observability__workspace_id__activity_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Activity Stats Api Observability  Workspace Id  Activity Stats Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/activity/{log_id}":{"get":{"tags":["observability"],"summary":"Get Activity Detail","description":"Get a single activity log entry.","operationId":"get_activity_detail_api_observability__workspace_id__activity__log_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"log_id","in":"path","required":true,"schema":{"type":"string","title":"Log Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Activity Detail Api Observability  Workspace Id  Activity  Log Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/health":{"get":{"tags":["observability"],"summary":"Get Integration Health","description":"Get circuit breaker states for all integrations in a workspace.","operationId":"get_integration_health_api_observability__workspace_id__health_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Integration Health Api Observability  Workspace Id  Health Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/notifications":{"get":{"tags":["observability"],"summary":"List Notifications","description":"List notifications for a workspace.","operationId":"list_notifications_api_observability__workspace_id__notifications_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"is_read","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Read"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Notifications Api Observability  Workspace Id  Notifications Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/notifications/unread-count":{"get":{"tags":["observability"],"summary":"Get Unread Count","description":"Get count of unread notifications.","operationId":"get_unread_count_api_observability__workspace_id__notifications_unread_count_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Unread Count Api Observability  Workspace Id  Notifications Unread Count Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/notifications/{notification_id}/read":{"patch":{"tags":["observability"],"summary":"Mark Notification Read","description":"Mark a notification as read.","operationId":"mark_notification_read_api_observability__workspace_id__notifications__notification_id__read_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mark Notification Read Api Observability  Workspace Id  Notifications  Notification Id  Read Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/notifications/read-all":{"patch":{"tags":["observability"],"summary":"Mark All Read","description":"Mark all notifications as read for a workspace.","operationId":"mark_all_read_api_observability__workspace_id__notifications_read_all_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Mark All Read Api Observability  Workspace Id  Notifications Read All Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/integrations/{type_key}/test":{"post":{"tags":["observability"],"summary":"Test Integration Connection","description":"Test connectivity for a workspace integration.","operationId":"test_integration_connection_api_observability__workspace_id__integrations__type_key__test_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"type_key","in":"path","required":true,"schema":{"type":"string","title":"Type Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Test Integration Connection Api Observability  Workspace Id  Integrations  Type Key  Test Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/observability/{workspace_id}/circuit-breaker/{type_key}/reset":{"post":{"tags":["observability"],"summary":"Reset Circuit Breaker","description":"Manually reset a circuit breaker to CLOSED state.","operationId":"reset_circuit_breaker_api_observability__workspace_id__circuit_breaker__type_key__reset_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"type_key","in":"path","required":true,"schema":{"type":"string","title":"Type Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Reset Circuit Breaker Api Observability  Workspace Id  Circuit Breaker  Type Key  Reset Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/side-effects/{workspace_id}/review-queue":{"get":{"tags":["side-effects"],"summary":"Get Review Queue","operationId":"get_review_queue_api_side_effects__workspace_id__review_queue_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Review Queue Api Side Effects  Workspace Id  Review Queue Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/side-effects/{workspace_id}/{side_effect_id}/review":{"post":{"tags":["side-effects"],"summary":"Review Side Effect","operationId":"review_side_effect_api_side_effects__workspace_id___side_effect_id__review_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"side_effect_id","in":"path","required":true,"schema":{"type":"string","title":"Side Effect Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Review Side Effect Api Side Effects  Workspace Id   Side Effect Id  Review Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/oauth/{type_key}/authorize":{"get":{"tags":["OAuth"],"summary":"Get Authorize Url","description":"Generate the OAuth2 authorization URL for a given integration type.\nThe frontend opens this URL in a popup window.\n\nMembership in ``workspace_id`` is required. This endpoint was previously\nunauthenticated, which let anyone name any workspace and mint a signed state\ntoken against it — the token that the callback later trusts to decide which\nworkspace receives the credentials. ``require_workspace_access`` reads\n``workspace_id`` from the query string here rather than a path parameter;\nFastAPI resolves it either way.\n\nThe callback below is deliberately NOT authenticated: it is entered by a\nredirect from the provider, which carries no session. Its protection is the\nHMAC-signed state token this endpoint issues, which is exactly why issuing\none had to be gated.","operationId":"get_authorize_url_api_oauth__type_key__authorize_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"type_key","in":"path","required":true,"schema":{"type":"string","title":"Type Key"}},{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"redirect_uri","in":"query","required":true,"schema":{"type":"string","title":"Redirect Uri"}},{"name":"frontend_origin","in":"query","required":false,"schema":{"type":"string","default":"","title":"Frontend Origin"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/oauth/callback":{"get":{"tags":["OAuth"],"summary":"Oauth Callback","description":"Handle the OAuth2 provider redirect.\nExchanges the authorization code for tokens and returns HTML that\nsends a postMessage to the opener window.","operationId":"oauth_callback_api_oauth_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","title":"Error"}},{"name":"error_description","in":"query","required":false,"schema":{"type":"string","title":"Error Description"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/retell/sync-status":{"get":{"tags":["retell-sync"],"summary":"Get Sync Status","description":"Return current sync config, last sync times, and recent log entries.","operationId":"get_sync_status_api_retell_sync_status_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/retell/sync-schedule":{"post":{"tags":["retell-sync"],"summary":"Update Sync Schedule","description":"Update the sync schedule for a workspace.","operationId":"update_sync_schedule_api_retell_sync_schedule_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncScheduleRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/retell/sync-now":{"post":{"tags":["retell-sync"],"summary":"Trigger Sync Now","description":"Trigger an immediate Retell sync in the background.","operationId":"trigger_sync_now_api_retell_sync_now_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncNowRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/retell/sync-phones":{"post":{"tags":["retell-sync"],"summary":"Sync Phone Numbers","description":"Pull phone numbers from Retell and upsert into agent_phone_numbers.\nDelegates to RetellSyncService.","operationId":"sync_phone_numbers_api_retell_sync_phones_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneSyncRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneSyncResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/retell/sync-agents":{"post":{"tags":["retell-sync"],"summary":"Sync Agents","description":"Pull agents from Retell and upsert into voice_agents.","operationId":"sync_agents_api_retell_sync_agents_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSyncRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/retell/sync-calls":{"post":{"tags":["retell-sync"],"summary":"Sync Calls","description":"Pull calls newer than the stored cursor from Retell and upsert into calls.","operationId":"sync_calls_api_retell_sync_calls_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceSyncRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/campaigns/{workspace_id}":{"get":{"tags":["campaigns"],"summary":"List Campaigns","description":"List all campaigns for a workspace with computed metrics.","operationId":"list_campaigns_api_campaigns__workspace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{},"title":"Response List Campaigns Api Campaigns  Workspace Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["campaigns"],"summary":"Create Campaign","description":"Create a new campaign.","operationId":"create_campaign_api_campaigns__workspace_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Campaign Api Campaigns  Workspace Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}":{"get":{"tags":["campaigns"],"summary":"Get Campaign","description":"Get a single campaign.","operationId":"get_campaign_api_campaigns__workspace_id___campaign_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Campaign Api Campaigns  Workspace Id   Campaign Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["campaigns"],"summary":"Update Campaign","description":"Update campaign fields.","operationId":"update_campaign_api_campaigns__workspace_id___campaign_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Campaign Api Campaigns  Workspace Id   Campaign Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["campaigns"],"summary":"Delete Campaign","description":"Delete a campaign (draft or completed only).","operationId":"delete_campaign_api_campaigns__workspace_id___campaign_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Campaign Api Campaigns  Workspace Id   Campaign Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/status":{"patch":{"tags":["campaigns"],"summary":"Update Campaign Status","description":"Change campaign status. Launches executor when activated.","operationId":"update_campaign_status_api_campaigns__workspace_id___campaign_id__status_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Campaign Status Api Campaigns  Workspace Id   Campaign Id  Status Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/import-contacts":{"post":{"tags":["campaigns"],"summary":"Import Contacts","description":"Import contacts from a CSV file.","operationId":"import_contacts_api_campaigns__workspace_id___campaign_id__import_contacts_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_contacts_api_campaigns__workspace_id___campaign_id__import_contacts_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Import Contacts Api Campaigns  Workspace Id   Campaign Id  Import Contacts Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/contacts":{"get":{"tags":["campaigns"],"summary":"List Campaign Contacts","description":"List contacts linked to a campaign with their call status.","operationId":"list_campaign_contacts_api_campaigns__workspace_id___campaign_id__contacts_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{},"title":"Response List Campaign Contacts Api Campaigns  Workspace Id   Campaign Id  Contacts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/analytics":{"get":{"tags":["campaigns"],"summary":"Get Campaign Analytics","description":"Get detailed analytics for a campaign.","operationId":"get_campaign_analytics_api_campaigns__workspace_id___campaign_id__analytics_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Campaign Analytics Api Campaigns  Workspace Id   Campaign Id  Analytics Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/contacts/{contact_id}":{"get":{"tags":["campaigns"],"summary":"Get Contact Detail","description":"Get detailed info for a single contact in a campaign.","operationId":"get_contact_detail_api_campaigns__workspace_id___campaign_id__contacts__contact_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Contact Detail Api Campaigns  Workspace Id   Campaign Id  Contacts  Contact Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/clone":{"post":{"tags":["campaigns"],"summary":"Clone Campaign","description":"Clone a campaign with all settings as a new draft.","operationId":"clone_campaign_api_campaigns__workspace_id___campaign_id__clone_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Clone Campaign Api Campaigns  Workspace Id   Campaign Id  Clone Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/contacts/{contact_id}/disposition":{"patch":{"tags":["campaigns"],"summary":"Update Disposition","description":"Update the disposition of a campaign contact.","operationId":"update_disposition_api_campaigns__workspace_id___campaign_id__contacts__contact_id__disposition_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Disposition Api Campaigns  Workspace Id   Campaign Id  Contacts  Contact Id  Disposition Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/contacts/bulk":{"post":{"tags":["campaigns"],"summary":"Bulk Update Contacts","description":"Bulk update contacts. Body: {contact_ids, action, value?}.","operationId":"bulk_update_contacts_api_campaigns__workspace_id___campaign_id__contacts_bulk_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Bulk Update Contacts Api Campaigns  Workspace Id   Campaign Id  Contacts Bulk Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/queue":{"get":{"tags":["campaigns"],"summary":"Get Campaign Queue","description":"Get the pending + retry + callback queue for a campaign.","operationId":"get_campaign_queue_api_campaigns__workspace_id___campaign_id__queue_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{},"title":"Response Get Campaign Queue Api Campaigns  Workspace Id   Campaign Id  Queue Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/dispositions":{"get":{"tags":["campaigns"],"summary":"Get Dispositions","description":"Get disposition distribution for a campaign.","operationId":"get_dispositions_api_campaigns__workspace_id___campaign_id__dispositions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Dispositions Api Campaigns  Workspace Id   Campaign Id  Dispositions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/{campaign_id}/callbacks":{"post":{"tags":["campaigns"],"summary":"Create Callback","description":"Schedule a callback. Body: {campaign_contact_id, scheduled_for, reason?}.","operationId":"create_callback_api_campaigns__workspace_id___campaign_id__callbacks_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Callback Api Campaigns  Workspace Id   Campaign Id  Callbacks Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["campaigns"],"summary":"List Callbacks","description":"List callbacks for a campaign.","operationId":"list_callbacks_api_campaigns__workspace_id___campaign_id__callbacks_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{},"title":"Response List Callbacks Api Campaigns  Workspace Id   Campaign Id  Callbacks Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/campaigns/{workspace_id}/callbacks/{callback_id}":{"delete":{"tags":["campaigns"],"summary":"Cancel Callback","description":"Cancel a pending callback.","operationId":"cancel_callback_api_campaigns__workspace_id__callbacks__callback_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"callback_id","in":"path","required":true,"schema":{"type":"string","title":"Callback Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Cancel Callback Api Campaigns  Workspace Id  Callbacks  Callback Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/lead-recovery/{workspace_id}/metrics":{"get":{"tags":["lead-recovery"],"summary":"Get Lead Recovery Metrics","description":"Ten lead-recovery metrics for a workspace over a window (default last 30 days).","operationId":"get_lead_recovery_metrics_api_lead_recovery__workspace_id__metrics_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}},{"name":"lead_source","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lead Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Lead Recovery Metrics Api Lead Recovery  Workspace Id  Metrics Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/lead-recovery/{workspace_id}/leads":{"get":{"tags":["lead-recovery"],"summary":"Get Lead Recovery Leads","description":"Leads behind one trend point (drill-down). Pass the same window the chart used.","operationId":"get_lead_recovery_leads_api_lead_recovery__workspace_id__leads_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"date","in":"query","required":true,"schema":{"type":"string","title":"Date"}},{"name":"granularity","in":"query","required":false,"schema":{"type":"string","default":"day","title":"Granularity"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}},{"name":"lead_source","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lead Source"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Lead Recovery Leads Api Lead Recovery  Workspace Id  Leads Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/dnc/{workspace_id}":{"get":{"tags":["dnc"],"summary":"List Dnc","description":"List DNC entries with count.","operationId":"list_dnc_api_dnc__workspace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":500,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Dnc Api Dnc  Workspace Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["dnc"],"summary":"Add Dnc","description":"Add a single phone number to the DNC list.","operationId":"add_dnc_api_dnc__workspace_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Add Dnc Api Dnc  Workspace Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/dnc/{workspace_id}/import":{"post":{"tags":["dnc"],"summary":"Import Dnc","description":"Bulk import DNC numbers from CSV (column: phone or phone_number).","operationId":"import_dnc_api_dnc__workspace_id__import_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_dnc_api_dnc__workspace_id__import_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Import Dnc Api Dnc  Workspace Id  Import Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/dnc/{workspace_id}/{dnc_id}":{"delete":{"tags":["dnc"],"summary":"Remove Dnc","description":"Remove a DNC entry by ID.","operationId":"remove_dnc_api_dnc__workspace_id___dnc_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"dnc_id","in":"path","required":true,"schema":{"type":"string","title":"Dnc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Remove Dnc Api Dnc  Workspace Id   Dnc Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/dnc/{workspace_id}/check":{"post":{"tags":["dnc"],"summary":"Check Dnc","description":"Check if a phone number is on the DNC list.","operationId":"check_dnc_api_dnc__workspace_id__check_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Check Dnc Api Dnc  Workspace Id  Check Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/memory/{workspace_id}/{contact_id}":{"get":{"tags":["memory"],"summary":"Inspect Memory","description":"Current memory state: summary version, consent, retention, source calls, commitments, overrides.","operationId":"inspect_memory_api_memory__workspace_id___contact_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Inspect Memory Api Memory  Workspace Id   Contact Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/memory/{workspace_id}/{contact_id}/override":{"post":{"tags":["memory"],"summary":"Override Memory","operationId":"override_memory_api_memory__workspace_id___contact_id__override_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OverrideBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Override Memory Api Memory  Workspace Id   Contact Id  Override Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/memory/{workspace_id}/{contact_id}/redact":{"post":{"tags":["memory"],"summary":"Redact Memory","operationId":"redact_memory_api_memory__workspace_id___contact_id__redact_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedactBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Redact Memory Api Memory  Workspace Id   Contact Id  Redact Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/memory/{workspace_id}/{contact_id}/retention":{"post":{"tags":["memory"],"summary":"Set Retention","operationId":"set_retention_api_memory__workspace_id___contact_id__retention_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Retention Api Memory  Workspace Id   Contact Id  Retention Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/memory/{workspace_id}/{contact_id}/consent":{"post":{"tags":["memory"],"summary":"Set Consent","operationId":"set_consent_api_memory__workspace_id___contact_id__consent_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Set Consent Api Memory  Workspace Id   Contact Id  Consent Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/memory/{workspace_id}/{contact_id}/commitments":{"get":{"tags":["memory"],"summary":"List Commitments","operationId":"list_commitments_api_memory__workspace_id___contact_id__commitments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["open","resolved","cancelled"],"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Commitments Api Memory  Workspace Id   Contact Id  Commitments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["memory"],"summary":"Add Commitment","operationId":"add_commitment_api_memory__workspace_id___contact_id__commitments_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommitmentBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Add Commitment Api Memory  Workspace Id   Contact Id  Commitments Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/memory/{workspace_id}/{contact_id}/commitments/{commitment_id}":{"patch":{"tags":["memory"],"summary":"Update Commitment","operationId":"update_commitment_api_memory__workspace_id___contact_id__commitments__commitment_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}},{"name":"commitment_id","in":"path","required":true,"schema":{"type":"string","title":"Commitment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommitmentStatusBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Commitment Api Memory  Workspace Id   Contact Id  Commitments  Commitment Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/knowledge/schema/presets":{"get":{"tags":["memory-schema"],"summary":"List Presets","operationId":"list_presets_api_knowledge_schema_presets_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Presets Api Knowledge Schema Presets Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/knowledge/{workspace_id}/schema":{"get":{"tags":["memory-schema"],"summary":"Get Schema","operationId":"get_schema_api_knowledge__workspace_id__schema_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"scope","in":"query","required":false,"schema":{"enum":["caller","knowledge"],"type":"string","default":"caller","title":"Scope"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Schema Api Knowledge  Workspace Id  Schema Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["memory-schema"],"summary":"Put Schema","description":"Save a new version and apply it to Zep in the background (status starts 'pending').","operationId":"put_schema_api_knowledge__workspace_id__schema_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"scope","in":"query","required":false,"schema":{"enum":["caller","knowledge"],"type":"string","default":"caller","title":"Scope"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaBody"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Put Schema Api Knowledge  Workspace Id  Schema Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/knowledge/{workspace_id}/schema/validate":{"post":{"tags":["memory-schema"],"summary":"Validate Schema","description":"Dry run: report every problem without saving or touching Zep.","operationId":"validate_schema_api_knowledge__workspace_id__schema_validate_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Validate Schema Api Knowledge  Workspace Id  Schema Validate Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/knowledge/{workspace_id}/schema/apply":{"post":{"tags":["memory-schema"],"summary":"Retry Apply","description":"Re-apply the current version (after a partial or failed apply).","operationId":"retry_apply_api_knowledge__workspace_id__schema_apply_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"scope","in":"query","required":false,"schema":{"enum":["caller","knowledge"],"type":"string","default":"caller","title":"Scope"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Retry Apply Api Knowledge  Workspace Id  Schema Apply Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workspaces/{workspace_id}/offboarding":{"get":{"tags":["offboarding"],"summary":"Offboarding Status","operationId":"offboarding_status_api_workspaces__workspace_id__offboarding_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Offboarding Status Api Workspaces  Workspace Id  Offboarding Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["offboarding"],"summary":"Request Offboarding","operationId":"request_offboarding_api_workspaces__workspace_id__offboarding_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OffboardBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Request Offboarding Api Workspaces  Workspace Id  Offboarding Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workspaces/{workspace_id}/offboarding/cancel":{"post":{"tags":["offboarding"],"summary":"Cancel Offboarding","operationId":"cancel_offboarding_api_workspaces__workspace_id__offboarding_cancel_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Cancel Offboarding Api Workspaces  Workspace Id  Offboarding Cancel Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/field-mappings/{workspace_id}/{type_key}":{"get":{"tags":["field-mappings"],"summary":"Get Field Mappings","description":"Get field mappings for a workspace integration.","operationId":"get_field_mappings_api_field_mappings__workspace_id___type_key__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"type_key","in":"path","required":true,"schema":{"type":"string","title":"Type Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["field-mappings"],"summary":"Update Field Mappings","description":"Update field mappings for a workspace integration.\n\nReplaces all field mappings. To remove mappings, send an empty dict.\nAlso invalidates the resolver cache so the new mappings take effect immediately.","operationId":"update_field_mappings_api_field_mappings__workspace_id___type_key__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"type_key","in":"path","required":true,"schema":{"type":"string","title":"Type Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FieldMappingsUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/email/send":{"post":{"tags":["email"],"summary":"Send Email","description":"Send an email via SMTP. Called by the email_smtp declarative connector.","operationId":"send_email_api_email_send_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Send Email Api Email Send Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/email/send-template":{"post":{"tags":["email"],"summary":"Send Template Email","description":"Send a template email. Variables are substituted into the template body.","operationId":"send_template_email_api_email_send_template_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendTemplateEmailRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Send Template Email Api Email Send Template Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/roi/transactions":{"post":{"tags":["roi"],"summary":"Ingest Transaction","description":"Accept a revenue event from an external system.\n\nBody::\n\n    {\n        \"workspace_id\": \"uuid\",         # required\n        \"amount\": 500.00,               # required\n        \"currency\": \"USD\",              # default: USD\n        \"status\": \"won\",                # open|won|lost|abandoned|on_hold\n        \"source\": \"stripe\",             # identifier for the external system\n        \"external_id\": \"pi_abc123\",     # unique ID in the source system\n        \"name\": \"Order #1234\",          # human-readable title\n        \"call_id\": \"uuid\",             # optional: link to a call\n        \"campaign_id\": \"uuid\",         # optional: link to a campaign\n        \"agent_id\": \"uuid\",            # optional: link to a voice agent\n        \"contact_phone\": \"+15551234\",  # optional: resolve contact by phone\n        \"metadata\": {}                 # optional: arbitrary JSON\n    }","operationId":"ingest_transaction_api_roi_transactions_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Ingest Transaction Api Roi Transactions Post"}}}}},"security":[{"APIKeyHeader":[]}]}},"/api/roi/transactions/reconcile":{"post":{"tags":["roi"],"summary":"Reconcile Transaction","description":"Update a transaction when an external deal/order status changes.\n\nBody::\n\n    {\n        \"workspace_id\": \"uuid\",            # required\n        \"external_crm_type\": \"hubspot\",    # required: match source system\n        \"external_crm_id\": \"deal_123\",     # required: match external ID\n        \"new_status\": \"won\",               # open|won|lost|abandoned|on_hold\n        \"new_amount\": 6000.00              # optional: update amount\n    }","operationId":"reconcile_transaction_api_roi_transactions_reconcile_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Reconcile Transaction Api Roi Transactions Reconcile Post"}}}}},"security":[{"APIKeyHeader":[]}]}},"/api/mcp/servers/{workspace_id}":{"post":{"tags":["mcp"],"summary":"Add Server","description":"Add a new MCP server to a workspace. Fetches ``tools/list`` immediately\nto populate the tool cache; if tool discovery fails, the row is still\ncreated with ``status=error`` so the admin can retry.","operationId":"add_server_api_mcp_servers__workspace_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddServerRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["mcp"],"summary":"List Servers","description":"List all MCP servers for this workspace.","operationId":"list_servers_api_mcp_servers__workspace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp/servers/{workspace_id}/{integration_id}/tools":{"get":{"tags":["mcp"],"summary":"List Tools","description":"Return cached tool schemas for a specific MCP server.","operationId":"list_tools_api_mcp_servers__workspace_id___integration_id__tools_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp/servers/{workspace_id}/{integration_id}/test":{"post":{"tags":["mcp"],"summary":"Test Connection","description":"Open a short session and call ``tools/list`` to verify the server is reachable.","operationId":"test_connection_api_mcp_servers__workspace_id___integration_id__test_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp/servers/{workspace_id}/{integration_id}/refresh-tools":{"post":{"tags":["mcp"],"summary":"Refresh Tools","description":"Force a ``tools/list`` re-fetch and replace the cached tool rows.","operationId":"refresh_tools_api_mcp_servers__workspace_id___integration_id__refresh_tools_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp/servers/{workspace_id}/{integration_id}":{"delete":{"tags":["mcp"],"summary":"Delete Server","description":"Soft-delete an MCP server (sets is_active=false, removes cached tools).","operationId":"delete_server_api_mcp_servers__workspace_id___integration_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sms/agents/{workspace_id}":{"get":{"tags":["sms"],"summary":"List Chat Agents","operationId":"list_chat_agents_api_sms_agents__workspace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["sms"],"summary":"Create Chat Agent","description":"Create a Retell chat agent that shares the voice agent's response\nengine, and wire its webhook to /retell/chat.","operationId":"create_chat_agent_api_sms_agents__workspace_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateChatAgentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sms/numbers/{workspace_id}":{"get":{"tags":["sms"],"summary":"List Numbers","description":"List phone numbers for the workspace's agents with SMS wiring.\n\nagent_phone_numbers has no workspace_id — scope via the agent join.","operationId":"list_numbers_api_sms_numbers__workspace_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sms/numbers/{workspace_id}/{phone_id}":{"patch":{"tags":["sms"],"summary":"Update Number","operationId":"update_number_api_sms_numbers__workspace_id___phone_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateNumberRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/sms/chats/{workspace_id}/{chat_id}/reply":{"post":{"tags":["sms"],"summary":"Reply To Chat","description":"Human operator reply within an existing SMS thread.\n\nRetell owns the chat transcript, but there is no API to inject an\noperator turn into a Retell-managed SMS chat. So we send the reply\ndirectly through the workspace's Twilio connector and log it locally as\na role='operator' outbound message. The Retell-side transcript will not\ncontain this message (documented tradeoff — see plan Open Question 1).","operationId":"reply_to_chat_api_sms_chats__workspace_id___chat_id__reply_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"chat_id","in":"path","required":true,"schema":{"type":"string","title":"Chat Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/plans":{"get":{"tags":["billing"],"summary":"List Plans","description":"Plans visible to the caller: the global catalog ∪ their tenant's custom.\n\n``manage=true`` is the admin/catalog view — includes non-public and archived\nplans, and requires admin (or superuser).","operationId":"list_plans_api_billing_plans_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"manage","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Manage"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Plans Api Billing Plans Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["billing"],"summary":"Create Plan","description":"Create a plan. Body may carry ``tenant_id`` to own it (superuser: any;\ntenant admin: only their own). Omit ``tenant_id`` for a global plan\n(superuser only).","operationId":"create_plan_api_billing_plans_post","security":[{"HTTPBearer":[]}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Plan Api Billing Plans Post"}}}}}}},"/api/billing/plans/{plan_id}":{"patch":{"tags":["billing"],"summary":"Update Plan","operationId":"update_plan_api_billing_plans__plan_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Plan Api Billing Plans  Plan Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["billing"],"summary":"Archive Plan","description":"Archive (soft-delete). Plans are never hard-deleted — live subscriptions\nreference them by code and must keep resolving.","operationId":"archive_plan_api_billing_plans__plan_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Archive Plan Api Billing Plans  Plan Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/summary":{"get":{"tags":["billing"],"summary":"Summary","operationId":"summary_api_billing_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Summary Api Billing Summary Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/billing/pricing/{scope_type}/{scope_id}":{"get":{"tags":["billing"],"summary":"Get Pricing","operationId":"get_pricing_api_billing_pricing__scope_type___scope_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"scope_type","in":"path","required":true,"schema":{"type":"string","title":"Scope Type"}},{"name":"scope_id","in":"path","required":true,"schema":{"type":"string","title":"Scope Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Pricing Api Billing Pricing  Scope Type   Scope Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["billing"],"summary":"Put Pricing","operationId":"put_pricing_api_billing_pricing__scope_type___scope_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"scope_type","in":"path","required":true,"schema":{"type":"string","title":"Scope Type"}},{"name":"scope_id","in":"path","required":true,"schema":{"type":"string","title":"Scope Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Put Pricing Api Billing Pricing  Scope Type   Scope Id  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/workspace/{workspace_id}/account":{"post":{"tags":["billing"],"summary":"Create Workspace Account","operationId":"create_workspace_account_api_billing_workspace__workspace_id__account_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Workspace Account Api Billing Workspace  Workspace Id  Account Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/workspace/{workspace_id}/summary":{"get":{"tags":["billing"],"summary":"Workspace Summary","operationId":"workspace_summary_api_billing_workspace__workspace_id__summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Workspace Summary Api Billing Workspace  Workspace Id  Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/workspace/{workspace_id}/checkout":{"post":{"tags":["billing"],"summary":"Workspace Checkout","description":"Start the recurring leg (retainer / reseller platform-fee plan).","operationId":"workspace_checkout_api_billing_workspace__workspace_id__checkout_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Workspace Checkout Api Billing Workspace  Workspace Id  Checkout Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/workspace/{workspace_id}/reseller-checkout":{"post":{"tags":["billing"],"summary":"Workspace Reseller Checkout","description":"Start a reseller-client retail subscription (per-minute) on the reseller's\nown Stripe. The workspace's owning tenant must be a reseller; the plan must\nbe a reseller-owned retail plan.","operationId":"workspace_reseller_checkout_api_billing_workspace__workspace_id__reseller_checkout_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Workspace Reseller Checkout Api Billing Workspace  Workspace Id  Reseller Checkout Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/workspace/{workspace_id}/charge":{"post":{"tags":["billing"],"summary":"Workspace Charge","description":"Bill a one-time downpayment or setup fee (requires a card on file).","operationId":"workspace_charge_api_billing_workspace__workspace_id__charge_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Workspace Charge Api Billing Workspace  Workspace Id  Charge Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/reseller/{tenant_id}/credential":{"get":{"tags":["billing"],"summary":"Get Reseller Credential","description":"Status-only view of a reseller's BYO Stripe config. Never returns keys.","operationId":"get_reseller_credential_api_billing_reseller__tenant_id__credential_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Reseller Credential Api Billing Reseller  Tenant Id  Credential Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["billing"],"summary":"Put Reseller Credential","description":"Store/rotate the reseller's BYO Stripe key. Encrypts the key, auto-\nregisters the per-reseller webhook (manual ``webhook_secret`` paste as\nfallback), and returns the status projection.","operationId":"put_reseller_credential_api_billing_reseller__tenant_id__credential_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Put Reseller Credential Api Billing Reseller  Tenant Id  Credential Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/reseller/{tenant_id}/platform/summary":{"get":{"tags":["billing"],"summary":"Reseller Platform Summary","description":"Voicent->reseller platform billing summary (per-workspace fee + count).","operationId":"reseller_platform_summary_api_billing_reseller__tenant_id__platform_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Reseller Platform Summary Api Billing Reseller  Tenant Id  Platform Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/reseller/{tenant_id}/platform/checkout":{"post":{"tags":["billing"],"summary":"Reseller Platform Checkout","description":"Start the platform-fee subscription (per-workspace price x #workspaces) on\nVoicent's key. NO per-minute.","operationId":"reseller_platform_checkout_api_billing_reseller__tenant_id__platform_checkout_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Reseller Platform Checkout Api Billing Reseller  Tenant Id  Platform Checkout Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/reseller/{tenant_id}/platform/charge":{"post":{"tags":["billing"],"summary":"Reseller Platform Charge","description":"Bill a one-time downpayment/setup fee on the reseller's platform account.","operationId":"reseller_platform_charge_api_billing_reseller__tenant_id__platform_charge_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Reseller Platform Charge Api Billing Reseller  Tenant Id  Platform Charge Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/entitlements":{"get":{"tags":["billing"],"summary":"Entitlements","description":"Cached entitlements for gating UI. Side-effect free: unlike /summary this\nnever creates a billing_account, so it is safe to call on every app load.","operationId":"entitlements_api_billing_entitlements_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Entitlements Api Billing Entitlements Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/status":{"get":{"tags":["billing"],"summary":"Billing Status","description":"Subscription standing for the app-shell banner: status, when payment\nfirst failed, and when grace ends. Side-effect free.","operationId":"billing_status_api_billing_status_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Billing Status Api Billing Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/usage":{"get":{"tags":["billing"],"summary":"Usage","description":"Minutes used vs included this period, and overage so far. Read-only:\ncomputed from calls, never creates a billing_account.","operationId":"usage_api_billing_usage_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Usage Api Billing Usage Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/voicepay":{"get":{"tags":["billing"],"summary":"Voicepay Addon","description":"The VoicePay line item as the Billing page shows it: price, whether it is\nactive, and how many captures are waiting to be invoiced.","operationId":"voicepay_addon_api_billing_voicepay_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Voicepay Addon Api Billing Voicepay Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/voicepay/checkout":{"post":{"tags":["billing"],"summary":"Voicepay Checkout","description":"Buy VoicePay. The entitlement is written by the webhook when Stripe\nconfirms the subscription — nothing here flips it directly.","operationId":"voicepay_checkout_api_billing_voicepay_checkout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Voicepay Checkout Api Billing Voicepay Checkout Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/billing/checkout":{"post":{"tags":["billing"],"summary":"Checkout","operationId":"checkout_api_billing_checkout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Checkout Api Billing Checkout Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/billing/portal":{"post":{"tags":["billing"],"summary":"Portal","operationId":"portal_api_billing_portal_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Portal Api Billing Portal Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/billing/admin/provision-plans":{"post":{"tags":["billing"],"summary":"Provision Plans","operationId":"provision_plans_api_billing_admin_provision_plans_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Provision Plans Api Billing Admin Provision Plans Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/billing/admin/vendor-costs":{"get":{"tags":["billing"],"summary":"List Vendor Costs","description":"Shuttle's rates as effective-dated rows, newest first. Voicent-internal.","operationId":"list_vendor_costs_api_billing_admin_vendor_costs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Vendor Costs Api Billing Admin Vendor Costs Get"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["billing"],"summary":"Add Vendor Cost","description":"Add a rate effective from a date; the open row before it is closed the\nday prior. This is how a Shuttle price change (or the switch to one platform\nfee) is recorded — never a code change.","operationId":"add_vendor_cost_api_billing_admin_vendor_costs_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Add Vendor Cost Api Billing Admin Vendor Costs Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/billing/admin/vendor-costs/{row_id}":{"patch":{"tags":["billing"],"summary":"Update Vendor Cost","operationId":"update_vendor_cost_api_billing_admin_vendor_costs__row_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"row_id","in":"path","required":true,"schema":{"type":"string","title":"Row Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Vendor Cost Api Billing Admin Vendor Costs  Row Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["billing"],"summary":"Delete Vendor Cost","operationId":"delete_vendor_cost_api_billing_admin_vendor_costs__row_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"row_id","in":"path","required":true,"schema":{"type":"string","title":"Row Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Vendor Cost Api Billing Admin Vendor Costs  Row Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/admin/usage-reconciliation":{"get":{"tags":["billing"],"summary":"Usage Reconciliation","description":"Per account: billable minutes, metering tally, Retell cost, overage\nrevenue and margin floor. Superuser only. ``period=YYYY-MM`` or each\naccount's current period; ``format=csv`` for a spreadsheet.","operationId":"usage_reconciliation_api_billing_admin_usage_reconciliation_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","default":"json","title":"Format"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/admin/voicepay-margin":{"get":{"tags":["billing"],"summary":"Voicepay Margin","description":"VoicePay revenue vs Shuttle cost per tenant per month. Superuser only:\nvendor cost is Voicent's, not something a tenant sees.","operationId":"voicepay_margin_api_billing_admin_voicepay_margin_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer","default":6,"title":"Months"}},{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Voicepay Margin Api Billing Admin Voicepay Margin Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/webhooks/platform":{"post":{"tags":["billing"],"summary":"Platform Webhook","operationId":"platform_webhook_api_billing_webhooks_platform_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Platform Webhook Api Billing Webhooks Platform Post"}}}}}}},"/api/billing/webhooks/reseller/{webhook_key}":{"post":{"tags":["billing"],"summary":"Reseller Webhook","description":"Per-reseller Stripe webhook. The URL segment is the routing secret: it\nselects the reseller_billing_config, whose stored signing secret verifies the\ndelivery. Verified events dispatch through the shared handler on the\nreseller's own Stripe key (stripe_context='reseller').","operationId":"reseller_webhook_api_billing_webhooks_reseller__webhook_key__post","parameters":[{"name":"webhook_key","in":"path","required":true,"schema":{"type":"string","title":"Webhook Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Reseller Webhook Api Billing Webhooks Reseller  Webhook Key  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/retell-status":{"get":{"tags":["voicepay"],"summary":"Retell Status","description":"What the form shows before anyone presses the button.\n\n``has_key`` and ``connection_status`` are what this app already believes;\n``verified_at`` is the only field that reflects a real check, and it is null\nuntil someone runs one. The UI must keep those apart — a stored 'connected'\nis not evidence.","operationId":"retell_status_api_voicepay_workspaces__workspace_id__retell_status_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/verify-retell":{"post":{"tags":["voicepay"],"summary":"Verify Retell","description":"Check the workspace's Retell key against Retell, and on success store the copy\nthe call path reads.\n\n**This is the gate before a Shuttle instance is deployed for this client.**\nInstalling the Pay Connector is the manual staffed step — a person typing the\nmerchant's instance key and secret into the Twilio Console — so it is worth\nknowing the cheap, automatable half is sound first. A client whose Retell side\nis not ready would otherwise consume the one expensive part of onboarding and\nstill not be able to take a call.\n\nWriting the copy only on success is deliberate: an unverified key in the call\npath's table is worse than none, because the fallback to the process-wide key\nat least reaches *an* agent, where a stored bad key reaches nothing.","operationId":"verify_retell_api_voicepay_workspaces__workspace_id__verify_retell_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/overview":{"get":{"tags":["voicepay"],"summary":"Workspace Overview","description":"Everything the console's read-only view needs, in one call (setup console\ndesign §8 phase A): the reseller's subaccount row, this merchant, its numbers,\nthe tenant's attestations, recent preflight runs and recent transactions.\n\nEach fact keeps its tier. A preflight PASS is *verified*; an attestation is\n*recorded* and carries who and when; ``proved_at`` is the only *proven* thing\nhere and nothing in this API can set it. The UI must not collapse them.","operationId":"workspace_overview_api_voicepay_workspaces__workspace_id__overview_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/preflight":{"get":{"tags":["voicepay"],"summary":"Workspace Preflight","description":"Run the automatable checks for this merchant and record the result (FR-4).\n\nRead-only against Twilio. The run is stored in voicepay_preflight_runs so the\nconsole can show *when* a tenant last looked healthy, not just that it does now —\nevery failure mode in the payment path is silent, so the history is worth more\nthan the snapshot.\n\nA stored run is not readiness. Preflight cannot prove PCI Mode or a connector's\ncredentials; only a completed capture can, which is what proved_at records.","operationId":"workspace_preflight_api_voicepay_workspaces__workspace_id__preflight_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/connectors":{"get":{"tags":["voicepay"],"summary":"Workspace Connectors","description":"Pay Connectors installed on this reseller's subaccount, with their LIVE/TEST mode.\n\nNothing inherits across subaccounts, so this is asked of the account that will\nactually take the payment. Mode is fixed at install time and selects the\nenvironment — a TEST connector on a merchant believed to be live is a\nmisconfiguration that otherwise surfaces only as money that never moved.","operationId":"workspace_connectors_api_voicepay_workspaces__workspace_id__connectors_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/numbers":{"post":{"tags":["voicepay"],"summary":"Workspace Buy Number","description":"Search for a phone number, and buy one only with ``confirm: true``.\n\n**Superuser only (FR-8).** The number bills to VoicePay's parent Twilio account,\nnot the reseller's, so a tenant admin must not be able to spend it. Searching is\nharmless; buying is not, and the two are the same endpoint precisely so the\nconfirmation is a deliberate second step rather than a different button.\n\nNot idempotent — a retried confirmed request buys a second number.","operationId":"workspace_buy_number_api_voicepay_workspaces__workspace_id__numbers_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/tenants/{tenant_id}/subaccount":{"put":{"tags":["voicepay"],"summary":"Set Tenant Subaccount","description":"Make this tenant a VoicePay reseller: record its Twilio subaccount.\n\n**Superuser only.** Either paste an existing SID (``account_sid``), which VoicePay\nconfirms is one of the parent's subaccounts, or ask for a new one\n(``create: true``). Every call arriving on that account resolves to this\nreseller, so the binding is written once: a tenant that already has a\nsubaccount is refused rather than re-pointed, and so is a SID another tenant\nholds. Changing it is a deliberate database edit, not a form submission.\n\nPCI Mode and the Pay Connector install are per-account and cannot be scripted,\nso the row starts ``unattested`` and the response says what is still manual.","operationId":"set_tenant_subaccount_api_voicepay_tenants__tenant_id__subaccount_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/merchant":{"post":{"tags":["voicepay"],"summary":"Create Workspace Merchant","description":"Add this workspace as a VoicePay merchant (its sandbox row).\n\nThe connector name is the merchant selector at call time — right reseller, wrong\nconnector charges the wrong gateway — so it is validated, unique within the\nreseller, and fixed once written. The live row is not made here: it belongs to\ngo-live, after a proved sandbox.","operationId":"create_workspace_merchant_api_voicepay_workspaces__workspace_id__merchant_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/merchants/{merchant_id}/portal-access":{"patch":{"tags":["voicepay"],"summary":"Set Portal Access","description":"Record the window Voicent pays Shuttle's per-merchant portal fee for this\nmerchant (roles + multiple users in Shuttle's portal; not the payment path).\n\nThe fee is paid by hand, at Voicent's discretion, when a merchant wants the\nportal — so nothing about the merchant row implies it. This is the one place\nit is written, and the margin report reads it. Superuser only: it is\nVoicent's cost, not the reseller's setting.\n\n``started_on``: the first paid day, or null to clear the window. ``ended_on``:\nthe last paid day, or null while ongoing. Whole months: a month the window\ntouches costs the full fee.","operationId":"set_portal_access_api_voicepay_workspaces__workspace_id__merchants__merchant_id__portal_access_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"merchant_id","in":"path","required":true,"schema":{"type":"string","title":"Merchant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/merchant-agent":{"patch":{"tags":["voicepay"],"summary":"Set Merchant Agent","description":"Bind the Retell agent that answers this merchant's lines.\n\nUntil this is set, VoicePay's ``resolve()`` finds the merchant but no agent,\nand the process-wide ``RETELL_AGENT_ID`` speaks for it — which answered one\nreseller's client with another's agent for a month before anyone noticed. The\nVoicePay side now refuses that call rather than taking it; this endpoint is\nwhat makes the refusal fixable without hand-written SQL.\n\n**The agent must belong to THIS workspace.** That check is the point of the\nendpoint, not paperwork around it: merchant = workspace, so an agent from\nanother workspace is the very cross-tenant binding the bug consisted of.\nValidating here makes it unrepresentable rather than merely discouraged.\n\nSend ``retell_agent_id: null`` to unbind, which returns the merchant to the\nrefusing state — deliberately not to the old silent fallback.","operationId":"set_merchant_agent_api_voicepay_workspaces__workspace_id__merchant_agent_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/tenants/{tenant_id}/shuttle-application/{environment}":{"put":{"tags":["voicepay"],"summary":"Set Shuttle Application","description":"Store a reseller's Shuttle Application key (Developer tab) for one environment.\n\nSuperuser only. The secret passes through this process once, in memory, on its\nway to VoicePay — which verifies it with Shuttle, encrypts it under a key this\napp does not hold, and stores it. It is never logged, stored or returned here.","operationId":"set_shuttle_application_api_voicepay_tenants__tenant_id__shuttle_application__environment__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"environment","in":"path","required":true,"schema":{"type":"string","title":"Environment"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/shuttle-applications":{"get":{"tags":["voicepay"],"summary":"List Shuttle Applications","description":"Stored Shuttle keys with age and rotation due. Superuser only; no secrets.","operationId":"list_shuttle_applications_api_voicepay_shuttle_applications_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/voicepay/workspaces/{workspace_id}/shuttle":{"get":{"tags":["voicepay"],"summary":"Shuttle Status","description":"The merchant's state, read from Shuttle now (FR-S4).","operationId":"shuttle_status_api_voicepay_workspaces__workspace_id__shuttle_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/shuttle/instance":{"post":{"tags":["voicepay"],"summary":"Shuttle Create Instance","description":"Create this merchant at Shuttle (FR-S1). Idempotent; VoicePay gates live.","operationId":"shuttle_create_instance_api_voicepay_workspaces__workspace_id__shuttle_instance_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["voicepay"],"summary":"Shuttle Update Instance","description":"Edit names and contacts (FR-S2). Send ``v`` from the last status read.","operationId":"shuttle_update_instance_api_voicepay_workspaces__workspace_id__shuttle_instance_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["voicepay"],"summary":"Shuttle Delete Instance","description":"Delete this merchant's Shuttle instance (FR-S6). Superuser only, irreversible.\n``confirm`` must equal the instance key. VoicePay refuses while a call for the\nmerchant is recent; it cannot see uncaptured Shuttle authorisations, so staff\nconfirm those in Shuttle first. A 504 means it may have been deleted: check\nstatus, do not retry.","operationId":"shuttle_delete_instance_api_voicepay_workspaces__workspace_id__shuttle_instance_delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/shuttle/adopt":{"put":{"tags":["voicepay"],"summary":"Shuttle Adopt Instance","description":"Bind this merchant to an instance already created in the Shuttle portal (OQ-6).\nSuperuser only. VoicePay confirms the instance exists under this reseller's\nApplication before storing it, and refuses to re-point a bound merchant.","operationId":"shuttle_adopt_instance_api_voicepay_workspaces__workspace_id__shuttle_adopt_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/shuttle/processor":{"put":{"tags":["voicepay"],"summary":"Shuttle Set Processor","description":"Choose the merchant's payment processor (app-store mode: one per merchant).\n\nShuttle lets a one-processor merchant become multi-processor later, never the\nreverse, so this is the reversible choice. Recorded here; VoicePay checks it\nagainst the processors offered for phone payments when Setup is opened.","operationId":"shuttle_set_processor_api_voicepay_workspaces__workspace_id__shuttle_processor_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/shuttle/setup-link":{"post":{"tags":["voicepay"],"summary":"Shuttle Setup Link","description":"A fresh Merchant Setup deep link for the console to embed with shuttle.js.\n\nThe id is a live session: returned to the browser, never stored or logged, and\nre-requested every time Setup is opened.","operationId":"shuttle_setup_link_api_voicepay_workspaces__workspace_id__shuttle_setup_link_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/shuttle/view-link":{"get":{"tags":["voicepay"],"summary":"Shuttle View Link","description":"A fresh Merchant View deep link, for the console to embed with shuttle.js.\n\nOpen to any workspace member (the first VoicePay route that is), so what they may\nDO inside is decided by role, and the role is derived here, never requested.\nThe id is a live session: returned to the browser, never stored, logged or audited.","operationId":"shuttle_view_link_api_voicepay_workspaces__workspace_id__shuttle_view_link_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"env","in":"query","required":false,"schema":{"type":"string","default":"sandbox","title":"Env"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/golive":{"get":{"tags":["voicepay"],"summary":"Golive Status","description":"Go-live stage for this workspace's merchant. Tenant admin or superuser.","operationId":"golive_status_api_voicepay_workspaces__workspace_id__golive_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/workspaces/{workspace_id}/golive/request":{"post":{"tags":["voicepay"],"summary":"Golive Request","description":"A tenant admin asks for this merchant to go live.\n\nAllowed only when the sandbox was proved by a real capture and the payments\nplatform says it can take payments, both read here, not taken from the request.\nIdempotent: asking twice keeps the first request.","operationId":"golive_request_api_voicepay_workspaces__workspace_id__golive_request_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voicepay/golive/requests":{"get":{"tags":["voicepay"],"summary":"Golive Queue","description":"Superuser: merchants waiting for a go-live decision, oldest first.","operationId":"golive_queue_api_voicepay_golive_requests_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/voicepay/workspaces/{workspace_id}/golive/approve":{"post":{"tags":["voicepay"],"summary":"Golive Approve","description":"Superuser approves a requested go-live: records the approval, creates the live\nmerchant row, and asks VoicePay to create the live instance.\n\nThe approval is a person's decision and is recorded first. If the instance\ncannot be created (for example no live Application key is stored yet) the\napproval stands and this is simply called again: every step is idempotent.","operationId":"golive_approve_api_voicepay_workspaces__workspace_id__golive_approve_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/metrics":{"get":{"tags":["metrics"],"summary":"Metrics","description":"Return Prometheus-formatted metrics (auth: X-API-Key or Bearer).\n\nThe response format is content-negotiated from the ``Accept`` header.\nThat matters for more than politeness: trace exemplars on the latency\nhistogram (see ``app/request_metrics.py``) exist ONLY in the OpenMetrics\nexposition format. ``generate_latest`` emits the older Prometheus text\nformat, which silently drops them — the metrics still scrape fine, the\nmetric-to-trace pivot in Grafana just never appears.\n\nGrafana Alloy and Prometheus both send an Accept header requesting\nOpenMetrics, so ``choose_encoder`` returns the exemplar-capable encoder for\nreal scrapers and falls back to plain text for a browser or curl.","operationId":"metrics_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"APIKeyHeader":[]},{"HTTPBearer":[]}]}},"/api/admin/invite-user":{"post":{"tags":["admin"],"summary":"Invite User","description":"Send a Supabase Auth invitation email (superadmin only).\n\nUses the service-role client's admin API. Returns the created auth user id\non success; surfaces a 400 with the underlying message on failure so the\nfrontend can show it (the old frontend-side call swallowed errors silently).","operationId":"invite_user_api_admin_invite_user_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteUserRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Invite User Api Admin Invite User Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/workspaces/{workspace_id}/integrations/{integration_type}":{"put":{"tags":["credentials"],"summary":"Save Integration","operationId":"save_integration_api_workspaces__workspace_id__integrations__integration_type__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"integration_type","in":"path","required":true,"schema":{"type":"string","title":"Integration Type"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationSaveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Save Integration Api Workspaces  Workspace Id  Integrations  Integration Type  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workspaces/retell-key/test":{"post":{"tags":["credentials"],"summary":"Test Retell Key","operationId":"test_retell_key_api_workspaces_retell_key_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetellKeyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Test Retell Key Api Workspaces Retell Key Test Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/workspaces/{workspace_id}/retell-key":{"put":{"tags":["credentials"],"summary":"Save Retell Key","operationId":"save_retell_key_api_workspaces__workspace_id__retell_key_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetellKeyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Save Retell Key Api Workspaces  Workspace Id  Retell Key Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/workspaces/{workspace_id}/voice-stacks":{"get":{"tags":["voice-stacks"],"summary":"Get Voice Stacks","operationId":"get_voice_stacks_api_workspaces__workspace_id__voice_stacks_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Voice Stacks Api Workspaces  Workspace Id  Voice Stacks Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["voice-stacks"],"summary":"Save Voice Stacks","operationId":"save_voice_stacks_api_workspaces__workspace_id__voice_stacks_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceStacksRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Save Voice Stacks Api Workspaces  Workspace Id  Voice Stacks Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/client-onboarding/workspace-requests":{"post":{"tags":["client-onboarding"],"summary":"Receive Workspace Request","description":"The signed webhook. ``read_signed_body`` has already refused anything unsigned.","operationId":"receive_workspace_request_api_client_onboarding_workspace_requests_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/client-onboarding/requests":{"get":{"tags":["client-onboarding"],"summary":"List Requests","description":"What has arrived, newest first. No payloads: they hold personal data.","operationId":"list_requests_api_client_onboarding_requests_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"enum":["received","provisioned","updated","rejected","failed"],"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Requests Api Client Onboarding Requests Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/client-onboarding/requests/{delivery_id}":{"get":{"tags":["client-onboarding"],"summary":"Get Request","description":"One record in full, payload included (personal data: superusers only).","operationId":"get_request_api_client_onboarding_requests__delivery_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"delivery_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Delivery Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Request Api Client Onboarding Requests  Delivery Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AddServerRequest":{"properties":{"url":{"type":"string","maxLength":2048,"minLength":4,"title":"Url"},"display_name":{"type":"string","maxLength":100,"minLength":1,"title":"Display Name"},"bearer_token":{"anyOf":[{"type":"string","maxLength":8192},{"type":"null"}],"title":"Bearer Token"}},"type":"object","required":["url","display_name"],"title":"AddServerRequest"},"AgentFields":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"system_prompt":{"anyOf":[{"type":"string","maxLength":30000},{"type":"null"}],"title":"System Prompt"},"begin_message":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Begin Message"},"language":{"anyOf":[{"type":"string","maxLength":10,"minLength":2},{"type":"null"}],"title":"Language"},"llm_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Llm Model"},"llm_temperature":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Llm Temperature"},"llm_max_tokens":{"anyOf":[{"type":"integer","maximum":4096.0,"minimum":50.0},{"type":"null"}],"title":"Llm Max Tokens"},"stt_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stt Model"},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id"},"max_call_duration_seconds":{"anyOf":[{"type":"integer","maximum":3600.0,"minimum":60.0},{"type":"null"}],"title":"Max Call Duration Seconds"},"end_call_after_silence_ms":{"anyOf":[{"type":"integer","maximum":600000.0,"minimum":10000.0},{"type":"null"}],"title":"End Call After Silence Ms"},"enable_post_call_analysis":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Post Call Analysis"},"tools":{"anyOf":[{"items":{"$ref":"#/components/schemas/ToolSpec"},"type":"array","maxItems":30},{"type":"null"}],"title":"Tools"},"options":{"anyOf":[{"$ref":"#/components/schemas/RuntimeOptions"},{"type":"null"}]}},"type":"object","title":"AgentFields"},"Body_import_contacts_api_campaigns__workspace_id___campaign_id__import_contacts_post":{"properties":{"file":{"type":"string","format":"binary","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_contacts_api_campaigns__workspace_id___campaign_id__import_contacts_post"},"Body_import_dnc_api_dnc__workspace_id__import_post":{"properties":{"file":{"type":"string","format":"binary","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_dnc_api_dnc__workspace_id__import_post"},"Body_ingest_documents_knowledge_ingest_post":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"chunk_size":{"type":"integer","title":"Chunk Size","default":1000},"chunk_overlap":{"type":"integer","title":"Chunk Overlap","default":100},"use_llm_context":{"type":"boolean","title":"Use Llm Context","default":false},"llm_model":{"type":"string","title":"Llm Model","default":"gpt-4o-mini"},"context_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context Prompt"},"files":{"items":{"type":"string","format":"binary","contentMediaType":"application/octet-stream"},"type":"array","title":"Files"}},"type":"object","required":["workspace_id","files"],"title":"Body_ingest_documents_knowledge_ingest_post"},"CheckBody":{"properties":{"phone":{"type":"string","title":"Phone"},"scope":{"type":"string","enum":["workspace","campaign","voicepay_merchant","workflow"],"title":"Scope","default":"workspace"},"scope_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope Id"},"contact_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Timezone"},"contact_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact State"},"after_hours_request":{"type":"boolean","title":"After Hours Request","default":false}},"type":"object","required":["phone"],"title":"CheckBody"},"CommitmentBody":{"properties":{"text":{"type":"string","maxLength":300,"minLength":1,"title":"Text"},"due_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Due At"},"owner":{"type":"string","enum":["agent","customer"],"title":"Owner","default":"agent"},"source_call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Call Id"}},"type":"object","required":["text"],"title":"CommitmentBody"},"CommitmentStatusBody":{"properties":{"status":{"type":"string","enum":["open","resolved","cancelled"],"title":"Status"}},"type":"object","required":["status"],"title":"CommitmentStatusBody"},"ConsentBody":{"properties":{"consent_state":{"type":"string","enum":["unknown","consented","transactional_ok","revoked"],"title":"Consent State"}},"type":"object","required":["consent_state"],"title":"ConsentBody"},"CreateAgentRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"system_prompt":{"anyOf":[{"type":"string","maxLength":30000},{"type":"null"}],"title":"System Prompt"},"begin_message":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Begin Message"},"language":{"anyOf":[{"type":"string","maxLength":10,"minLength":2},{"type":"null"}],"title":"Language"},"llm_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Llm Model"},"llm_temperature":{"anyOf":[{"type":"number","maximum":1.0,"minimum":0.0},{"type":"null"}],"title":"Llm Temperature"},"llm_max_tokens":{"anyOf":[{"type":"integer","maximum":4096.0,"minimum":50.0},{"type":"null"}],"title":"Llm Max Tokens"},"stt_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stt Model"},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id"},"max_call_duration_seconds":{"anyOf":[{"type":"integer","maximum":3600.0,"minimum":60.0},{"type":"null"}],"title":"Max Call Duration Seconds"},"end_call_after_silence_ms":{"anyOf":[{"type":"integer","maximum":600000.0,"minimum":10000.0},{"type":"null"}],"title":"End Call After Silence Ms"},"enable_post_call_analysis":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enable Post Call Analysis"},"tools":{"anyOf":[{"items":{"$ref":"#/components/schemas/ToolSpec"},"type":"array","maxItems":30},{"type":"null"}],"title":"Tools"},"options":{"anyOf":[{"$ref":"#/components/schemas/RuntimeOptions"},{"type":"null"}]}},"type":"object","required":["name"],"title":"CreateAgentRequest"},"CreateChatAgentRequest":{"properties":{"voice_agent_id":{"type":"string","minLength":1,"title":"Voice Agent Id"},"webhook_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Webhook Url"}},"type":"object","required":["voice_agent_id"],"title":"CreateChatAgentRequest"},"EdgeEndpoint":{"properties":{"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"target":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target"}},"additionalProperties":false,"type":"object","title":"EdgeEndpoint"},"EdgeTypeDef":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"properties":{"items":{"$ref":"#/components/schemas/PropertyDef"},"type":"array","title":"Properties"},"source_targets":{"items":{"$ref":"#/components/schemas/EdgeEndpoint"},"type":"array","title":"Source Targets"}},"additionalProperties":false,"type":"object","required":["name","description"],"title":"EdgeTypeDef"},"EntityTypeDef":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"properties":{"items":{"$ref":"#/components/schemas/PropertyDef"},"type":"array","title":"Properties"}},"additionalProperties":false,"type":"object","required":["name","description"],"title":"EntityTypeDef"},"FieldMappingsUpdate":{"properties":{"field_mappings":{"additionalProperties":{"additionalProperties":{"type":"string"},"type":"object"},"type":"object","title":"Field Mappings"}},"type":"object","required":["field_mappings"],"title":"FieldMappingsUpdate","description":"Request body for updating field mappings."},"GraphRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"node_limit":{"type":"integer","title":"Node Limit","default":200},"edge_limit":{"type":"integer","title":"Edge Limit","default":400}},"type":"object","required":["workspace_id"],"title":"GraphRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IntegrationSaveRequest":{"properties":{"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"credentials":{"additionalProperties":true,"type":"object","title":"Credentials"},"connect":{"type":"boolean","title":"Connect","default":false}},"type":"object","title":"IntegrationSaveRequest"},"InviteUserRequest":{"properties":{"email":{"type":"string","title":"Email"},"redirect_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redirect To"},"data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Data"}},"type":"object","required":["email"],"title":"InviteUserRequest"},"KnowledgeEntry":{"properties":{"title":{"type":"string","title":"Title"},"content":{"type":"string","title":"Content"},"entry_type":{"type":"string","title":"Entry Type"},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags"},"zep_episode_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Zep Episode Id"}},"type":"object","required":["title","content","entry_type"],"title":"KnowledgeEntry"},"OffboardBody":{"properties":{"confirm_workspace_id":{"type":"string","title":"Confirm Workspace Id"},"grace_days":{"type":"integer","maximum":365.0,"minimum":0.0,"title":"Grace Days","default":30}},"type":"object","required":["confirm_workspace_id"],"title":"OffboardBody"},"OntologyDefinition":{"properties":{"entity_types":{"items":{"$ref":"#/components/schemas/EntityTypeDef"},"type":"array","title":"Entity Types"},"edge_types":{"items":{"$ref":"#/components/schemas/EdgeTypeDef"},"type":"array","title":"Edge Types"}},"additionalProperties":false,"type":"object","title":"OntologyDefinition"},"OverrideBody":{"properties":{"field_name":{"type":"string","maxLength":100,"minLength":1,"title":"Field Name"},"value":{"title":"Value"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"effective_to":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Effective To"}},"type":"object","required":["field_name","value"],"title":"OverrideBody"},"PhoneSyncRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"}},"type":"object","required":["workspace_id"],"title":"PhoneSyncRequest"},"PhoneSyncResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"stats":{"$ref":"#/components/schemas/PhoneSyncStats"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","stats","message"],"title":"PhoneSyncResponse"},"PhoneSyncStats":{"properties":{"total":{"type":"integer","title":"Total","default":0},"synced":{"type":"integer","title":"Synced","default":0},"skipped":{"type":"integer","title":"Skipped","default":0},"errors":{"type":"integer","title":"Errors","default":0}},"type":"object","title":"PhoneSyncStats"},"PropertyDef":{"properties":{"name":{"type":"string","title":"Name"},"type":{"type":"string","enum":["text","int","float","boolean"],"title":"Type","default":"text"},"description":{"type":"string","title":"Description"},"protected":{"type":"boolean","title":"Protected","default":false}},"additionalProperties":false,"type":"object","required":["name","description"],"title":"PropertyDef"},"RedactBody":{"properties":{"call_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Call Ids"}},"type":"object","title":"RedactBody"},"ReplyRequest":{"properties":{"body":{"type":"string","maxLength":1600,"minLength":1,"title":"Body"}},"type":"object","required":["body"],"title":"ReplyRequest"},"RetellKeyRequest":{"properties":{"api_key":{"type":"string","minLength":1,"title":"Api Key"},"retell_workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Retell Workspace Id"}},"type":"object","required":["api_key"],"title":"RetellKeyRequest"},"RetentionBody":{"properties":{"retention_deadline":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Retention Deadline"}},"type":"object","title":"RetentionBody"},"ReviewRequest":{"properties":{"decision":{"type":"string","enum":["approve","reject"],"title":"Decision"},"note":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Note"}},"type":"object","required":["decision"],"title":"ReviewRequest"},"RulesBody":{"properties":{"scope":{"type":"string","enum":["workspace","campaign","voicepay_merchant","workflow"],"title":"Scope","default":"workspace"},"scope_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scope Id"},"calling_days":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Calling Days"},"start_time":{"type":"string","pattern":"^([01][0-9]|2[0-3]):[0-5][0-9]$","title":"Start Time","default":"08:00"},"end_time":{"type":"string","pattern":"^([01][0-9]|2[0-3]):[0-5][0-9]$","title":"End Time","default":"21:00"},"timezone_mode":{"type":"string","enum":["recipient","fixed"],"title":"Timezone Mode","default":"recipient"},"fixed_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fixed Timezone"},"test_mode":{"type":"boolean","title":"Test Mode","default":false},"allowed_numbers":{"items":{"type":"string"},"type":"array","maxItems":200,"title":"Allowed Numbers"},"after_hours_exception":{"type":"boolean","title":"After Hours Exception","default":false},"state_overrides":{"items":{"$ref":"#/components/schemas/StateOverrideBody"},"type":"array","maxItems":60,"title":"State Overrides"}},"type":"object","title":"RulesBody"},"RuntimeOptions":{"properties":{"noise_cancellation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Noise Cancellation"},"allow_interruptions":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Allow Interruptions"},"min_interruption_duration":{"anyOf":[{"type":"number","maximum":2.0,"minimum":0.1},{"type":"null"}],"title":"Min Interruption Duration"},"false_interruption_timeout":{"anyOf":[{"type":"number","maximum":5.0,"minimum":0.5},{"type":"null"}],"title":"False Interruption Timeout"},"eager_eot_threshold":{"anyOf":[{"type":"number","maximum":0.9,"minimum":0.3},{"type":"null"}],"title":"Eager Eot Threshold"},"eot_threshold":{"anyOf":[{"type":"number","maximum":0.9,"minimum":0.5},{"type":"null"}],"title":"Eot Threshold"},"eot_timeout_ms":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":500.0},{"type":"null"}],"title":"Eot Timeout Ms"},"keyterms":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":50},{"type":"null"}],"title":"Keyterms"},"fallback_message":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Fallback Message"},"analysis_purpose":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Analysis Purpose"}},"type":"object","title":"RuntimeOptions","description":"Worker options (``runtime_config`` keys). ``null`` restores the worker default."},"SchemaBody":{"properties":{"definition":{"$ref":"#/components/schemas/OntologyDefinition"},"preset":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preset"}},"type":"object","required":["definition"],"title":"SchemaBody"},"SearchRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"query":{"type":"string","title":"Query"},"limit":{"type":"integer","title":"Limit","default":5}},"type":"object","required":["workspace_id","query"],"title":"SearchRequest"},"SendEmailRequest":{"properties":{"to":{"type":"string","title":"To"},"subject":{"type":"string","title":"Subject"},"body":{"type":"string","title":"Body"},"html_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Html Body"},"cc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cc"},"reply_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reply To"},"from_email":{"type":"string","title":"From Email"},"from_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From Name"},"smtp_host":{"type":"string","title":"Smtp Host"},"smtp_port":{"type":"string","title":"Smtp Port"},"smtp_username":{"type":"string","title":"Smtp Username"},"smtp_password":{"type":"string","title":"Smtp Password"}},"type":"object","required":["to","subject","body","from_email","smtp_host","smtp_port","smtp_username","smtp_password"],"title":"SendEmailRequest"},"SendTemplateEmailRequest":{"properties":{"to":{"type":"string","title":"To"},"template_name":{"type":"string","title":"Template Name"},"subject":{"type":"string","title":"Subject"},"variables":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Variables"},"from_email":{"type":"string","title":"From Email"},"from_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From Name"},"smtp_host":{"type":"string","title":"Smtp Host"},"smtp_port":{"type":"string","title":"Smtp Port"},"smtp_username":{"type":"string","title":"Smtp Username"},"smtp_password":{"type":"string","title":"Smtp Password"}},"type":"object","required":["to","template_name","subject","from_email","smtp_host","smtp_port","smtp_username","smtp_password"],"title":"SendTemplateEmailRequest"},"StateOverrideBody":{"properties":{"state":{"type":"string","title":"State"},"start_time":{"type":"string","pattern":"^([01][0-9]|2[0-3]):[0-5][0-9]$","title":"Start Time"},"end_time":{"type":"string","pattern":"^([01][0-9]|2[0-3]):[0-5][0-9]$","title":"End Time"},"days":{"items":{"type":"string"},"type":"array","title":"Days"}},"type":"object","required":["state","start_time","end_time"],"title":"StateOverrideBody"},"SyncNowRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"sync_types":{"items":{"type":"string"},"type":"array","title":"Sync Types","default":["agents","calls","phones"]},"full":{"type":"boolean","title":"Full","default":false}},"type":"object","required":["workspace_id"],"title":"SyncNowRequest"},"SyncRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"entries":{"items":{"$ref":"#/components/schemas/KnowledgeEntry"},"type":"array","title":"Entries"},"replace_existing":{"type":"boolean","title":"Replace Existing","default":false}},"type":"object","required":["workspace_id","entries"],"title":"SyncRequest"},"SyncScheduleRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"sync_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sync Enabled"},"sync_interval_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sync Interval Minutes"}},"type":"object","required":["workspace_id"],"title":"SyncScheduleRequest"},"ToolBinding":{"properties":{"kind":{"type":"string","enum":["workflow","builtin"],"title":"Kind"},"webhook_key":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Webhook Key"},"id":{"anyOf":[{"type":"string","const":"end_call"},{"type":"null"}],"title":"Id"}},"type":"object","required":["kind"],"title":"ToolBinding"},"ToolSpec":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","maxLength":1000,"title":"Description","default":""},"parameters":{"additionalProperties":true,"type":"object","title":"Parameters"},"speak_during_execution":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Speak During Execution"},"binding":{"$ref":"#/components/schemas/ToolBinding"}},"type":"object","required":["name","binding"],"title":"ToolSpec"},"UpdateNumberRequest":{"properties":{"sms_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sms Enabled"},"sms_chat_agent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sms Chat Agent Id"}},"type":"object","title":"UpdateNumberRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VoiceStacksRequest":{"properties":{"voice_stacks":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Voice Stacks"}},"type":"object","title":"VoiceStacksRequest"},"WorkspaceSyncRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"}},"type":"object","required":["workspace_id"],"title":"WorkspaceSyncRequest"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"},"APIKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"}}}}