{"openapi":"3.1.0","info":{"title":"API Reference","version":"1.0.0"},"paths":{"/v1/orgs/{org_id}/workspaces/{workspace_id}/deployments":{"post":{"operationId":"create-deployment","summary":"Create Deployment","description":"Create a new deployment that connects an agent to a phone number for inbound calls.\n\nThe deployment is created in `active` status and immediately begins accepting calls. Optionally configure an `inbound_config` schedule to restrict calls to specific hours and days.","tags":["v1-deployments"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeploymentDetails"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDeployment"}}}}},"get":{"operationId":"list-deployments","summary":"List Deployments","description":"List all deployments in the workspace with optional filtering, sorting, and pagination.","tags":["v1-deployments"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"offset","in":"query","description":"Number of records to skip","required":false,"schema":{"type":"integer","default":0}},{"name":"limit","in":"query","description":"Number of records to return (max 100)","required":false,"schema":{"type":"integer","default":10}},{"name":"sort_by","in":"query","description":"Field to sort by","required":false,"schema":{"type":["string","null"]}},{"name":"sort_order","in":"query","description":"Sort order (asc or desc)","required":false,"schema":{"type":["string","null"]}},{"name":"search","in":"query","description":"Search query string","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedDeploymentRecord"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/deployments/{deployment_id}":{"get":{"operationId":"get-deployment","summary":"Get Deployment","description":"Get full details of a deployment including its agent version, connection config, inbound schedule, and current status.","tags":["v1-deployments"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeploymentDetails"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"operationId":"update-deployment","summary":"Update Deployment","description":"Update a deployment's configuration. You can update the name, description, agent version, connection config, and inbound schedule. Only include fields you want to change.","tags":["v1-deployments"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeploymentDetails"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDeployment"}}}}},"delete":{"operationId":"delete-deployment","summary":"Delete Deployment","description":"Permanently delete a deployment. This immediately stops all inbound call handling for the associated phone numbers.","tags":["v1-deployments"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"description":"Any type"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/deployments/{deployment_id}/status":{"put":{"operationId":"update-deployment-status","summary":"Update Deployment Status","description":"Pause or resume a deployment.\n\n| Action | Effect |\n|---|---|\n| `pause` | Stop accepting inbound calls |\n| `resume` | Start accepting inbound calls again |","tags":["v1-deployments"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeploymentDetails"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDeploymentStatus"}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/deployments/{deployment_id}/cohorts/upload":{"post":{"operationId":"upload-deployment-cohort","summary":"Upload Cohort","description":"Upload a cohort of users for a deployment. When a known user calls in, the agent receives their personalized variables (name, balance, language, etc.) for a tailored conversation.\n\nUpload as multipart form-data with three fields:\n- `name` — Cohort name (1–50 characters)\n- `cohort_file` — CSV file with a header row and user data\n- `cohort_transformation_file` — JSON file that maps CSV columns to phone numbers and agent variables","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Cohort name (1-50 characters)"},"cohort_file":{"type":"string","format":"binary","description":"CSV file containing the cohort data"},"cohort_transformation_file":{"type":"string","format":"binary","description":"JSON file defining how CSV columns map to agent variables"}},"required":["name","cohort_file","cohort_transformation_file"]}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/deployments/{deployment_id}/cohorts":{"post":{"operationId":"create-deployment-cohort","summary":"Create Cohort","description":"Create a cohort from a pre-signed URL source with a transformation configuration. Use this when your CSV is already hosted and accessible via a URL.","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCohort"}}}}},"get":{"operationId":"list-deployment-cohorts","summary":"List Cohorts","description":"List all cohorts belonging to a deployment with pagination, sorting, and search.","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"offset","in":"query","description":"Number of records to skip","required":false,"schema":{"type":"integer","default":0}},{"name":"limit","in":"query","description":"Number of records to return (max 100)","required":false,"schema":{"type":"integer","default":10}},{"name":"sort_by","in":"query","description":"Field to sort by","required":false,"schema":{"type":["string","null"]}},{"name":"sort_order","in":"query","description":"Sort order (asc or desc)","required":false,"schema":{"type":["string","null"]}},{"name":"search","in":"query","description":"Search query string","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedCohortMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/deployments/{deployment_id}/cohorts/{cohort_id}":{"get":{"operationId":"get-deployment-cohort","summary":"Get Cohort","description":"Get metadata for a specific cohort including its processing status and result counts (total records, valid, rejected).","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/deployments/{deployment_id}/cohorts/{cohort_id}/files":{"get":{"operationId":"download-deployment-cohort-file","summary":"Download Cohort File","description":"Download a file associated with a cohort.\n\n**Available file types:**\n- `cohort` — The original uploaded CSV\n- `rejected_records` — CSV of rows that failed validation, with an appended `rejected_reason` column\n- `cohort_transformation` — The JSON transformation config used during processing","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deployment_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"file_type","in":"query","description":"Type of cohort file to download.","required":true,"schema":{"$ref":"#/components/schemas/CohortFileType"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"description":"Any type"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/campaigns":{"post":{"operationId":"create-campaign","summary":"Create Campaign","description":"Create a new campaign that ties an agent to a schedule, rate, and retry policy.\n\nThe campaign will be created in `scheduled` status. It starts automatically when `start_timestamp` is reached.","tags":["v1-campaigns"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaign"}}}}},"get":{"operationId":"list-campaigns","summary":"List Campaigns","description":"List campaigns in the workspace with optional filtering by status, search, sorting, and pagination.","tags":["v1-campaigns"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_status","in":"query","required":false,"schema":{"oneOf":[{"$ref":"#/components/schemas/CampaignStatus"},{"type":"null"}]}},{"name":"offset","in":"query","description":"Number of records to skip","required":false,"schema":{"type":"integer","default":0}},{"name":"limit","in":"query","description":"Number of records to return (max 100)","required":false,"schema":{"type":"integer","default":10}},{"name":"sort_by","in":"query","description":"Field to sort by","required":false,"schema":{"type":["string","null"],"default":"created_at"}},{"name":"sort_order","in":"query","description":"Sort order (asc or desc)","required":false,"schema":{"type":["string","null"],"default":"desc"}},{"name":"search","in":"query","description":"Search query string","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedCampaignMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/campaigns/{campaign_id}":{"get":{"operationId":"get-campaign","summary":"Get Campaign","description":"Get full details of a campaign including its agent configuration, schedule, and retry policy.","tags":["v1-campaigns"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"patch":{"operationId":"update-campaign","summary":"Update Campaign","description":"Update a campaign's configuration. Only allowed when the campaign is in `paused` or `scheduled` status.\n\nYou can update the name, description, agent configuration, end timestamp, and allowed schedule.","tags":["v1-campaigns"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaign"}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/campaigns/{campaign_id}/status":{"put":{"operationId":"update-campaign-status","summary":"Update Campaign Status","description":"Change the status of a campaign by sending a `pause`, `resume`, or `cancel` action.","tags":["v1-campaigns"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignStatus"}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/campaigns/{campaign_id}/cohorts/upload":{"post":{"operationId":"upload-cohort","summary":"Upload Cohort","description":"Upload a cohort as multipart form-data with three fields:\n\n- `name` — Cohort name (1–50 characters)\n- `cohort_file` — CSV file with a header row and at least one data row\n- `cohort_transformation_file` — JSON file that maps CSV columns to phone numbers and agent variables","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"Name of the resource"},"cohort_file":{"type":"string","format":"binary","description":"CSV file containing the cohort data"},"cohort_transformation_file":{"type":"string","format":"binary","description":"JSON file defining how CSV columns map to agent variables"}},"required":["name","cohort_file","cohort_transformation_file"]}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/campaigns/{campaign_id}/cohorts":{"post":{"operationId":"create-cohort","summary":"Create Cohort","description":"Create a cohort from a pre-signed URL source with a transformation configuration.","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCohort"}}}}},"get":{"operationId":"list-cohorts","summary":"List Cohorts","description":"List all cohorts belonging to a campaign with pagination, sorting, and search.","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"offset","in":"query","description":"Number of records to skip","required":false,"schema":{"type":"integer","default":0}},{"name":"limit","in":"query","description":"Number of records to return (max 100)","required":false,"schema":{"type":"integer","default":10}},{"name":"sort_by","in":"query","description":"Field to sort by","required":false,"schema":{"type":["string","null"],"default":"created_at"}},{"name":"sort_order","in":"query","description":"Sort order (asc or desc)","required":false,"schema":{"type":["string","null"],"default":"desc"}},{"name":"search","in":"query","description":"Search query string","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedCohortMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/campaigns/{campaign_id}/cohorts/{cohort_id}":{"get":{"operationId":"get-cohort","summary":"Get Cohort","description":"Get metadata for a specific cohort, including its processing status and result counts (total, valid, and rejected records).","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CohortMetadata"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/campaigns/{campaign_id}/cohorts/{cohort_id}/files":{"get":{"operationId":"download-cohort-file","summary":"Download Cohort File","description":"Download a file associated with a cohort.\n\n**Available file types:**\n- `cohort` — The original uploaded CSV\n- `rejected_records` — CSV of rows that failed validation, with an appended `rejected_reason` column\n- `cohort_transformation` — The JSON transformation config used during processing","tags":["v1-cohorts"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"cohort_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"file_type","in":"query","description":"Type of cohort file to download.","required":true,"schema":{"$ref":"#/components/schemas/CohortFileType"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"description":"Any type"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/orgs/{org_id}/workspaces/{workspace_id}/outbounds":{"post":{"operationId":"initiateOutboundApi","summary":"Initiate Outbound Api","tags":["outboundApi"],"parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundRequest"}}}}}},"/analytics/v1/{org_id}/{workspace_id}/{app_id}/attempts":{"get":{"operationId":"getPaginatedAttemptsApi","summary":"Get attempts","description":"Fetch paginated attempts with filtering and sorting options","tags":["external_endpoints"],"parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","description":"Workspace ID","required":true,"schema":{"type":"string"}},{"name":"app_id","in":"path","description":"Agent ID","required":true,"schema":{"type":"string"}},{"name":"sort_by","in":"query","description":"Field to sort by","required":false,"schema":{"type":["string","null"]}},{"name":"sort_order","in":"query","description":"Sort order (asc or desc)","required":false,"schema":{"type":["string","null"]}},{"name":"start_datetime","in":"query","description":"Filter start datetime in UTC (ISO8601)","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"end_datetime","in":"query","description":"Filter end datetime in UTC (ISO8601)","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","description":"Max number of records to return","required":false,"schema":{"type":"integer","default":20}},{"name":"offset","in":"query","description":"Number of records to skip","required":false,"schema":{"type":"integer","default":0}},{"name":"filter_conditions","in":"query","description":"JSON array of filter conditions. Each condition has: id (string), field (from available fields), operator (equals/not_equals/includes/starts_with/ends_with for strings; equals/not_equals/greater_than/less_than for numbers), value. Example: [{\"id\":\"1\",\"field\":\"interaction_id\",\"operator\":\"equals\",\"value\":\"abc123\"}]","required":false,"schema":{"type":["string","null"]}},{"name":"X-API-Key","in":"header","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_ExternalAttemptsAPIResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/analytics/v1/{org_id}/{workspace_id}/{app_id}/interactions":{"get":{"operationId":"getExternalInteractionsApi","summary":"Get interactions","description":"Fetch paginated interactions with filtering and sorting options","tags":["external_endpoints"],"parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","description":"Workspace ID","required":true,"schema":{"type":"string"}},{"name":"app_id","in":"path","description":"Agent ID","required":true,"schema":{"type":"string"}},{"name":"sort_by","in":"query","description":"Field to sort by","required":false,"schema":{"type":["string","null"]}},{"name":"sort_order","in":"query","description":"Sort order (asc or desc)","required":false,"schema":{"type":["string","null"]}},{"name":"start_datetime","in":"query","description":"Filter start datetime in UTC (ISO8601)","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"end_datetime","in":"query","description":"Filter end datetime in UTC (ISO8601)","required":true,"schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","description":"Max number of records to return","required":false,"schema":{"type":"integer","default":20}},{"name":"offset","in":"query","description":"Number of records to skip","required":false,"schema":{"type":"integer","default":0}},{"name":"filter_conditions","in":"query","description":"JSON array of filter conditions. Each condition has: id (string), field (from available fields), operator (equals/not_equals/includes/starts_with/ends_with for strings; equals/not_equals/greater_than/less_than for numbers), value. Example: [{\"id\":\"1\",\"field\":\"interaction_id\",\"operator\":\"equals\",\"value\":\"abc123\"}]","required":false,"schema":{"type":["string","null"]}},{"name":"X-API-Key","in":"header","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResponse_ExternalInteractionsAPIResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/analytics/v1/{org_id}/{workspace_id}/{app_id}/recordings/{interaction_id}":{"get":{"operationId":"getRecordingsApi","summary":"Get recordings","description":"Fetch recording for a specific interaction","tags":["external_endpoints"],"parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","description":"Workspace ID","required":true,"schema":{"type":"string"}},{"name":"app_id","in":"path","description":"Agent ID","required":true,"schema":{"type":"string"}},{"name":"interaction_id","in":"path","description":"Interaction ID","required":true,"schema":{"type":"string"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/external_endpoints_getRecordingsApi_Response_200"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/analytics/v1/{org_id}/{workspace_id}/{app_id}/transcripts/{interaction_id}":{"get":{"operationId":"getTranscriptsApi","summary":"Get transcripts","description":"Fetch transcript for a specific interaction","tags":["external_endpoints"],"parameters":[{"name":"org_id","in":"path","description":"Organization ID","required":true,"schema":{"type":"string"}},{"name":"workspace_id","in":"path","description":"Workspace ID","required":true,"schema":{"type":"string"}},{"name":"app_id","in":"path","description":"Agent ID","required":true,"schema":{"type":"string"}},{"name":"interaction_id","in":"path","description":"Interaction ID","required":true,"schema":{"type":"string"}},{"name":"X-API-Key","in":"header","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/external_endpoints_getTranscriptsApi_Response_200"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth":{"post":{"operationId":"obtainAJwtAccessToken","summary":"Obtain a JWT Access Token","description":"If using the Client Credentials method, Samvaad will call this endpoint to exchange its **Client ID** and **Client Secret** for a short-lived JWT Bearer token. \n\nSamvaad will authenticate to this endpoint using **HTTP Basic Authentication**. The returned access token will be cached and used in the `Authorization` header for all subsequent API calls until it expires.\n\n**Note:** This endpoint is not needed if you opt for the static API Key authentication method.\n","tags":["keyManagement"],"parameters":[{"name":"Authorization","in":"header","description":"HTTP Basic authentication for the `/auth` endpoint, using the **Client ID** as the username and the **Client Secret** as the password.","required":true,"schema":{"type":"string"}},{"name":"x-request-id","in":"header","description":"A unique identifier for this specific API call, generated by the client (Samvaad).","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"x-trace-id","in":"header","description":"An identifier to trace a single request across multiple services.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-request-timestamp","in":"header","description":"The ISO 8601 timestamp of when the client sent the request.","required":true,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"Authentication successful. Returns a JWT access token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthSuccessResponse"}}}},"400":{"description":"Bad Request. The request is syntactically malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized. The provided Client ID or Client Secret is invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity. The request is well-formed but contains semantic errors (e.g., wrong grant_type).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error. An unexpected error occurred on the authentication server.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"description":"The request body must specify the grant type as 'client_credentials'.","content":{"application/json":{"schema":{"type":"object","properties":{"grant_type":{"type":"string","description":"The OAuth2 grant type. Must be `client_credentials`."}},"required":["grant_type"]}}}}}},"/decrypt-key":{"post":{"operationId":"decryptAnEncryptedDataEncryptionKeyDek","summary":"Decrypt an Encrypted Data Encryption Key (DEK)","description":"Samvaad calls this endpoint to decrypt an Encrypted Data Encryption Key (EDEK) using the corresponding master key in your Key Management System (KMS) or HSM.\n\nThe plaintext key is then cached securely in memory by Samvaad for a short, configurable duration to perform data encryption and decryption operations. The `key_alias` is used to identify which master key should be used for decryption.\n","tags":["keyManagement"],"parameters":[{"name":"Authorization","in":"header","description":"A token sent in the `Authorization` header.\n\nThis can be one of two types:\n1. A short-lived **JWT** obtained from the `/auth` endpoint.\n2. A long-lived, static **API Key** provided during setup.\n\nIn both cases, the header format is `Authorization: Bearer <token>`.\n","required":true,"schema":{"type":"string"}},{"name":"x-request-id","in":"header","description":"A unique identifier for this specific API call, generated by the client (Samvaad).","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"x-trace-id","in":"header","description":"An identifier to trace a single request across multiple services.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-request-timestamp","in":"header","description":"The ISO 8601 timestamp of when the client sent the request.","required":true,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"The DEK was successfully decrypted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DecryptKeySuccessResponse"}}}},"400":{"description":"Bad Request. The request body is syntactically malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized. The Bearer token is missing, invalid, or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found. The specified `key_alias` does not exist or is not active in your KMS.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity. The request is well-formed but contains semantic errors.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error. An unexpected error occurred within your key management infrastructure (e.g., KMS, HSM).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"description":"The request containing the key alias and the encrypted key data.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DecryptKeyRequest"}},"required":["data"]}}}}}},"/rotate-key":{"post":{"operationId":"generateANewDataEncryptionKeyDek","summary":"Generate a New Data Encryption Key (DEK)","description":"Samvaad calls this endpoint to generate a new Data Encryption Key (DEK). This is part of the key rotation strategy. \nYou must return both the new plaintext DEK and its encrypted form (the EDEK) along with the key-alias used for encyption. Samvaad will use this new key for all subsequent encryption operations for the associated data.\n","tags":["keyManagement"],"parameters":[{"name":"Authorization","in":"header","description":"A token sent in the `Authorization` header.\n\nThis can be one of two types:\n1. A short-lived **JWT** obtained from the `/auth` endpoint.\n2. A long-lived, static **API Key** provided during setup.\n\nIn both cases, the header format is `Authorization: Bearer <token>`.\n","required":true,"schema":{"type":"string"}},{"name":"x-request-id","in":"header","description":"A unique identifier for this specific API call, generated by the client (Samvaad).","required":true,"schema":{"type":"string","format":"uuid"}},{"name":"x-trace-id","in":"header","description":"An identifier to trace a single request across multiple services.","required":false,"schema":{"type":"string","format":"uuid"}},{"name":"x-request-timestamp","in":"header","description":"The ISO 8601 timestamp of when the client sent the request.","required":true,"schema":{"type":"string","format":"date-time"}}],"responses":{"200":{"description":"New DEK successfully generated. Returns the new encrypted and plaintext DEK.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RotateKeySuccessResponse"}}}},"400":{"description":"Bad Request. The request body is syntactically malformed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized. The Bearer token is missing, invalid, or expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"422":{"description":"Unprocessable Entity. The request is well-formed but contains semantic errors.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error. An unexpected error occurred within your key management infrastructure during key generation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"servers":[{"url":"https://apps.sarvam.ai/api/app-authoring","description":"Production"},{"url":"https://apps.sarvam.ai/api/scheduling","description":"Production"},{"url":"https://apps.sarvam.ai/api/outbounds","description":"Production"},{"url":"https://apps.sarvam.ai/api","description":"Production"},{"url":"https://api.customer.com/sarvam/byok/v1","description":"Production"}],"components":{"schemas":{"ConnectionConfig":{"type":"object","properties":{"connection_id":{"type":"string"},"agent_phone_number":{"type":"string"}},"required":["connection_id","agent_phone_number"],"title":"ConnectionConfig"},"DaysOfWeek":{"type":"string","enum":["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],"description":"Days of the week for scheduling.","title":"DaysOfWeek"},"InboundConfig":{"type":"object","properties":{"start_time":{"type":"string","format":"time","description":"Start time in HH:MM 24-hour format"},"end_time":{"type":"string","format":"time","description":"End time in HH:MM 24-hour format"},"allowed_days":{"type":"array","items":{"$ref":"#/components/schemas/DaysOfWeek"},"description":"Days of the week when inbound calls are accepted"},"timezone":{"type":"string","format":"zoneinfo","default":"Asia/Kolkata","description":"IANA timezone, e.g. 'Asia/Kolkata', 'UTC', 'America/New_York'"}},"required":["start_time","end_time","allowed_days"],"description":"Inbound call configuration including schedule, connection, and call handling settings.","title":"InboundConfig"},"CreateDeployment":{"type":"object","properties":{"name":{"type":"string","description":"Deployment name. Alphanumeric, hyphens, underscores and spaces allowed. Max 50 characters."},"description":{"type":["string","null"],"description":"Optional deployment description. Max 150 characters."},"app_id":{"type":"string","description":"ID of the agent"},"app_version":{"type":"integer","description":"Version of the agent to deploy"},"connection_configs":{"type":"array","items":{"$ref":"#/components/schemas/ConnectionConfig"},"description":"Telephony connection configurations with phone numbers"},"inbound_config":{"oneOf":[{"$ref":"#/components/schemas/InboundConfig"},{"type":"null"}],"description":"Optional inbound call schedule configuration"}},"required":["name","app_id","app_version","connection_configs"],"description":"Request body for creating a new deployment.","title":"CreateDeployment"},"DeploymentStatus":{"type":"string","enum":["active","paused"],"description":"Deployment lifecycle status.","title":"DeploymentStatus"},"ChannelDirection":{"type":"string","enum":["inbound","outbound","inbound_outbound"],"title":"ChannelDirection"},"DeploymentDetails":{"type":"object","properties":{"name":{"type":["string","null"],"description":"Name of the deployment"},"deployment_id":{"type":"string","description":"Unique identifier for the deployment"},"status":{"oneOf":[{"$ref":"#/components/schemas/DeploymentStatus"},{"type":"null"}],"description":"Current status of the deployment"},"description":{"type":["string","null"],"description":"Optional description"},"app_id":{"type":"string","description":"ID of the agent"},"app_version":{"type":"integer","description":"Version of the agent"},"connection_configs":{"type":"array","items":{"$ref":"#/components/schemas/ConnectionConfig"},"description":"Telephony connection configurations"},"channel_direction":{"$ref":"#/components/schemas/ChannelDirection","description":"Direction of calls (inbound, outbound, or both)"},"inbound_config":{"oneOf":[{"$ref":"#/components/schemas/InboundConfig"},{"type":"null"}],"description":"Inbound call schedule configuration"},"created_by":{"type":"string","description":"User who created this deployment"},"created_at":{"type":"string","format":"date-time","description":"Timestamp when created (ISO 8601)"},"updated_by":{"type":["string","null"],"description":"User who last updated this deployment"},"updated_at":{"type":"string","format":"date-time","description":"Timestamp when last updated (ISO 8601)"}},"required":["deployment_id","app_id","app_version","connection_configs","channel_direction","created_by","created_at","updated_at"],"description":"Full deployment details including agent configuration, inbound settings, and status.","title":"DeploymentDetails"},"ErrorBody":{"type":"object","properties":{"code":{"type":"string","description":"A service-specific error code."},"message":{"type":"string","description":"A human-readable description of the error."}},"required":["code","message"],"description":"Details of the error that occurred.","title":"ErrorBody"},"ErrorResponse":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ErrorBody"}},"required":["error"],"description":"A standard wrapper for all error responses.","title":"ErrorResponse"},"DeploymentRecord":{"type":"object","properties":{"name":{"type":["string","null"],"description":"Name of the deployment"},"deployment_id":{"type":"string","description":"Unique identifier for the deployment"},"status":{"oneOf":[{"$ref":"#/components/schemas/DeploymentStatus"},{"type":"null"}],"description":"Current status of the deployment"},"description":{"type":["string","null"],"description":"Optional description"},"app_id":{"type":"string","description":"ID of the agent"},"app_version":{"type":"integer","description":"Version of the agent"},"phone_numbers":{"type":"array","items":{"type":"string"},"description":"Phone numbers assigned to this deployment"},"channel_direction":{"$ref":"#/components/schemas/ChannelDirection","description":"Direction of calls"},"inbound_config":{"oneOf":[{"$ref":"#/components/schemas/InboundConfig"},{"type":"null"}],"description":"Inbound call schedule configuration"},"created_by":{"type":"string","description":"User who created this deployment"},"created_at":{"type":"string","format":"date-time","description":"Timestamp when created (ISO 8601)"},"updated_by":{"type":["string","null"],"description":"User who last updated this deployment"},"updated_at":{"type":"string","format":"date-time","description":"Timestamp when last updated (ISO 8601)"}},"required":["deployment_id","app_id","app_version","phone_numbers","channel_direction","created_by","created_at","updated_at"],"description":"Summary metadata for a deployment, returned in list responses.","title":"DeploymentRecord"},"PaginatedDeploymentRecord":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/DeploymentRecord"},"description":"List of deployments on this page"},"total":{"type":"integer","description":"Total number of deployments matching the query"},"limit":{"type":"integer","description":"Maximum number of items per page"},"offset":{"type":"integer","description":"Number of items skipped"},"next_page_uri":{"type":["string","null"],"description":"URI to fetch the next page, or null if this is the last page"},"prev_page_uri":{"type":["string","null"],"description":"URI to fetch the previous page, or null if this is the first page"}},"required":["items","total","limit","offset"],"description":"Paginated list of deployments.","title":"PaginatedDeploymentRecord"},"UpdateDeployment":{"type":"object","properties":{"name":{"type":["string","null"],"description":"Updated deployment name"},"description":{"type":["string","null"],"description":"Updated deployment description"},"app_version":{"type":["integer","null"],"description":"Updated agent version"},"connection_configs":{"type":["array","null"],"items":{"$ref":"#/components/schemas/ConnectionConfig"},"description":"Updated telephony connections"},"inbound_config":{"oneOf":[{"$ref":"#/components/schemas/InboundConfig"},{"type":"null"}],"description":"Updated inbound call schedule"}},"description":"Request body for updating a deployment's configuration.","title":"UpdateDeployment"},"StatusAction":{"type":"string","enum":["pause","resume"],"description":"Available status actions for a deployment.","title":"StatusAction"},"UpdateDeploymentStatus":{"type":"object","properties":{"action":{"$ref":"#/components/schemas/StatusAction","description":"Action to perform: `pause` or `resume`"}},"required":["action"],"description":"Request body for changing a deployment's status.","title":"UpdateDeploymentStatus"},"CohortStatus":{"type":"string","enum":["processing","completed","failed"],"title":"CohortStatus"},"CohortSourceType":{"type":"string","enum":["pre_signed_url","file_upload"],"title":"CohortSourceType"},"CohortResult":{"type":"object","properties":{"total_records":{"type":"integer","description":"Total number of records in the uploaded file"},"valid_records":{"type":"integer","description":"Number of records that passed validation"},"rejected_records":{"type":"integer","description":"Number of records that failed validation"}},"required":["total_records","valid_records","rejected_records"],"description":"Processing result showing how many records were valid vs rejected.","title":"CohortResult"},"CohortMetadata":{"type":"object","properties":{"name":{"type":"string","description":"Name of the resource"},"cohort_id":{"type":"string","description":"Unique identifier for the cohort"},"status":{"$ref":"#/components/schemas/CohortStatus","description":"Current status"},"source_type":{"$ref":"#/components/schemas/CohortSourceType","description":"How the cohort was uploaded"},"result":{"oneOf":[{"$ref":"#/components/schemas/CohortResult"},{"type":"null"}],"description":"Processing result with record counts"},"created_by":{"type":"string","description":"User who created this resource"},"created_at":{"type":"string","format":"date-time","description":"Timestamp when the resource was created (ISO 8601)"},"updated_by":{"type":["string","null"],"description":"User who last updated this resource"},"updated_at":{"type":"string","format":"date-time","description":"Timestamp when the resource was last updated (ISO 8601)"}},"required":["name","cohort_id","status","source_type","created_by","created_at","updated_at"],"description":"Cohort metadata including processing status and result counts.","title":"CohortMetadata"},"CreateCohortSource":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["pre_signed_url"],"default":"pre_signed_url","description":"Source type. Always 'pre_signed_url'."},"url":{"type":"string","description":"Pre-signed URL pointing to the cohort CSV file"}},"required":["type","url"],"description":"Cohort data source from a pre-signed URL pointing to a CSV file."}],"discriminator":{"propertyName":"type"},"description":"Source of the cohort data","title":"CreateCohortSource"},"CohortFormattingFunctionName":{"type":"string","enum":["indian_currency","date","string_replace","string_strip","string_capitalize","indian_state_language_map","format_language_name"],"description":"Available formatting functions for cohort column transformations:\n- `indian_currency` — Formats numbers as Indian currency\n- `date` — Converts dd/mm/yyyy or dd-mm-yyyy to dd/month name/yyyy\n- `string_replace` — Replace values based on a dictionary\n- `string_strip` — Strip whitespace\n- `string_capitalize` — Capitalize the string\n- `indian_state_language_map` — Map Indian state to language\n- `format_language_name` — Normalize language name","title":"CohortFormattingFunctionName"},"FormattingFunction":{"type":"object","properties":{"name":{"$ref":"#/components/schemas/CohortFormattingFunctionName","description":"Name of the formatting function to apply"},"params":{"type":"object","additionalProperties":{"description":"Any type"},"description":"Parameters for the formatting function"}},"required":["name"],"description":"A transformation function applied to a column value (e.g. currency formatting, date conversion).","title":"FormattingFunction"},"PhoneNumberColumnMapping":{"type":"object","properties":{"column_name":{"type":"string","description":"Name of the phone number column in the CSV file"},"required":{"type":"boolean","default":true,"description":"Whether the phone number column is required"},"formatting_functions":{"type":"array","items":{"$ref":"#/components/schemas/FormattingFunction"},"description":"Transformations to apply to the phone number"},"country_code":{"type":"string","default":"IN","description":"ISO 3166-1 alpha-2 country code (e.g. IN, US, GB)."}},"required":["column_name"],"description":"Maps a CSV column to the phone number field, with country code for validation.","title":"PhoneNumberColumnMapping"},"ColumnMapping":{"type":"object","properties":{"column_name":{"type":"string","description":"Name of the column in the CSV file"},"required":{"type":"boolean","default":false,"description":"Whether this column is required"},"formatting_functions":{"type":"array","items":{"$ref":"#/components/schemas/FormattingFunction"},"description":"Transformations to apply to the column value"}},"required":["column_name"],"description":"Maps a single CSV column to an agent variable, with optional formatting functions.","title":"ColumnMapping"},"CohortTransformationConfig":{"type":"object","properties":{"phone_number":{"$ref":"#/components/schemas/PhoneNumberColumnMapping","description":"Mapping for the phone number column"},"user_identifier":{"oneOf":[{"$ref":"#/components/schemas/ColumnMapping"},{"type":"null"}],"description":"Optional mapping for a user identifier column"},"app_variables":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ColumnMapping"},"description":"Mappings from CSV columns to agent variables"},"app_overrides":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/ColumnMapping"},"description":"Mappings from CSV columns to agent override settings"}},"required":["phone_number"],"description":"Maps CSV columns to phone number, user identifier, and agent variables.","title":"CohortTransformationConfig"},"CreateCohort":{"type":"object","properties":{"name":{"type":"string"},"source":{"$ref":"#/components/schemas/CreateCohortSource","description":"Source of the cohort data"},"cohort_transformation":{"$ref":"#/components/schemas/CohortTransformationConfig","description":"Configuration for how CSV columns map to phone numbers and agent variables"}},"required":["name","source","cohort_transformation"],"description":"Request model for creating a cohort.","title":"CreateCohort"},"PaginatedCohortMetadata":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CohortMetadata"},"description":"List of cohorts on this page"},"total":{"type":"integer","description":"Total number of cohorts matching the query"},"limit":{"type":"integer","description":"Maximum number of items per page"},"offset":{"type":"integer","description":"Number of items skipped"},"next_page_uri":{"type":["string","null"],"description":"URI to fetch the next page, or null if this is the last page"},"prev_page_uri":{"type":["string","null"],"description":"URI to fetch the previous page, or null if this is the first page"}},"required":["items","total","limit","offset"],"description":"Paginated list of cohorts.","title":"PaginatedCohortMetadata"},"CohortFileType":{"type":"string","enum":["cohort","rejected_records","cohort_transformation"],"title":"CohortFileType"},"BaseRetryConfig":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether this retry condition is enabled"}},"required":["enabled"],"title":"BaseRetryConfig"},"ShortDurationRetryConfig":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether short duration retry is enabled"},"threshold_seconds":{"type":"integer","default":30,"description":"Calls shorter than this duration (in seconds) will be retried"}},"required":["enabled","threshold_seconds"],"title":"ShortDurationRetryConfig"},"ErrorRetryConfig":{"type":"object","properties":{"enabled":{"type":"boolean","description":"Whether error retry is enabled"},"max_retries":{"type":"integer","default":3,"description":"Maximum number of retries for this error type (1 to 20)"},"retry_interval_minutes":{"type":"integer","default":5,"description":"Minutes to wait between retries (minimum 5)"}},"required":["enabled","max_retries","retry_interval_minutes"],"title":"ErrorRetryConfig"},"RetryOnConfig":{"type":"object","properties":{"busy":{"oneOf":[{"$ref":"#/components/schemas/BaseRetryConfig"},{"type":"null"}],"description":"Retry when the line is busy"},"failed":{"oneOf":[{"$ref":"#/components/schemas/BaseRetryConfig"},{"type":"null"}],"description":"Retry when the call fails"},"no_answer":{"oneOf":[{"$ref":"#/components/schemas/BaseRetryConfig"},{"type":"null"}],"description":"Retry when there is no answer"},"short_duration":{"oneOf":[{"$ref":"#/components/schemas/ShortDurationRetryConfig"},{"type":"null"}],"description":"Retry when the call duration is below a threshold"},"provider_error":{"oneOf":[{"$ref":"#/components/schemas/ErrorRetryConfig"},{"type":"null"}],"description":"Retry on telephony provider errors"},"internal_error":{"oneOf":[{"$ref":"#/components/schemas/ErrorRetryConfig"},{"type":"null"}],"default":{"enabled":true,"max_retries":3,"retry_interval_minutes":5},"description":"Retry on internal system errors"}},"description":"Granular retry conditions for different call outcomes (busy, failed, no answer, short duration, errors).","title":"RetryOnConfig"},"RetryConfigInputRetryIntervalMinutes":{"oneOf":[{"type":"integer"},{"type":"array","items":{"type":"integer"}}],"description":"Minutes to wait between retries. Can be a single value or an array for variable intervals.","title":"RetryConfigInputRetryIntervalMinutes"},"RetryConfig-Input":{"type":"object","properties":{"max_retries":{"type":"integer","description":"Maximum number of retry attempts (0 to 20)"},"retry_on":{"$ref":"#/components/schemas/RetryOnConfig","description":"Conditions that trigger a retry"},"retry_interval_minutes":{"$ref":"#/components/schemas/RetryConfigInputRetryIntervalMinutes","description":"Minutes to wait between retries. Can be a single value or an array for variable intervals."}},"required":["max_retries"],"description":"Retry policy defining how failed or unanswered calls are retried.","title":"RetryConfig-Input"},"WebhookConfig":{"type":"object","properties":{"url":{"type":"string"},"metadata":{"type":["object","null"],"additionalProperties":{"description":"Any type"}}},"required":["url"],"title":"WebhookConfig"},"AgentConfig-Input":{"type":"object","properties":{"app_id":{"type":"string","description":"ID of the agent"},"app_version":{"type":"integer","description":"Version of the agent to use"},"app_type":{"type":"string","enum":["agent"],"default":"agent","description":"Always `agent`"},"attempts_per_second":{"type":"number","format":"double","description":"Rate of outbound call attempts (dials) per second. Every dial counts — initial calls and retries alike. Range: 0.1–500."},"connection_configs":{"type":"array","items":{"$ref":"#/components/schemas/ConnectionConfig"},"description":"Telephony connection configurations with phone numbers"},"retry_config":{"$ref":"#/components/schemas/RetryConfig-Input","description":"Retry configuration for failed or unanswered calls"},"webhook_config":{"oneOf":[{"$ref":"#/components/schemas/WebhookConfig"},{"type":"null"}],"description":"Optional webhook to receive call completion events"}},"required":["app_id","app_version","attempts_per_second","connection_configs","retry_config"],"description":"Agent configuration including rate limiting, telephony connections, and retry policy.","title":"AgentConfig-Input"},"CreateCampaignAppConfig":{"oneOf":[{"$ref":"#/components/schemas/AgentConfig-Input"}],"description":"Agent configuration for the campaign","title":"CreateCampaignAppConfig"},"AllowedScheduleConfig":{"type":"object","properties":{"timezone":{"type":"string","format":"zoneinfo","description":"IANA timezone, e.g. 'Asia/Kolkata', 'UTC', 'America/New_York'"},"allowed_start_time":{"type":"string","description":"Start time in HH:MM 24-hour format"},"allowed_end_time":{"type":"string","description":"End time in HH:MM 24-hour format"},"allowed_days":{"type":"array","items":{"$ref":"#/components/schemas/DaysOfWeek"},"description":"Days of the week when the campaign can run"}},"required":["allowed_start_time","allowed_end_time","allowed_days"],"description":"Business hours configuration defining when a campaign can make calls.","title":"AllowedScheduleConfig"},"CreateCampaign":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":["string","null"],"description":"Optional campaign description. Max 150 characters."},"app_config":{"$ref":"#/components/schemas/CreateCampaignAppConfig","description":"Agent configuration for the campaign"},"start_timestamp":{"type":"string","format":"date-time","description":"Campaign start time (ISO 8601)"},"end_timestamp":{"type":"string","format":"date-time","description":"Campaign end time (ISO 8601)"},"allowed_schedule":{"$ref":"#/components/schemas/AllowedScheduleConfig","description":"Schedule constraints for when the campaign can run"}},"required":["name","app_config","start_timestamp","end_timestamp","allowed_schedule"],"description":"Request body for creating a new campaign. Ties an agent to a schedule, rate, and retry policy.","title":"CreateCampaign"},"CampaignStatus":{"type":"string","enum":["ended","active","paused","scheduled","cancelled"],"description":"Campaign lifecycle status: `scheduled` → `active` → `ended`. Can be `paused` or `cancelled` at any point.","title":"CampaignStatus"},"AppType":{"type":"string","enum":["agent"],"title":"AppType"},"CampaignMetadata":{"type":"object","properties":{"name":{"type":"string","description":"Name of the resource"},"campaign_id":{"type":"string","description":"Unique identifier for the campaign"},"status":{"$ref":"#/components/schemas/CampaignStatus","description":"Current status"},"description":{"type":["string","null"],"description":"Optional description"},"app_id":{"type":"string","description":"ID of the agent"},"app_type":{"$ref":"#/components/schemas/AppType","description":"Type of agent"},"app_version":{"type":["integer","null"],"description":"Version of the agent to use"},"created_by":{"type":"string","description":"User who created this resource"},"created_at":{"type":"string","format":"date-time","description":"Timestamp when the resource was created (ISO 8601)"},"updated_by":{"type":["string","null"],"description":"User who last updated this resource"},"updated_at":{"type":"string","format":"date-time","description":"Timestamp when the resource was last updated (ISO 8601)"}},"required":["name","campaign_id","status","app_id","created_by","created_at","updated_at"],"description":"Summary metadata for a campaign, returned in list responses.","title":"CampaignMetadata"},"PaginatedCampaignMetadata":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CampaignMetadata"},"description":"List of campaigns on this page"},"total":{"type":"integer","description":"Total number of campaigns matching the query"},"limit":{"type":"integer","description":"Maximum number of items per page"},"offset":{"type":"integer","description":"Number of items skipped"},"next_page_uri":{"type":["string","null"],"description":"URI to fetch the next page, or null if this is the last page"},"prev_page_uri":{"type":["string","null"],"description":"URI to fetch the previous page, or null if this is the first page"}},"required":["items","total","limit","offset"],"description":"Paginated list of campaigns.","title":"PaginatedCampaignMetadata"},"RetryConfigOutputRetryIntervalMinutes":{"oneOf":[{"type":"integer"},{"type":"array","items":{"type":"integer"}}],"description":"Minutes to wait between retries. Can be a single value or an array for variable intervals.","title":"RetryConfigOutputRetryIntervalMinutes"},"RetryConfig-Output":{"type":"object","properties":{"max_retries":{"type":"integer","description":"Maximum number of retry attempts (0 to 20)"},"retry_on":{"$ref":"#/components/schemas/RetryOnConfig","description":"Conditions that trigger a retry"},"retry_interval_minutes":{"$ref":"#/components/schemas/RetryConfigOutputRetryIntervalMinutes","description":"Minutes to wait between retries. Can be a single value or an array for variable intervals."}},"required":["max_retries"],"description":"Retry policy as returned in responses.","title":"RetryConfig-Output"},"AgentConfig-Output":{"type":"object","properties":{"app_id":{"type":"string","description":"ID of the agent"},"app_version":{"type":"integer","description":"Version of the agent to use"},"app_type":{"type":"string","enum":["agent"],"default":"agent","description":"Always `agent`"},"attempts_per_second":{"type":"number","format":"double","description":"Rate of outbound call attempts (dials) per second. Every dial counts — initial calls and retries alike. Range: 0.1–500."},"connection_configs":{"type":"array","items":{"$ref":"#/components/schemas/ConnectionConfig"},"description":"Telephony connection configurations with phone numbers"},"retry_config":{"$ref":"#/components/schemas/RetryConfig-Output","description":"Retry configuration for failed or unanswered calls"},"webhook_config":{"oneOf":[{"$ref":"#/components/schemas/WebhookConfig"},{"type":"null"}],"description":"Optional webhook to receive call completion events"}},"required":["app_id","app_version","attempts_per_second","connection_configs","retry_config"],"description":"Agent configuration as returned in responses.","title":"AgentConfig-Output"},"CampaignDetailAppConfig":{"oneOf":[{"$ref":"#/components/schemas/AgentConfig-Output"}],"description":"Agent configuration for the campaign","title":"CampaignDetailAppConfig"},"CampaignDetail":{"type":"object","properties":{"name":{"type":"string","description":"Name of the resource"},"campaign_id":{"type":"string","description":"Unique identifier for the campaign"},"status":{"$ref":"#/components/schemas/CampaignStatus","description":"Current status"},"description":{"type":["string","null"],"description":"Optional description"},"app_id":{"type":"string","description":"ID of the agent"},"app_type":{"$ref":"#/components/schemas/AppType","description":"Type of agent"},"app_version":{"type":["integer","null"],"description":"Version of the agent to use"},"created_by":{"type":"string","description":"User who created this resource"},"created_at":{"type":"string","format":"date-time","description":"Timestamp when the resource was created (ISO 8601)"},"updated_by":{"type":["string","null"],"description":"User who last updated this resource"},"updated_at":{"type":"string","format":"date-time","description":"Timestamp when the resource was last updated (ISO 8601)"},"app_config":{"$ref":"#/components/schemas/CampaignDetailAppConfig","description":"Agent configuration for the campaign"},"start_timestamp":{"type":"string","format":"date-time","description":"Campaign start time (ISO 8601)"},"end_timestamp":{"type":"string","format":"date-time","description":"Campaign end time (ISO 8601)"},"allowed_schedule":{"$ref":"#/components/schemas/AllowedScheduleConfig","description":"Schedule constraints for when the campaign can run"}},"required":["name","campaign_id","status","app_id","created_by","created_at","updated_at","app_config","start_timestamp","end_timestamp","allowed_schedule"],"description":"Full campaign details including agent configuration, schedule, and retry policy.","title":"CampaignDetail"},"UpdateCampaign":{"type":"object","properties":{"name":{"type":["string","null"],"description":"Updated campaign name. Alphanumeric, hyphens, underscores and spaces allowed. Max 50 characters."},"description":{"type":["string","null"],"description":"Updated campaign description. Max 150 characters."},"app_config":{"oneOf":[{"$ref":"#/components/schemas/AgentConfig-Input"},{"type":"null"}],"description":"Updated agent configuration"},"end_timestamp":{"type":["string","null"],"format":"date-time","description":"Updated campaign end time (ISO 8601)"},"allowed_schedule":{"oneOf":[{"$ref":"#/components/schemas/AllowedScheduleConfig"},{"type":"null"}],"description":"Updated schedule constraints"}},"description":"Request body for updating a campaign. Only allowed when the campaign is in `paused` or `scheduled` status.","title":"UpdateCampaign"},"CampaignAction":{"type":"string","enum":["pause","resume","cancel"],"title":"CampaignAction"},"UpdateCampaignStatus":{"type":"object","properties":{"action":{"$ref":"#/components/schemas/CampaignAction","description":"The new status to set for the campaign"}},"required":["action"],"title":"UpdateCampaignStatus"},"LanguageName":{"type":"string","enum":["Bengali","Gujarati","Kannada","Malayalam","Tamil","Telugu","Punjabi","Sanskrit","Odia","Marathi","Hindi","English","Assamese"],"title":"LanguageName"},"OutboundAppOverrides":{"type":"object","properties":{"initial_bot_message":{"type":["string","null"]},"initial_state_name":{"type":["string","null"]},"initial_language_name":{"oneOf":[{"$ref":"#/components/schemas/LanguageName"},{"type":"null"}]}},"title":"OutboundAppOverrides"},"OutboundAgentConfig":{"type":"object","properties":{"app_id":{"type":"string"},"app_version":{"type":"integer"},"connection_config":{"$ref":"#/components/schemas/ConnectionConfig"},"agent_variables":{"type":["object","null"],"additionalProperties":{"description":"Any type"}},"app_type":{"type":"string","default":"agent"},"app_overrides":{"oneOf":[{"$ref":"#/components/schemas/OutboundAppOverrides"},{"type":"null"}]}},"required":["app_id","app_version","connection_config"],"title":"OutboundAgentConfig"},"UserConfig":{"type":"object","properties":{"user_phone_number":{"type":"string"}},"required":["user_phone_number"],"title":"UserConfig"},"OutboundRequest":{"type":"object","properties":{"app_config":{"$ref":"#/components/schemas/OutboundAgentConfig"},"user_config":{"$ref":"#/components/schemas/UserConfig"},"webhook_config":{"oneOf":[{"$ref":"#/components/schemas/WebhookConfig"},{"type":"null"}]}},"required":["app_config","user_config"],"title":"OutboundRequest"},"OutboundResponse":{"type":"object","properties":{"attempt_id":{"type":"string"}},"required":["attempt_id"],"title":"OutboundResponse"},"ValidationErrorLocItems":{"oneOf":[{"type":"string"},{"type":"integer"}],"title":"ValidationErrorLocItems"},"ValidationError":{"type":"object","properties":{"loc":{"type":"array","items":{"$ref":"#/components/schemas/ValidationErrorLocItems"}},"msg":{"type":"string"},"type":{"type":"string"}},"required":["loc","msg","type"],"title":"ValidationError"},"HTTPValidationError":{"type":"object","properties":{"detail":{"type":"array","items":{"$ref":"#/components/schemas/ValidationError"}}},"title":"HTTPValidationError"},"ExternalAttemptsAPIResponse":{"type":"object","properties":{"attempt_id":{"type":["string","null"]},"interaction_id":{"type":["string","null"]},"user_identifier":{"type":["string","null"]},"connectivity_status":{"type":["string","null"]},"failure_reason":{"type":["string","null"]},"ended_by":{"type":["string","null"]},"duration_in_seconds":{"type":["number","null"],"format":"double","default":0},"start_datetime":{"type":["string","null"],"format":"date-time"},"end_datetime":{"type":["string","null"],"format":"date-time"},"language_name":{"type":["string","null"]},"num_messages":{"type":["integer","null"]},"average_agent_response_time_in_seconds":{"type":["number","null"],"format":"double"},"average_user_response_time_in_seconds":{"type":["number","null"],"format":"double"},"user_contact_masked":{"type":["string","null"]},"channel_direction":{"type":["string","null"]},"retry_attempt":{"type":["integer","null"]},"campaign_id":{"type":["string","null"]},"cohort_id":{"type":["string","null"]},"user_contact_hashed":{"type":["string","null"]},"is_debug_call":{"type":["integer","null"]},"audio_url":{"type":["string","null"]},"server_retry_attempt":{"type":["integer","null"]},"has_log_issues":{"type":["integer","null"]},"channel_provider":{"type":["string","null"]},"channel_protocol":{"type":["string","null"]},"channel_type":{"type":["string","null"]},"agent_variables":{"type":["object","null"],"additionalProperties":{"description":"Any type"}}},"description":"Event data for engagement fact events.\nValidates and converts data types to match ClickHouse EngagementFacts schema.","title":"ExternalAttemptsAPIResponse"},"PaginatedResponse_ExternalAttemptsAPIResponse_":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ExternalAttemptsAPIResponse"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"next_page_uri":{"type":["string","null"]},"prev_page_uri":{"type":["string","null"]}},"required":["items","total","limit","offset"],"title":"PaginatedResponse_ExternalAttemptsAPIResponse_"},"ExternalInteractionsAPIResponse":{"type":"object","properties":{"interaction_id":{"type":["string","null"]},"user_identifier":{"type":["string","null"]},"duration_in_seconds":{"type":["number","null"],"format":"double","default":0},"start_datetime":{"type":["string","null"],"format":"date-time"},"end_datetime":{"type":["string","null"],"format":"date-time"},"language_name":{"type":["string","null"]},"num_messages":{"type":["integer","null"]},"average_agent_response_time_in_seconds":{"type":["number","null"],"format":"double"},"average_user_response_time_in_seconds":{"type":["number","null"],"format":"double"},"user_contact_masked":{"type":["string","null"]},"user_contact_hashed":{"type":["string","null"]},"channel_direction":{"type":["string","null"]},"retry_attempt":{"type":["integer","null"]},"campaign_id":{"type":["string","null"]},"cohort_id":{"type":["string","null"]},"is_debug_call":{"type":["integer","null"]},"audio_url":{"type":["string","null"]},"job_id":{"type":["string","null"]},"channel_type":{"type":["string","null"]},"channel_provider":{"type":["string","null"]},"channel_protocol":{"type":["string","null"]},"server_retry_attempt":{"type":["integer","null"]},"failure_reason":{"type":["string","null"]},"ended_by":{"type":["string","null"]},"has_log_issues":{"type":["integer","null"]},"agent_variables":{"type":["object","null"],"additionalProperties":{"description":"Any type"}}},"title":"ExternalInteractionsAPIResponse"},"PaginatedResponse_ExternalInteractionsAPIResponse_":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ExternalInteractionsAPIResponse"}},"total":{"type":"integer"},"limit":{"type":"integer"},"offset":{"type":"integer"},"next_page_uri":{"type":["string","null"]},"prev_page_uri":{"type":["string","null"]}},"required":["items","total","limit","offset"],"title":"PaginatedResponse_ExternalInteractionsAPIResponse_"},"external_endpoints_getRecordingsApi_Response_200":{"type":"object","properties":{},"title":"external_endpoints_getRecordingsApi_Response_200"},"external_endpoints_getTranscriptsApi_Response_200":{"type":"object","properties":{},"title":"external_endpoints_getTranscriptsApi_Response_200"},"AuthBody":{"type":"object","properties":{"access_token":{"type":"string","description":"The JWT access token for authorizing subsequent requests."},"token_type":{"type":"string","description":"The type of token. Must always be 'Bearer'."},"expires_in":{"type":"integer","description":"The lifetime in seconds of the access token from the time of issuance."}},"required":["access_token","token_type","expires_in"],"description":"The response from a successful authentication request.","title":"AuthBody"},"AuthSuccessResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/AuthBody"}},"required":["data"],"title":"AuthSuccessResponse"},"DecryptKeyRequest":{"type":"object","properties":{"key_alias":{"type":"string","description":"The unique alias/identifier for the master key in your KMS that was used to encrypt the key."},"encrypted_key":{"type":"string","description":"The Base64 encoded, encrypted Data Encryption Key (EDEK).\nThe value will be prefixed with a version marker, e.g., `byok:v1:`. Your service should be prepared to handle this format.\n"}},"required":["key_alias","encrypted_key"],"description":"The request payload to decrypt a key.","title":"DecryptKeyRequest"},"DecryptKeyBody":{"type":"object","properties":{"plaintext_key":{"type":"string","format":"byte","description":"The Base64 encoded plaintext (decrypted) Data Encryption Key (DEK)."}},"required":["plaintext_key"],"description":"The response payload containing the decrypted key.","title":"DecryptKeyBody"},"DecryptKeySuccessResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/DecryptKeyBody"}},"required":["data"],"title":"DecryptKeySuccessResponse"},"RotateKeyBody":{"type":"object","properties":{"encrypted_dek":{"type":"string","description":"The new Base64 encoded Data Encryption Key (DEK), encrypted with the master key."},"key_alias":{"type":"string","description":"The alias of the master key that was used for encryption, confirming which key was used."},"plaintext_dek":{"type":"string","format":"byte","description":"The new Base64 encoded plaintext Data Encryption Key (DEK)."}},"required":["encrypted_dek","key_alias","plaintext_dek"],"description":"The response payload containing the new DEK in both plaintext and encrypted forms.","title":"RotateKeyBody"},"RotateKeySuccessResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/RotateKeyBody"}},"required":["data"],"title":"RotateKeySuccessResponse"}},"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"HTTP Basic authentication for the `/auth` endpoint, using the **Client ID** as the username and the **Client Secret** as the password."},"bearerAuth":{"type":"http","scheme":"bearer","description":"A token sent in the `Authorization` header.\n\nThis can be one of two types:\n1. A short-lived **JWT** obtained from the `/auth` endpoint.\n2. A long-lived, static **API Key** provided during setup.\n\nIn both cases, the header format is `Authorization: Bearer <token>`.\n"}}}}