Why Define Output Schema?
Consistent Responses
Ensure every response follows the same structure
Documentation
OpenAPI docs show exactly what callers receive
Validation
Catch malformed LLM responses before they reach your app
Type Safety
Frontend/backend code can rely on specific fields
Adding Output Fields
Navigate to your endpoint’s Output Schema tab and click Add Field.Field Configuration
Output fields are never “required” in the traditional sense—they define what the LLM should return. If the LLM doesn’t include a field, it will be omitted from the response.
Field Types
Output schemas support the same types as input schemas:- String
- Number
- Boolean
- Array
- Object
- Image
Prompting for Structured Output
Your prompt must instruct the LLM to return JSON matching your schema. Here’s the pattern:Example Schemas
Sentiment Analysis
Output Schema:Content Classification
Output Schema:Text Extraction
Output Schema:Response Validation
When an output schema is defined, Endprompt:- Parses the LLM response as JSON
- Validates against your schema
- Returns the validated response
JSON Schema Preview
The Output Schema tab shows the complete JSON Schema:Best Practices
Keep schemas simple
Keep schemas simple
Flat structures are easier for LLMs to produce consistently than deeply nested ones.
Be explicit in prompts
Be explicit in prompts
Tell the LLM exactly what JSON structure you expect, including field names.
Use descriptive field names
Use descriptive field names
Field names like
is_spam are clearer than spam or s.Document everything
Document everything
Add descriptions to every field—they appear in your OpenAPI docs.
Test edge cases
Test edge cases
Test with unusual inputs to see if the LLM still produces valid JSON.
Without Output Schema
If you don’t define an output schema:- The raw LLM response is returned
- No JSON parsing or validation occurs
- The response may be plain text or unstructured
Next Steps
Create a Prompt
Write prompts that produce structured output
Test Your Endpoint
Verify your schema works with real requests

