Structured outputs
Extract structured data from conversations using AI-powered analysis
Overview
Structured outputs enable automatic extraction of specific information from voice conversations in a structured format. Define your data requirements using JSON Schema, and we will identify and extract that information from your calls.
Key benefits:
- Extract customer information, appointments, and orders automatically
- Validate data with JSON Schema constraints
- Use any AI model for extraction (OpenAI, Anthropic, Google, Azure)
- Reuse extraction definitions across multiple assistants
How it works
Quick start
Create a structured output
Link to an assistant
Add the structured output ID to your assistant’s configuration:
Access extracted data
After a call completes, retrieve the extracted data:
Schema types
Primitive types
Extract simple values directly:
Object types
Extract structured data with multiple fields:
Array types
Extract lists of items:
Nested structures
Extract complex hierarchical data:
Validation features
String formats
Vapi supports standard JSON Schema formats for validation:
Pattern matching
Use regular expressions for custom validation:
Conditional logic
Use if/then/else
for conditional requirements:
Custom models
Configure which AI model performs the extraction:
Available variables
Use these variables in custom prompts:
{{transcript}}
- Full conversation transcript{{messages}}
- Conversation messages array{{callEndedReason}}
- How the call ended{{structuredOutput.name}}
- Output name{{structuredOutput.description}}
- Output description{{structuredOutput.schema}}
- Schema definition
API reference
Create structured output
Display name for the structured output (max 40 characters)
Must be set to “ai”
Description of what data to extract
JSON Schema defining the structure of data to extract
Array of assistant IDs to link this output to
Custom model configuration for extraction
Update structured output
To update the top level schema type after creation, you must include ?schemaOverride=true
as a query parameter in the URL
List structured outputs
Query parameters:
page
- Page number (default: 1)limit
- Results per page (default: 20, max: 100)
Delete structured output
Common use cases
Customer information collection
Appointment scheduling
Order processing
Lead qualification
Best practices
Begin with basic schemas and add complexity as needed. Test with real conversations before adding advanced features.
Help the AI understand what to extract by using clear field names and descriptions in your schema.
Balance flexibility with validation. Too strict and extraction may fail; too loose and data quality suffers.
Only mark fields as required if they’re truly essential. Use optional fields for information that might not be mentioned.
Performance tips
- Keep schemas focused: Extract only what you need to minimize processing time
- Use appropriate models: GPT-4 for complex schemas, GPT-3.5 for simple ones
- Set low temperature: Use 0.1 or lower for consistent extraction
- Monitor success rates: Track extraction failures and adjust schemas accordingly
Error handling
Always check for null results which indicate extraction failure:
Troubleshooting
No data extracted
Incorrect extraction
- Add more descriptive field descriptions
- Provide examples in custom prompts
- Use stricter validation patterns
- Lower the model temperature
Partial extraction
- Make fields optional if they might not be mentioned
- Verify data types match expected values
HIPAA compliance
Important for HIPAA-enabled organizations:
If your organization has HIPAA compliance enabled (hipaaEnabled: true
), structured outputs are disabled by default to protect PHI (Protected Health Information).
To use structured outputs with HIPAA compliance:
- Contact the Vapi team to enable structured outputs
- Ensure you understand the implications for PHI handling
- Follow all HIPAA compliance best practices when extracting sensitive health data
Limitations
- Schema updates require
?schemaOverride=true
parameter - Extraction occurs after call completion (not real-time)
- Name field limited to 40 characters
Related
- Call analysis - Summarize and evaluate calls
- Custom tools - Trigger actions during calls
- Webhooks - Receive extracted data via webhooks
- Variables - Use dynamic data in conversations