ratty-blush•4d ago
API POST structured-output /create endpoint returns 500 internal errors
I have tried many many different body, each time the api would return
{
"statusCode": 500,
"message": "Internal server error. Contact support@vapi.ai for help."
}
2 Replies
ratty-blushOP•4d ago
I have even created one via the VAPI UI (id 653dd2c7-6b25-4252-a3ad-ec5aab4f20d1) then copied the schema to try to create it via the API : still the same answer. Other endpoints (e.g. GET) work so it's not an authentication issue.
✅ GET {{baseUrl}}/structured-output/653dd2c7-6b25-4252-a3ad-ec5aab4f20d1
❌ POST {{baseUrl}}/structured-output
{
"name": "test",
"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"]
}
Hi Jeebs,
Thanks for sharing the details — I dug into this on our side, and I found the root cause of the 500 error you're seeing.
The issue is that the
type 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:
Here’s a corrected version of your request body:
And the equivalent curl example:
Once "type": "ai" is added, the endpoint should work correctly.