Structured Output errors
# support
y
Is there some issues with structured outputs at the moment? I saw that some things were becoming deprecated and should be replaced by structured outputs. But I'm getting 500 errors when trying to create them through the API. Visiting the docs strangely seem to append an ?error=true flag at the end of the url which only happens to structured output related things afaik. https://docs.vapi.ai/api-reference/structured-outputs/structured-output-controller-create?error=true
Running the example curl from docs I get this error:
Copy code
{
  "statusCode": 500,
  "message": "Internal server error. Contact support@vapi.ai for help."
}
I solved this problem, apparantly you have to pass in
Copy code
"type": "ai"
with the request for it to properly go through. Strangely this is not mentioned anywhere in the docs. Here is a working example for anyone else that runs into this:
Copy code
curl -X POST https://api.vapi.ai/structured-output \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "name": "test_object",
  "type": "ai",
  "schema": {
    "type": "object",
    "properties": {
      "summary": {
        "type": "string",
        "description": "Summary of the call"
      },
      "success": {
        "type": "boolean",
        "description": "Was the call successful?"
      }
    },
    "required": ["summary", "success"]
  }
}'
c
Hi korv, Thanks — you're correct. The POST /structured-output endpoint requires "type": "ai" in the request body; omitting it causes the 500 error. I confirmed this from prior investigations and examples in our internal threads. Use your working curl (with "type":"ai") and the create call will succeed. Docs link for reference: https://docs.vapi.ai/assistants/structured-outputs-quickstart If you'd like, I can paste a minimal validated curl example you can reuse.