Jeebs from eva.be
12/02/2025, 12:46 PMJeebs from eva.be
12/02/2025, 12:55 PMChiranjeet Mishra
12/04/2025, 9:57 AMtype field is required when creating a structured output, but it's currently hidden from the public API docs, so it's not obvious that it needs to be included. The only valid value is:
json
"type": "ai"
Here’s a corrected version of your request body:
json
{
"name": "test",
"type": "ai",
"schema": {
"type": "object",
"required": ["leadType"],
"properties": {
"lastName": {
"description": "Last name of the new contact",
"type": "string"
},
"leadType": {
"type": "string",
"enum": ["Contact", "Search", "Owner", "Valuation"]
},
"firstName": {
"description": "First name of the new contact",
"type": "string"
}
}
},
"assistantIds": ["2f7fbacf-a412-4366-8213-47f6ed3fa81a"]
}
And the equivalent curl example:
bash
curl -X POST "https://api.vapi.ai/structured-output" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "test",
"type": "ai",
"schema": {
"type": "object",
"required": ["leadType"],
"properties": {
"lastName": {
"description": "Last name of the new contact",
"type": "string"
},
"leadType": {
"type": "string",
"enum": ["Contact", "Search", "Owner", "Valuation"]
},
"firstName": {
"description": "First name of the new contact",
"type": "string"
}
}
},
"assistantIds": ["2f7fbacf-a412-4366-8213-47f6ed3fa81a"]
}'
Once "type": "ai" is added, the endpoint should work correctly.