> ## 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.

# How do I generate a Word contract from a prompt?

> Describe the contract in prompt with format docx: Doconda writes it, lays it out with numbered clauses and flags the data you should check.

To generate a Word contract from a prompt, describe the contract in `prompt` with `format: "docx"`. Doconda writes
it, lays it out as a contract (with numbered clauses) and flags in the report any figures, dates or legal citations
that don't come from your request or your sources.

## Steps

1. Store your API key in `DOCONDA_API_KEY` and install the SDK (`pip install doconda` or `npm install @doconda/sdk`).
2. Describe the contract with the data you already know (parties, amounts, terms) and a style, if you want one.
3. Download the Word file and read the report before sending it.

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
  from pathlib import Path
  from doconda import Doconda

  doconda = Doconda()  # reads the key from DOCONDA_API_KEY
  doc = doconda.documents.create(
      format="docx",
      prompt="Residential lease agreement for €900 a month, with blue headings",
      name="Lease agreement",
  )
  Path("contract.docx").write_bytes(doconda.documents.download(doc["id"], "docx"))

  report = doconda.documents.report(doc["id"])
  for issue in report["issues"]:
      print(issue["code"], issue["message"])
  ```

  ```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
  import { writeFile } from "node:fs/promises"
  import { Doconda } from "@doconda/sdk"

  const doconda = new Doconda()
  const doc = await doconda.documents.create({
    format: "docx",
    prompt: "Residential lease agreement for €900 a month, with blue headings",
    name: "Lease agreement",
  })
  await writeFile("contract.docx", await doconda.documents.download(doc.id, "docx"))

  const report = await doconda.documents.report(doc.id)
  for (const issue of report.issues) console.log(issue.code, issue.message)
  ```
</CodeGroup>

## What you get back

* An editable Word file and its PDF. `doc.type` says what kind of document Doconda decided it is (here, a contract).
* Warnings in the report:
  * `content.unsupported_fact`: a figure, date or fact that isn't in your request or your sources.
  * `content.unsupported_citation` · `content.citation_to_review`: a legal citation (article, law, ruling) that
    doesn't come from your sources.
* In `standard` and `best`, `key_data`: the document's amounts, dates, tax IDs and IBANs, with their role (main amount,
  signing date, due date…).
* `status`: `ready`, `ready_with_warnings`, `needs_review` or `failed` (not charged).

## Limits

* If the request aims to deceive or cause harm (forgeries, impersonation), it fails with `request_refused` and isn't
  charged.
* With `quality: "fast"` you get the basic style; copying your template's design needs `standard` or `best`.

## FAQ

<AccordionGroup>
  <Accordion title="Can I base it on my files?">
    Yes. Upload them and pass them in `sources` (up to 5 documents): Doconda reads them before writing.
  </Accordion>

  <Accordion title="What if I already have the contract text?">
    Pass it in `content.markdown`: it's used as is and Doconda only lays it out.
  </Accordion>

  <Accordion title="Can I change a clause later?">
    Yes, with `operation: "edit"` and the `doc_…` id. New content follows the numbering of the existing clauses. See
    [Edit](/en/guides/edit).
  </Accordion>

  <Accordion title="Does it check that the amount in words matches the figure?">
    Yes: `money.words_mismatch` flags it, without correcting it. See [Review](/en/guides/review).
  </Accordion>
</AccordionGroup>

## Keep reading

* [Create](/en/guides/create#report-warnings) and [SDK: create documents](/en/sdk/create).
* [Quickstart](/en/quickstart).


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