Structured outputs examples
Real-world examples and templates for common use cases
Overview
This page provides production-ready examples of structured outputs for common business scenarios. Each example includes the complete schema, configuration, and integration code.
Healthcare appointment booking
Extract patient information and appointment preferences from healthcare calls.
1 { 2 "name": "Healthcare Appointment", 3 "type": "ai", 4 "description": "Extract patient and appointment information for medical scheduling", 5 "schema": { 6 "type": "object", 7 "properties": { 8 "patient": { 9 "type": "object", 10 "properties": { 11 "firstName": { 12 "type": "string", 13 "description": "Patient's first name" 14 }, 15 "lastName": { 16 "type": "string", 17 "description": "Patient's last name" 18 }, 19 "dateOfBirth": { 20 "type": "string", 21 "format": "date", 22 "description": "Patient's date of birth (YYYY-MM-DD)" 23 }, 24 "phoneNumber": { 25 "type": "string", 26 "pattern": "^\\+?[1-9]\\d{1,14}$", 27 "description": "Patient's contact number" 28 }, 29 "insuranceProvider": { 30 "type": "string", 31 "description": "Insurance provider name" 32 }, 33 "memberID": { 34 "type": "string", 35 "description": "Insurance member ID" 36 } 37 }, 38 "required": ["firstName", "lastName", "phoneNumber"] 39 }, 40 "appointment": { 41 "type": "object", 42 "properties": { 43 "type": { 44 "type": "string", 45 "enum": ["new-patient", "follow-up", "annual-checkup", "urgent-care", "specialist"], 46 "description": "Type of appointment" 47 }, 48 "department": { 49 "type": "string", 50 "enum": ["general", "cardiology", "dermatology", "orthopedics", "pediatrics", "obgyn"], 51 "description": "Medical department" 52 }, 53 "preferredDates": { 54 "type": "array", 55 "items": { 56 "type": "string", 57 "format": "date" 58 }, 59 "maxItems": 3, 60 "description": "Up to 3 preferred appointment dates" 61 }, 62 "preferredTimeSlot": { 63 "type": "string", 64 "enum": ["morning", "afternoon", "evening", "any"], 65 "description": "Preferred time of day" 66 }, 67 "symptoms": { 68 "type": "array", 69 "items": { 70 "type": "string" 71 }, 72 "description": "List of symptoms or reasons for visit" 73 }, 74 "urgency": { 75 "type": "string", 76 "enum": ["routine", "soon", "urgent"], 77 "description": "How urgent is the appointment" 78 } 79 }, 80 "required": ["type", "department", "urgency"] 81 }, 82 "additionalNotes": { 83 "type": "string", 84 "description": "Any additional notes or special requirements" 85 } 86 }, 87 "required": ["patient", "appointment"] 88 } 89 }
E-commerce order processing
Capture order details, shipping information, and payment preferences.
1 { 2 "name": "E-commerce Order", 3 "type": "ai", 4 "description": "Extract complete order information from sales calls", 5 "schema": { 6 "type": "object", 7 "properties": { 8 "customer": { 9 "type": "object", 10 "properties": { 11 "name": { 12 "type": "string", 13 "description": "Customer full name" 14 }, 15 "email": { 16 "type": "string", 17 "format": "email", 18 "description": "Customer email for order confirmation" 19 }, 20 "phone": { 21 "type": "string", 22 "description": "Contact number" 23 }, 24 "loyaltyNumber": { 25 "type": "string", 26 "description": "Loyalty program member number if mentioned" 27 } 28 }, 29 "required": ["name", "email"] 30 }, 31 "items": { 32 "type": "array", 33 "items": { 34 "type": "object", 35 "properties": { 36 "productName": { 37 "type": "string", 38 "description": "Name or description of the product" 39 }, 40 "sku": { 41 "type": "string", 42 "description": "Product SKU if mentioned" 43 }, 44 "quantity": { 45 "type": "integer", 46 "minimum": 1, 47 "description": "Quantity ordered" 48 }, 49 "size": { 50 "type": "string", 51 "enum": ["XS", "S", "M", "L", "XL", "XXL", "custom"], 52 "description": "Size if applicable" 53 }, 54 "color": { 55 "type": "string", 56 "description": "Color preference" 57 }, 58 "customization": { 59 "type": "string", 60 "description": "Any customization requests" 61 } 62 }, 63 "required": ["productName", "quantity"] 64 }, 65 "minItems": 1, 66 "description": "List of items being ordered" 67 }, 68 "shipping": { 69 "type": "object", 70 "properties": { 71 "method": { 72 "type": "string", 73 "enum": ["standard", "express", "overnight", "pickup"], 74 "description": "Shipping method" 75 }, 76 "address": { 77 "type": "object", 78 "properties": { 79 "street": { 80 "type": "string" 81 }, 82 "apartment": { 83 "type": "string", 84 "description": "Apartment or suite number" 85 }, 86 "city": { 87 "type": "string" 88 }, 89 "state": { 90 "type": "string", 91 "pattern": "^[A-Z]{2}$" 92 }, 93 "zipCode": { 94 "type": "string", 95 "pattern": "^\\d{5}(-\\d{4})?$" 96 }, 97 "country": { 98 "type": "string", 99 "default": "USA" 100 } 101 }, 102 "required": ["street", "city", "state", "zipCode"] 103 }, 104 "instructions": { 105 "type": "string", 106 "description": "Special delivery instructions" 107 }, 108 "giftWrap": { 109 "type": "boolean", 110 "description": "Whether gift wrapping was requested" 111 }, 112 "giftMessage": { 113 "type": "string", 114 "description": "Gift message if applicable" 115 } 116 }, 117 "required": ["method", "address"] 118 }, 119 "payment": { 120 "type": "object", 121 "properties": { 122 "method": { 123 "type": "string", 124 "enum": ["credit_card", "debit_card", "paypal", "apple_pay", "google_pay", "invoice"], 125 "description": "Payment method" 126 }, 127 "cardLastFour": { 128 "type": "string", 129 "pattern": "^\\d{4}$", 130 "description": "Last 4 digits of card if provided" 131 }, 132 "billingAddressSameAsShipping": { 133 "type": "boolean", 134 "description": "Whether billing address is same as shipping" 135 } 136 }, 137 "required": ["method"] 138 }, 139 "promotions": { 140 "type": "object", 141 "properties": { 142 "promoCode": { 143 "type": "string", 144 "description": "Promotional code mentioned" 145 }, 146 "referralSource": { 147 "type": "string", 148 "description": "How customer heard about us" 149 } 150 } 151 }, 152 "specialRequests": { 153 "type": "string", 154 "description": "Any special requests or notes" 155 } 156 }, 157 "required": ["customer", "items", "shipping"] 158 } 159 }
Real estate lead qualification
Qualify real estate leads and capture property preferences.
1 { 2 "name": "Real Estate Lead", 3 "type": "ai", 4 "description": "Qualify real estate leads and extract property preferences", 5 "schema": { 6 "type": "object", 7 "properties": { 8 "contact": { 9 "type": "object", 10 "properties": { 11 "firstName": { 12 "type": "string" 13 }, 14 "lastName": { 15 "type": "string" 16 }, 17 "email": { 18 "type": "string", 19 "format": "email" 20 }, 21 "phone": { 22 "type": "string" 23 }, 24 "preferredContactMethod": { 25 "type": "string", 26 "enum": ["phone", "email", "text", "any"] 27 }, 28 "bestTimeToContact": { 29 "type": "string", 30 "enum": ["morning", "afternoon", "evening", "weekends", "any"] 31 } 32 }, 33 "required": ["firstName", "phone"] 34 }, 35 "propertySearch": { 36 "type": "object", 37 "properties": { 38 "type": { 39 "type": "string", 40 "enum": ["buy", "rent", "sell", "invest"] 41 }, 42 "propertyType": { 43 "type": "array", 44 "items": { 45 "type": "string", 46 "enum": ["single-family", "condo", "townhouse", "multi-family", "commercial", "land"] 47 } 48 }, 49 "locations": { 50 "type": "array", 51 "items": { 52 "type": "object", 53 "properties": { 54 "area": { 55 "type": "string", 56 "description": "Neighborhood, city, or region" 57 }, 58 "schools": { 59 "type": "boolean", 60 "description": "Important to be near good schools" 61 }, 62 "commute": { 63 "type": "string", 64 "description": "Commute requirements mentioned" 65 } 66 } 67 } 68 }, 69 "budget": { 70 "type": "object", 71 "properties": { 72 "min": { 73 "type": "number", 74 "minimum": 0 75 }, 76 "max": { 77 "type": "number" 78 }, 79 "preApproved": { 80 "type": "boolean", 81 "description": "Whether they have mortgage pre-approval" 82 } 83 } 84 }, 85 "features": { 86 "type": "object", 87 "properties": { 88 "bedrooms": { 89 "type": "integer", 90 "minimum": 0 91 }, 92 "bathrooms": { 93 "type": "number", 94 "minimum": 0 95 }, 96 "squareFeet": { 97 "type": "integer", 98 "minimum": 0 99 }, 100 "garage": { 101 "type": "boolean" 102 }, 103 "pool": { 104 "type": "boolean" 105 }, 106 "yard": { 107 "type": "boolean" 108 }, 109 "mustHaves": { 110 "type": "array", 111 "items": { 112 "type": "string" 113 }, 114 "description": "List of must-have features" 115 }, 116 "dealBreakers": { 117 "type": "array", 118 "items": { 119 "type": "string" 120 }, 121 "description": "List of deal-breakers" 122 } 123 } 124 } 125 }, 126 "required": ["type", "propertyType", "budget"] 127 }, 128 "timeline": { 129 "type": "object", 130 "properties": { 131 "urgency": { 132 "type": "string", 133 "enum": ["immediate", "1-3months", "3-6months", "6-12months", "browsing"] 134 }, 135 "moveInDate": { 136 "type": "string", 137 "format": "date", 138 "description": "Target move-in date if mentioned" 139 }, 140 "reason": { 141 "type": "string", 142 "description": "Reason for moving/buying" 143 } 144 } 145 }, 146 "currentSituation": { 147 "type": "object", 148 "properties": { 149 "currentlyOwns": { 150 "type": "boolean", 151 "description": "Whether they currently own property" 152 }, 153 "needToSell": { 154 "type": "boolean", 155 "description": "Need to sell before buying" 156 }, 157 "firstTimeBuyer": { 158 "type": "boolean" 159 } 160 } 161 }, 162 "leadScore": { 163 "type": "object", 164 "properties": { 165 "motivation": { 166 "type": "string", 167 "enum": ["high", "medium", "low"], 168 "description": "Buyer/seller motivation level" 169 }, 170 "qualified": { 171 "type": "boolean", 172 "description": "Whether lead seems qualified" 173 }, 174 "followUpPriority": { 175 "type": "string", 176 "enum": ["hot", "warm", "cold"], 177 "description": "Follow-up priority" 178 } 179 } 180 } 181 }, 182 "required": ["contact", "propertySearch", "timeline"] 183 } 184 }
Insurance claim intake
Capture insurance claim details and incident information.
1 { 2 "name": "Insurance Claim", 3 "type": "ai", 4 "description": "Extract insurance claim information and incident details", 5 "schema": { 6 "type": "object", 7 "properties": { 8 "policyholder": { 9 "type": "object", 10 "properties": { 11 "name": { 12 "type": "string" 13 }, 14 "policyNumber": { 15 "type": "string", 16 "description": "Insurance policy number" 17 }, 18 "dateOfBirth": { 19 "type": "string", 20 "format": "date" 21 }, 22 "contactPhone": { 23 "type": "string" 24 }, 25 "email": { 26 "type": "string", 27 "format": "email" 28 } 29 }, 30 "required": ["name", "policyNumber"] 31 }, 32 "incident": { 33 "type": "object", 34 "properties": { 35 "type": { 36 "type": "string", 37 "enum": ["auto", "property", "theft", "injury", "liability", "other"] 38 }, 39 "date": { 40 "type": "string", 41 "format": "date", 42 "description": "Date of incident" 43 }, 44 "time": { 45 "type": "string", 46 "format": "time", 47 "description": "Approximate time of incident" 48 }, 49 "location": { 50 "type": "object", 51 "properties": { 52 "address": { 53 "type": "string" 54 }, 55 "city": { 56 "type": "string" 57 }, 58 "state": { 59 "type": "string" 60 }, 61 "zipCode": { 62 "type": "string" 63 } 64 } 65 }, 66 "description": { 67 "type": "string", 68 "description": "Detailed description of what happened" 69 }, 70 "policeReportFiled": { 71 "type": "boolean" 72 }, 73 "policeReportNumber": { 74 "type": "string", 75 "description": "Police report number if available" 76 } 77 }, 78 "required": ["type", "date", "description"] 79 }, 80 "damages": { 81 "type": "object", 82 "properties": { 83 "propertyDamage": { 84 "type": "array", 85 "items": { 86 "type": "object", 87 "properties": { 88 "item": { 89 "type": "string", 90 "description": "Damaged item or property" 91 }, 92 "estimatedValue": { 93 "type": "number", 94 "description": "Estimated value or repair cost" 95 }, 96 "description": { 97 "type": "string", 98 "description": "Description of damage" 99 } 100 } 101 } 102 }, 103 "injuries": { 104 "type": "array", 105 "items": { 106 "type": "object", 107 "properties": { 108 "person": { 109 "type": "string", 110 "description": "Injured person's name" 111 }, 112 "relationship": { 113 "type": "string", 114 "enum": ["self", "family", "passenger", "pedestrian", "other-driver", "other"], 115 "description": "Relationship to policyholder" 116 }, 117 "injuryDescription": { 118 "type": "string" 119 }, 120 "medicalTreatment": { 121 "type": "boolean", 122 "description": "Whether medical treatment was received" 123 }, 124 "hospital": { 125 "type": "string", 126 "description": "Hospital or clinic name if treated" 127 } 128 } 129 } 130 }, 131 "estimatedTotalLoss": { 132 "type": "number", 133 "description": "Total estimated loss amount" 134 } 135 } 136 }, 137 "otherParties": { 138 "type": "array", 139 "items": { 140 "type": "object", 141 "properties": { 142 "name": { 143 "type": "string" 144 }, 145 "role": { 146 "type": "string", 147 "enum": ["other-driver", "witness", "property-owner", "passenger"], 148 "description": "Role in incident" 149 }, 150 "contactInfo": { 151 "type": "string", 152 "description": "Phone or email" 153 }, 154 "insuranceCompany": { 155 "type": "string", 156 "description": "Their insurance company if known" 157 }, 158 "policyNumber": { 159 "type": "string", 160 "description": "Their policy number if known" 161 } 162 } 163 } 164 }, 165 "documentation": { 166 "type": "object", 167 "properties": { 168 "photosAvailable": { 169 "type": "boolean" 170 }, 171 "receiptsAvailable": { 172 "type": "boolean" 173 }, 174 "witnessStatements": { 175 "type": "boolean" 176 } 177 } 178 }, 179 "urgency": { 180 "type": "string", 181 "enum": ["emergency", "urgent", "standard"], 182 "description": "Claim urgency level" 183 } 184 }, 185 "required": ["policyholder", "incident"] 186 } 187 }
Financial services application
Process loan or credit applications with financial information.
1 { 2 "name": "Financial Application", 3 "type": "ai", 4 "description": "Extract loan or credit application information", 5 "schema": { 6 "type": "object", 7 "properties": { 8 "applicant": { 9 "type": "object", 10 "properties": { 11 "personalInfo": { 12 "type": "object", 13 "properties": { 14 "firstName": { 15 "type": "string" 16 }, 17 "lastName": { 18 "type": "string" 19 }, 20 "ssn": { 21 "type": "string", 22 "pattern": "^\\d{3}-\\d{2}-\\d{4}$", 23 "description": "Social Security Number (XXX-XX-XXXX)" 24 }, 25 "dateOfBirth": { 26 "type": "string", 27 "format": "date" 28 }, 29 "email": { 30 "type": "string", 31 "format": "email" 32 }, 33 "phone": { 34 "type": "string" 35 }, 36 "currentAddress": { 37 "type": "object", 38 "properties": { 39 "street": { 40 "type": "string" 41 }, 42 "city": { 43 "type": "string" 44 }, 45 "state": { 46 "type": "string" 47 }, 48 "zipCode": { 49 "type": "string" 50 }, 51 "yearsAtAddress": { 52 "type": "number" 53 }, 54 "rentOrOwn": { 55 "type": "string", 56 "enum": ["rent", "own", "other"] 57 } 58 } 59 } 60 }, 61 "required": ["firstName", "lastName", "dateOfBirth"] 62 }, 63 "employment": { 64 "type": "object", 65 "properties": { 66 "status": { 67 "type": "string", 68 "enum": ["employed", "self-employed", "unemployed", "retired", "student"] 69 }, 70 "employer": { 71 "type": "string", 72 "description": "Employer name" 73 }, 74 "position": { 75 "type": "string", 76 "description": "Job title" 77 }, 78 "yearsEmployed": { 79 "type": "number" 80 }, 81 "annualIncome": { 82 "type": "number", 83 "minimum": 0, 84 "description": "Annual gross income" 85 }, 86 "otherIncome": { 87 "type": "number", 88 "description": "Other income sources" 89 }, 90 "incomeVerifiable": { 91 "type": "boolean", 92 "description": "Can provide income verification" 93 } 94 }, 95 "required": ["status", "annualIncome"] 96 }, 97 "financial": { 98 "type": "object", 99 "properties": { 100 "creditScore": { 101 "type": "integer", 102 "minimum": 300, 103 "maximum": 850, 104 "description": "Self-reported credit score" 105 }, 106 "monthlyDebt": { 107 "type": "number", 108 "description": "Total monthly debt payments" 109 }, 110 "bankruptcyHistory": { 111 "type": "boolean", 112 "description": "Any bankruptcy in past 7 years" 113 }, 114 "existingAccounts": { 115 "type": "array", 116 "items": { 117 "type": "string", 118 "enum": ["checking", "savings", "credit-card", "mortgage", "auto-loan", "student-loan"] 119 }, 120 "description": "Existing accounts with institution" 121 } 122 } 123 } 124 } 125 }, 126 "loanDetails": { 127 "type": "object", 128 "properties": { 129 "type": { 130 "type": "string", 131 "enum": ["personal", "auto", "mortgage", "home-equity", "business", "student"], 132 "description": "Type of loan" 133 }, 134 "amount": { 135 "type": "number", 136 "minimum": 0, 137 "description": "Requested loan amount" 138 }, 139 "purpose": { 140 "type": "string", 141 "description": "Purpose of the loan" 142 }, 143 "term": { 144 "type": "integer", 145 "description": "Desired loan term in months" 146 }, 147 "collateral": { 148 "type": "object", 149 "properties": { 150 "type": { 151 "type": "string", 152 "enum": ["vehicle", "property", "savings", "none"], 153 "description": "Type of collateral" 154 }, 155 "value": { 156 "type": "number", 157 "description": "Estimated value of collateral" 158 }, 159 "description": { 160 "type": "string", 161 "description": "Description of collateral" 162 } 163 } 164 } 165 }, 166 "required": ["type", "amount", "purpose"] 167 }, 168 "coApplicant": { 169 "type": "object", 170 "properties": { 171 "hasCoApplicant": { 172 "type": "boolean" 173 }, 174 "relationship": { 175 "type": "string", 176 "enum": ["spouse", "partner", "family", "business-partner", "other"] 177 }, 178 "name": { 179 "type": "string" 180 }, 181 "income": { 182 "type": "number" 183 } 184 } 185 }, 186 "preferences": { 187 "type": "object", 188 "properties": { 189 "preferredRate": { 190 "type": "string", 191 "enum": ["fixed", "variable", "no-preference"] 192 }, 193 "automaticPayment": { 194 "type": "boolean", 195 "description": "Interested in automatic payment" 196 }, 197 "paperless": { 198 "type": "boolean", 199 "description": "Prefers paperless statements" 200 } 201 } 202 } 203 }, 204 "required": ["applicant", "loanDetails"] 205 } 206 }
Best practices for complex schemas
Break complex schemas into reusable object definitions for maintainability
Start with essential fields as required, make detailed fields optional
Add descriptions to every field to help AI understand context
Use constraints for data quality but avoid being too restrictive
Testing recommendations
Test scenarios
Always test your structured outputs with these scenarios:
- Complete information - All fields mentioned clearly
- Partial information - Some required fields missing
- Ambiguous data - Unclear or conflicting information
- Edge cases - Boundary values, special characters
- Real conversations - Actual call recordings or transcripts
Monitoring checklist
Track these metrics for production deployments:
- Extraction success rate per field
- Average extraction time
- Token usage and costs
- Schema validation failures
- Most commonly missing fields
Output data structure
Webhook payload format
When structured outputs are extracted, they’re delivered in this format:
1 { 2 "type": "call.ended", 3 "call": { 4 "id": "call_abc123", 5 "artifact": { 6 "structuredOutputs": { 7 "550e8400-e29b-41d4-a716-446655440001": { 8 "name": "Customer Support Ticket", 9 "result": { 10 "customer": { 11 "name": "John Smith", 12 "email": "john@example.com" 13 }, 14 "issue": { 15 "description": "Login issues", 16 "priority": "high" 17 } 18 } 19 }, 20 "550e8400-e29b-41d4-a716-446655440002": { 21 "name": "Satisfaction Score", 22 "result": { 23 "score": 8, 24 "feedback": "Very helpful agent" 25 } 26 } 27 } 28 } 29 } 30 }
API response format
When retrieving call data via API:
1 { 2 "id": "call_abc123", 3 "status": "ended", 4 "endedAt": "2024-01-10T15:30:00Z", 5 "artifact": { 6 "structuredOutputs": { 7 "outputId1": { 8 "name": "Output Name", 9 "result": { 10 // Your extracted data here 11 } 12 } 13 } 14 } 15 }
Related resources
- Structured outputs overview - Main documentation
- Quickstart guide - Get started quickly
- API reference - Complete API documentation
- JSON Schema specification - JSON Schema standard