Skip to main content
Structured output is a language model’s response in a format that follows a schema, usually JSON validated against JSON Schema, so a program can read it without ambiguity. File output is a finished document, such as a DOCX, an XLSX or a PDF, that a person opens in their own program. They are not alternatives. Structured output is for machines and file output is for people, and a good document API returns both: the file, and a JSON record that describes it.

Why it matters for generated documents

  • Models don’t return binary files reliably. They produce text or JSON, and another step turns it into a file.
  • The record drives the application. Status, page count and links let the application decide without opening the document.
  • Agents need summaries, not files. Returning the whole file to an agent wastes its context; a link and a short summary are enough.
  • Extraction is the reverse path. Reading a file’s content as text, for example Markdown, turns file output back into something a model can use.

Structured and file output in Doconda

Every document is a JSON object with its status, pages, quality and style_applied, and, once finished, its files in outputs: the Word file and its PDF, plus one preview per page, for example. Each output’s url is a signed link valid for 5 minutes; get fresh ones with GET /documents/{id}/outputs. The SDK tools return only a short summary with status and links, so the agent’s context stays small. For the reverse path, POST /v1/convert with to: "md", txt, html or csv returns the content in text, in the response itself.

Quickstart

See a document’s JSON and download its files.

What is tool calling

How a model requests structured actions.

What is Markdown

The text format models read and write best.

Convert a file

Turn a file back into text.