niraj
10/31/2025, 4:37 PMChiranjeet Mishra
11/04/2025, 2:12 AManalysisPlan. This allows you to define a rubric for evaluating how accurately the voicemail detection worked — for example, tracking whether calls were correctly classified as voicemail or live pickup.
By consistently reviewing these structured results, you can identify trends or inconsistencies and better assess when detection may be failing intermittently.
Please let me know if you’d like a short example of how to configure that.niraj
11/18/2025, 7:45 PMChiranjeet Mishra
11/20/2025, 7:26 PMcurl -X POST "https://api.vapi.ai/structured-output" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Voicemail Detection Monitor",
"type": "ai",
"schema": {
"type": "object",
"properties": {
"wasVoicemail": {"type": "boolean"},
"detectedAsVoicemail": {"type": "boolean"},
"detectionAccuracy": {
"type": "string",
"enum": ["Correct", "False Positive", "False Negative", "Unknown"]
}
},
"required": ["wasVoicemail","detectedAsVoicemail","detectionAccuracy"]
}
}'
You’ll get an ID like:
"id": "so_abc123def456"
---
2) Attach it to your assistant
curl -X PATCH "https://api.vapi.ai/assistant/YOUR_ASSISTANT_ID" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"structuredOutputIds": ["so_abc123def456"]
}'
---
3) Run it on existing calls (retro-analysis)
curl -X POST "https://api.vapi.ai/structured-output/run" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"structuredOutputId": "so_abc123def456",
"callIds": ["call_123", "call_456"]
}'
---
4) Retrieve voicemail metrics
curl -X GET "https://api.vapi.ai/call/YOUR_CALL_ID" \
-H "Authorization: Bearer YOUR_API_KEY" \
| jq '.artifact.structuredOutputs["so_abc123def456"]'
Example result:
{
"wasVoicemail": true,
"detectedAsVoicemail": true,
"detectionAccuracy": "Correct"
}
---