Documentation
API Reference
Documentation
API Reference
Book a meeting
Linkedin
Github
  1. Api's
  • Introduction
  • Get started
    • Quickstart
    • Authentication
  • Core concepts
    • Agents
    • Phone numbers
    • Calls
    • Webhooks
  • Webhooks
    • Overview
    • Assistant request
    • Tool calls
    • Status update
    • End of call report
    • Security
  • Guides
    • Campaigns
    • xAI Realtime Integration
    • Voice selection psychology
    • Analysis templates
    • BYOK Setup
    • Call analysis
    • Call Transfers
    • Custom Tools
    • Sip Trunks
    • Tool templates
    • Voicemail detection
    • Autonomous silence detection
    • Billing
    • Error codes
    • Rate limits
    • Troubleshooting
  • Api's
    • Campaigns
    • Agents
    • Voices
    • BYOK
    • Analysis templates
    • Tool templates
    • Organization
    • Phone numbers
    • Sip trunks
    • Calls
    • Call control
    • Usage
    • Domains
Documentation
API Reference
Documentation
API Reference
Book a meeting
Linkedin
Github
  1. Api's

Analysis templates

Analysis Templates allow you to define reusable structured data extraction schemas for call analysis. Each template includes prompts and a JSON schema that defines what information should be extracted from call transcripts.
Analysis templates are saved as objects in agent configurations, not as references. This means agents continue working even if you delete a template.

Endpoints#

MethodEndpointDescription
GET/analysis-templatesList analysis templates
POST/analysis-templatesCreate analysis template
GET/analysis-templates/{id}Get analysis template
PATCH/analysis-templates/{id}Update analysis template
DELETE/analysis-templates/{id}Delete analysis template

List Analysis Templates#

Retrieve all analysis templates for your organization.
GET /analysis-templates

Request#

Response#

{
  "analysis_templates": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "org_id": "7461b868-afc1-4fe2-871a-5e7c0f3d5772",
      "name": "Customer Satisfaction Survey",
      "description": "Extract customer satisfaction metrics and feedback",
      "system_prompt": "You are analyzing a customer service call. Extract key satisfaction indicators.",
      "user_prompt": "Analyze this call transcript and extract the required data.\n\nTranscript: {{transcript}}",
      "schema": {
        "type": "object",
        "properties": {
          "satisfaction_level": {
            "type": "string",
            "description": "Overall customer satisfaction",
            "enum": ["very_satisfied", "satisfied", "neutral", "dissatisfied", "very_dissatisfied"]
          },
          "main_issues": {
            "type": "array",
            "description": "List of issues discussed"
          },
          "issue_resolved": {
            "type": "boolean",
            "description": "Whether the customer's issue was resolved"
          }
        }
      },
      "created_at": "2024-01-15T10:00:00Z",
      "updated_at": "2024-01-15T10:00:00Z"
    }
  ]
}

Create Analysis Template#

Create a new analysis template.
POST /analysis-templates

Request Body#

FieldTypeRequiredDescription
namestringYesDisplay name for the template
descriptionstringNoDescription of what this template extracts
system_promptstringNoSystem instructions for the analysis AI
user_promptstringNoUser prompt with {{transcript}} placeholder
schemaobjectYesJSON Schema defining extracted data structure

Example Request#

Response (201 Created)#

{
  "analysis_template": {
    "id": "660e8400-e29b-41d4-a716-446655440001",
    "org_id": "7461b868-afc1-4fe2-871a-5e7c0f3d5772",
    "name": "Lead Qualification",
    "description": "Qualify sales leads based on call content",
    "system_prompt": "You are a sales analyst. Extract lead qualification information accurately.",
    "user_prompt": "Analyze this sales call and extract lead qualification data.\n\nTranscript: {{transcript}}",
    "schema": {
      "type": "object",
      "properties": {
        "lead_quality": {
          "type": "string",
          "enum": ["hot", "warm", "cold"]
        }
      }
    },
    "created_at": "2024-01-15T10:00:00Z",
    "updated_at": "2024-01-15T10:00:00Z"
  }
}

Get Analysis Template#

Retrieve a specific analysis template by ID.
GET /analysis-templates/{id}

Parameters#

NameInTypeDescription
idpathUUIDAnalysis template UUID

Request#

Response#

