> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doconda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create

> A new document from a sentence, from your Markdown or using your files.

`operation: "create"` is the default operation. It needs **one** of `prompt` or `content`, and optionally `format`: `docx` (Word + PDF), `pdf` (PDF only), `pptx`
(PowerPoint + PDF), `xlsx` (Excel + PDF) or `artifact` (a web page with its data). If you leave it out, Doconda infers it
from your `prompt`.

Inside a Word file or a PDF, Doconda decides on its own what kind of document it is (report, letter, contract, memo, minutes) and gives it
its base layout: a contract gets a serif font, justified text and numbered clauses; a letter, no page numbers.
When in doubt, a report. You don't pick it: describe it in `prompt` and adjust the look with `style`.

<Tabs>
  <Tab title="From your text">
    ```json theme={null}
    {
      "format": "docx",
      "content": { "markdown": "# Leave request\n\nDear Ms. García: ..." },
      "style": "blue headings"
    }
    ```

    The Markdown supports headings, paragraphs, lists, tables, bold/italic, links, page breaks and [images](#images). The text is used as is.
  </Tab>

  <Tab title="From a sentence">
    ```json theme={null}
    {
      "format": "docx",
      "prompt": "Report on the housing law with blue headings, centred"
    }
    ```

    A model writes the content and understands the style requested in the same sentence.
  </Tab>

  <Tab title="With your files">
    ```json theme={null}
    {
      "format": "pdf",
      "prompt": "Summarise this in 2 pages",
      "sources": ["file_01JAB3..."]
    }
    ```

    Upload the files first with [`POST /files`](/en/api-reference/introduction), or use a document Doconda already made by its id (`doc_…`). `sources` takes your documents (Word, PowerPoint, Excel, PDF, also `.doc`, `.ppt` and `.xls`, TXT or Markdown, up to 5) and your [images](#images) (up to 10), together. [Other ways to pass files](/en/guides/extract#four-ways-to-pass-a-file).
  </Tab>
</Tabs>

## How it's made

The same for every format, the way a good professional works at their computer: an AI agent reads the format's manual,
writes a small program that builds the file, runs it in an isolated sandbox (no internet), checks it and, when
something is wrong, **fixes the program** and runs it again (it never patches the file by hand). Then it delivers it and
Doconda reviews it one last time.

| `format` | How it builds it | How it checks it |
| - | - | - |
| `docx`, `pdf` | A docx-js program; the look goes in Word's styles (Normal, Heading 1…), so the file stays editable. The PDF comes from that Word. | Word validator, our review and the pages turned into images. |
| `pptx` | With a template (the one Doconda picks from its library, or yours): it copies its slides, orders them and changes their text. Without one: a pptxgenjs program with its theme, named layouts and native charts; the theme is saved in the PowerPoint, so whatever you add later follows it. 16:9. | PowerPoint validator (against the template, if any) and the slides as images. |
| `xlsx` | An openpyxl program: real formulas (not copied numbers), assumptions in their own cells, `INDEX`/`MATCH` instead of `XLOOKUP` or `FILTER`. It tests two or three formulas before writing the rest. | Recalculates every formula until no error is left (`#REF!`, `#DIV/0!`…) and looks at the sheets. |
| `artifact` | A short design plan, a check of what the page can do (data in `doconda.db`, allowed libraries) and a single HTML with everything inside. See [artifacts](/en/guides/artifacts). | Screenshots on desktop and phone, and it fixes what looks wrong. |

Everything stays editable: text, shapes, charts and formulas, not pictures.

```json theme={null}
{ "format": "pptx", "content": { "markdown": "# Q3 report\n\n## Sales\n\n- Up 12%\n\n| Month | Amount |\n|---|---|\n| July | €12,300 |" } }
```

## Images

Word, PowerPoint and Excel can include images, yours or from the internet:

```json theme={null}
{
  "format": "docx",
  "prompt": "Report on the office refurbishment with the photos",
  "sources": ["file_presupuesto.pdf...", "file_foto1.jpg...", "file_foto2.jpg..."]
}
```

* **Yours**: upload them with [`POST /files`](/en/api-reference/introduction) (PNG, JPEG, GIF or WebP) and pass them in `sources`,
  alongside your documents if any (up to 10 images). Doconda works out on its own what each file is: documents are
  material to write from, and images go inside the document, where they fit.
* **With your own Markdown**, `sources` only holds images: place them on their own line with `![Caption](img:1)`
  (`img:1` is the first image in `sources`, `img:2` the second…).
* **From the internet**: the AI can search for an image when it adds something (a place, a product, a logo); in your Markdown,
  `![Caption](web:what to search for)` or a direct link. The source goes in the caption and the report flags each
  one (`image.web_source`) so you can check you're allowed to use it.
* In Word they're centred and fitted to the width, with their caption; in PowerPoint, next to the slide text; in Excel,
  beside the table.
* If an image can't be placed, the document still comes out and the report says so (`image.unavailable`).

## Quality levels

`quality` sets how much effort goes into the file. **The path is the same at every level** (the one
[above](#how-its-made)); what changes is the model, how many steps the agent may take and how many times it looks at
the pages. Each level has its own price ([pricing](/en/guides/account#pricing)).

| `quality` | Model | Steps | Looks at the pages | Text checks |
| - | - | - | - | - |
| `fast` | fast | 25 | 1 | facts you didn't give |
| `standard` | writer | 40 | 2 | + quality, key data and reader test |
| `best` | the best available | 60 | 4 | + quality, key data and reader test |
| `auto` (default) | Doconda picks the level your request needs. When in doubt, the cheaper one. | | | |

With `auto`, `max_quality` sets a cap: `"max_quality": "standard"` never goes above standard. The document says which
level was used and why in `quality` (`requested`, `level`, `reason`), and the path in `route` (`agent`, or `fast` if
the agent isn't available).

For example, "Presentation for investors" usually goes to `best`; "Draft minutes of the meeting", to `fast`. If you ask
for comments or tracked changes when you [edit](/en/guides/edit), or to use your template, `auto` picks `best`.

If the agent can't finish, Doconda makes it on its fast path (it writes the text and its engine lays it out), says so
(`agent.fallback`) and, if it was `best`, charges it as `standard`. The `quality.chosen`, `agent.step` and
`agent.checked` events show the progress.

## Copy the design of a file

Put the file whose look you want to copy (a presentation, a Word, an Excel, a PDF or a picture) in `sources` and say it
in the request: "with the design of our template". Doconda tells which source is the design; the rest stays material
for the content. The `design.chosen` event says which file it used.

* **A presentation for a presentation**: the agent uses it as the template (copies its slides and fills them).
* **Any other pair** (a reference Word, a PDF, a screenshot): the agent copies its fonts, colours, margins, header and
  footer, logo and cover.
* At any level. If the agent couldn't finish, the document gets its own design and the report says so
  (`design.not_copied`).

## Options

<ParamField body="name" type="string">
  A name to find it later ("Malasaña flat lease", up to 200 characters). Also works for review,
  edit and read. Files download with that name (`Malasana flat lease.docx`).
</ParamField>

<ParamField body="metadata" type="object">
  Your own key-value pairs (each value up to 500 characters), returned as is.
</ParamField>

<Tip>Use `?dry_run=true` to validate the request and the style without generating anything.</Tip>

## What Doconda understands and checks on its own

* **The format, if you don't say.** From a sentence ("a residential lease…", "a presentation for the board…") Doconda
  infers the `format`, the kind of document, the language and, for an artifact, whether its data is shared or per
  visitor. If the format isn't clear, the document fails with `format_unclear` (and isn't charged) instead of guessing.
  The `request.understood` event says what it understood (`format` and `type`) and how confident it is.
* **Sources with instructions for the AI.** If a source tries to tell the AI to do something else, it isn't followed and the
  report flags it (`source.instructions`).
* **Data you didn't provide.** Before delivering, the agent removes figures, dates and citations that aren't in your
  request or your sources (or leaves a visible gap such as \[DATA]). If one still slips through, the report flags it
  (`content.unsupported_fact`), so you can check it before sending it.
* **Legal citations.** Articles, laws, regulations and rulings that don't come from your request or your sources are
  flagged (`content.unsupported_citation`); if the AI isn't sure, they're left as information to check by hand
  (`content.citation_to_review`).
* **Harmful requests.** Documents meant to deceive or cause harm (forgeries, impersonation, pages asking for
  passwords or cards) fail with `request_refused` and aren't charged; if in doubt, they're made and the report flags it
  (`request.review`).
* **The industry and its checklist.** Doconda recognises the industry (legal, healthcare, accounting…) and the type of document
  within it, and writes following its guide; your instructions take precedence over it. When it's done it checks the industry's
  "before delivery" checklist: the `quality.checked` event gives a score from 0 to 100 and every item that isn't met
  appears in the report (`quality.check_failed`).
* **Long sources.** If your sources don't fit in full, Doconda keeps the passages about what you're asking for
  (`source.selected` says how much was used).
* **Key data.** The report includes `key_data`: amounts, dates, tax IDs and IBANs in the document, with their role
  (main amount, signing date, due date…).
* **Reader test.** Doconda imagines the questions a reader of the document will ask, and another AI, which only sees the
  document, tries to answer them. Whatever it can't find appears in the report (`content.unclear`: "doesn't give the start
  date"), as do internal contradictions (`content.contradiction`). Only when the AI writes the text.

<Note>The first three, in the regions where our judgment model is active (elsewhere, `format` is required). The reader test, in all of them.</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.