Structured Outputs
An LLM API feature that constrains a model's response to a developer-supplied JSON Schema, so the output is valid, machine-readable JSON with the required fields and allowed values.

Schema-constrained LLM responses that software can parse reliably, used for classification, reporting and agent tool calls.
Key Points
- ✓Structured outputs force an LLM's response to match a JSON Schema, guaranteeing required keys, types and allowed enum values
- ✓Offered by OpenAI (json_schema response format and strict function calling), Anthropic (JSON outputs and strict tool use) and Google Gemini
- ✓Unlike older JSON mode, which only guaranteed valid JSON, structured outputs also guarantee schema adherence
- ✓Providers support only a subset of JSON Schema, and refusals or token-limit cut-offs need separate handling
- ✓Marketing uses include comment classification, JSON reports for dashboards, post drafts with separate fields and safe agent tool calls
Structured outputs are a feature of large language model APIs that forces the model's response to match a JSON Schema supplied by the developer. Instead of free-form text that a program has to parse and hope is complete, the model returns JSON with exactly the keys, types and allowed values the schema defines. OpenAI describes the benefit plainly: you no longer have to worry about the model omitting a required key or inventing an invalid enum value 1.
How structured outputs work
The developer sends a JSON Schema along with the request. The provider then constrains generation so that only tokens producing valid output for that schema can be chosen. OpenAI, Anthropic and Google all offer this:
- OpenAI supports it as a response format (
json_schemawithstrict: true) and in function calling withstrictmode 1. - Anthropic offers JSON outputs through
output_config.formatand strict tool use (strict: true), which guarantees that tool names and inputs match their schemas 2. - Google's Gemini API accepts a JSON Schema with an
application/jsonresponse type and supports enums for classification tasks 3.
JSON Schema itself is an open vocabulary for describing the shape of JSON data: which properties exist, their types, which are required and which values are allowed 4.
Structured outputs versus JSON mode
Earlier "JSON mode" features only guaranteed that the response was valid JSON. They did not guarantee that it matched a particular schema, so fields could still be missing or wrongly typed. Structured outputs add schema adherence on top of valid JSON 1. Before these features existed, developers relied on prompt instructions and retries, which were much less reliable 5.
Example: classifying social media comments
Suppose a team wants an LLM to label incoming comments for a sentiment analysis dashboard. Without a schema, the model might answer with a paragraph. With a schema, every response looks like this:
{"post_id": "12345", "sentiment": "positive", "confidence": 0.87, "key_themes": ["product_quality", "customer_service"]}
If the schema restricts sentiment to an enum of positive, negative and neutral, the model cannot return "somewhat positive", and the dashboard never breaks on an unexpected label.
Practical uses in marketing workflows
- Content classification: tag posts or comments by topic, sentiment or target audience with a fixed set of labels.
- Reporting: have a model summarise campaign results as JSON that feeds straight into an analytics dashboard or a KPI report.
- Post drafting: generate a post as an object with separate fields for text, hashtags and target platforms, so a script can check character limits before scheduling.
- Agent tool calls: when an AI agent calls a tool, strict tool schemas make sure the arguments are valid before anything is executed. This is how agents call publishing tools on an MCP server, such as Publora's, safely 2.
Limitations and best practices
- Schema support is partial. Providers support a subset of JSON Schema. OpenAI requires
additionalProperties: falsein strict mode 1, and Anthropic's docs list unsupported features such as recursive schemas, numeric minimum and maximum, and string length constraints 2. - Refusals and cut-offs are special cases. A safety refusal does not follow the schema; OpenAI returns it in a separate
refusalfield, and a response that hits the token limit can be incomplete 1. - Valid is not the same as correct. The schema guarantees shape, not truth. A perfectly formatted sentiment label can still be wrong, so spot-check results.
- Keep schemas simple. Use clear property names and descriptions, start with flat structures and add nesting only when needed 5.
Structured outputs are related to function calling: both use JSON Schema, but function calling asks the model to choose and fill in a tool call, while structured outputs shape the final answer.
Publora and Structured Outputs
The Publora API and MCP server publish and schedule posts to 10 networks from your own code or from AI assistants like Claude, ChatGPT and Cursor.
See the Publora API →