{
  "analysis_template": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "org_id": "7461b868-afc1-4fe2-871a-5e7c0f3d5772",
    "name": "Customer Satisfaction Survey",
    "description": "Extract customer satisfaction metrics and feedback",
    "system_prompt": "You are analyzing a customer service call. Extract key satisfaction indicators.",
    "user_prompt": "Analyze this call transcript and extract the required data.\n\nTranscript: {{transcript}}",
    "schema": {
      "type": "object",
      "properties": {
        "satisfaction_level": {
          "type": "string",
          "enum": ["very_satisfied", "satisfied", "neutral", "dissatisfied", "very_dissatisfied"]
        }
      }
    },
    "created_at": "2024-01-15T10:00:00Z",
    "updated_at": "2024-01-15T10:00:00Z"
  }
}

Update Analysis Template#

Update an existing analysis template. Only provided fields will be updated.
PATCH /analysis-templates/{id}

Parameters#

NameInTypeDescription
idpathUUIDAnalysis template UUID

Request Body#

All fields are optional. Only include fields you want to update.

Example Request#

Response#

{
  "analysis_template": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "org_id": "7461b868-afc1-4fe2-871a-5e7c0f3d5772",
    "name": "Customer Satisfaction Survey v2",
    "schema": {
      "type": "object",
      "properties": {
        "nps_score": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10
        }
      }
    },
    "created_at": "2024-01-15T10:00:00Z",
    "updated_at": "2024-01-15T14:30:00Z"
  }
}

Delete Analysis Template#

Delete an analysis template.
DELETE /analysis-templates/{id}
Deleting a template does not affect agents that are using it. The analysis configuration is stored as an object in the agent, not as a reference.

Parameters#

NameInTypeDescription
idpathUUIDAnalysis template UUID

Request#

Response#

{
  "success": true
}

Using Analysis Templates with Agents#

Analysis templates define reusable configurations. When you select a template for an agent, the configuration is copied to the agent's analysis_plan field.

Agent Analysis Plan Structure#

{
  "analysis_plan": {
    "structured_data_plan": {
      "enabled": true,
      "schema": {
        "type": "object",
        "properties": {
          "satisfaction_level": {
            "type": "string",
            "enum": ["very_satisfied", "satisfied", "neutral", "dissatisfied"]
          }
        }
      },
      "messages": [
        {
          "role": "system",
          "content": "You are analyzing a customer service call..."
        },
        {
          "role": "user",
          "content": "Analyze this call transcript...\n\nTranscript: {{transcript}}"
        }
      ]
    },
    "min_messages_threshold": 3
  }
}
See the Call Analysis Guide for detailed usage instructions.

Schema Definition#

The schema field follows JSON Schema specification. Supported types:
TypeDescriptionExample
stringText values"type": "string"
integerWhole numbers"type": "integer", "minimum": 1, "maximum": 10
numberDecimal numbers"type": "number"
booleantrue/false"type": "boolean"
arrayLists"type": "array", "items": { "type": "string" }
objectNested objects"type": "object", "properties": {...}

Example: Complete Schema#

{
  "type": "object",
  "properties": {
    "sentiment": {
      "type": "string",
      "description": "Overall call sentiment",
      "enum": ["positive", "neutral", "negative"]
    },
    "satisfaction_score": {
      "type": "integer",
      "description": "Customer satisfaction 1-10",
      "minimum": 1,
      "maximum": 10
    },
    "issue_resolved": {
      "type": "boolean",
      "description": "Whether the issue was resolved"
    },
    "topics": {
      "type": "array",
      "description": "Topics discussed",
      "items": { "type": "string" }
    },
    "follow_up": {
      "type": "object",
      "description": "Follow-up action if needed",
      "properties": {
        "required": { "type": "boolean" },
        "reason": { "type": "string" }
      }
    }
  }
}

Prompt Placeholders#

User prompts support the following placeholders:
PlaceholderDescription
{{transcript}}Full call transcript
{{schema}}Your JSON Schema (auto-injected)
{{ended_reason}}Why the call ended

Error Responses#

StatusDescription
400Invalid request (e.g., invalid schema format)
401Unauthorized (invalid or missing API key)
403Forbidden (no access to this resource)
404Analysis template not found
{
  "error": "Analysis template not found"
}
Modified at 2026-01-30 12:20:48
Previous
BYOK
Next
Tool templates
Built with