Structured outputs quickstart
Overview
This quickstart guide will help you set up structured outputs to automatically extract customer information from phone calls. In just a few minutes, you’ll create a structured output, link it to an assistant, and test data extraction.
What are structured outputs?
Structured outputs are AI-powered data extraction templates that automatically capture and organize information from conversations. They work by:
- Listening to conversations - As your assistant talks with customers, structured outputs analyze the conversation in real-time
- Extracting key information - Based on your defined schema, they identify and extract relevant data points like names, emails, preferences, and issues
- Validating and formatting - The extracted data is validated against your schema rules and formatted into clean, structured JSON
- Delivering results - The structured data is available immediately after the call ends via API or webhooks
When are structured outputs generated?
Structured outputs are processed:
- During the call - Data is extracted in real-time as the conversation happens
- After call completion - Final validation and formatting occurs when the call ends
- Available via - Call artifacts in the API response or webhook events
Why use structured outputs?
- Automate data entry - No more manual transcription or form filling
- Ensure consistency - Every call captures the same structured information
- Enable integrations - Automatically sync data to CRMs, ticketing systems, or databases
- Improve analytics - Structured data is easier to analyze and report on
What you’ll build
A customer support assistant that automatically extracts:
- Customer name and contact details
- Issue description and priority
- Requested follow-up actions
Prerequisites
Sign up at dashboard.vapi.ai
Get your API key from the Dashboard settings
Step 1: Create your structured output
You can create structured outputs using either the Dashboard UI or the API.
Option A: Using the Dashboard (Recommended for beginners)
Option B: Using the API
Define what information you want to extract using a JSON Schema. JSON Schema is a standard for describing data structures - learn more about JSON Schema here.
Save the returned id
from the response - you’ll need it to link to your assistant.
Step 2: Create an assistant with structured outputs
Now create an assistant that uses your structured output:
Step 3: Test with a phone call
Make a test call to your assistant:
During the call, try saying something like: “Hi, my name is John Smith. My email is john@example.com. I’m having trouble logging into my account - it keeps showing an error message. This is pretty urgent for me.”
Step 4: Retrieve extracted data
After the call ends, retrieve the extracted information:
Expected output
You should see extracted data like this:
Step 5: Set up webhook (optional)
To automatically receive extracted data when calls end, set up a webhook:
Then update your assistant with the webhook URL:
Next steps
Learn about different data types and validation options
Configure different AI models for extraction
See complex real-world extraction scenarios
Complete API documentation for structured outputs
Common patterns
Multiple extractions
You can attach multiple structured outputs to extract different types of data:
structuredOutputIds
are UUIDs returned when you create each structured output configuration.Conditional extraction
Use conditional logic in your schema to handle different scenarios:
Validation patterns
Common validation patterns for reliable extraction:
Tips for success
Best practices for reliable extraction:
- Start with required fields only for critical data
- Use enums for categorical data to ensure consistency
- Add descriptions to help the AI understand context
- Test with real conversations before production use
- Monitor extraction success rates and iterate on schemas
Troubleshooting
Get help
Need assistance? We’re here to help: