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

# Word and PowerPoint template API

> Generate a Word file or a PowerPoint from your template by API: pass the file in sources and ask for "the design of our template".

To generate a Word file or a PowerPoint from your template with Doconda's API, upload the template, pass it in
`sources` and say so in the request: "with the design of our template". Doconda writes the content and copies the
design. It is not a placeholder engine (`{name}`, mail merge): if you already have the data and want to fill in blanks,
look at [Carbone](/en/compare/carbone) or [Docmosis](/en/compare/docmosis).

## Steps

1. Put your API key (dashboard → **API keys**) in `DOCONDA_API_KEY` and install the SDK (`pip install doconda` or
   `npm install @doconda/sdk`).
2. Upload the template and, if you like, the files with the material for the content.
3. Create the document with the template in `sources` and mention it in the `prompt`:

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

  doconda = Doconda()  # reads the key from DOCONDA_API_KEY
  template = doconda.files.upload("company-template.pptx")
  data = doconda.files.upload("q3-results.xlsx")

  doc = doconda.documents.create(
      format="pptx",
      prompt="Quarterly results for the board, with the design of our template",
      sources=[template["id"], data["id"]],
  )
  open("results.pptx", "wb").write(doconda.documents.download(doc["id"], "pptx"))
  ```

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

  const doconda = new Doconda()
  const template = await doconda.files.upload(await readFile("company-template.docx"), "company-template.docx")

  const doc = await doconda.documents.create({
    format: "docx",
    prompt: "Office renovation report, with the design of our template",
    sources: [template.id],
  })
  await writeFile("report.docx", await doconda.documents.download(doc.id, "docx"))
  ```
</CodeGroup>

## What gets copied

* **A presentation for a presentation** is used as a template: the result starts from its slides.
* **Any other file** (a Word file, an Excel file, a PDF or a PNG, JPEG or WebP image): its fonts, colors, margins,
  header and footer, logo and cover are copied.
* The other files in `sources` are still material for the content (up to 5 documents).
* The `design.chosen` event says which file was used for the design.

## What you get back

* An editable `.docx` or `.pptx`, with its PDF. The look lives in the document's styles (in Word, Normal, Heading 1…),
  so whatever you add later follows the same design.
* `status`: `ready`, `ready_with_warnings`, `needs_review` or `failed` (not charged).
* A report (`documents.report(id)`) that flags, for example, figures that aren't in your request or your sources.

## Quality limits

Copying the design works in `standard` and `best`. In `fast` the document comes out with its own design and the report
says so (`design.not_copied`). With `quality: "auto"` (the default), copying the design of a file that isn't a
PowerPoint template for a presentation picks `best`. See [quality levels](/en/guides/create#quality-levels).

## FAQ

<AccordionGroup>
  <Accordion title="Can I fill in fields like {customer} or {amount}?">
    No: Doconda doesn't replace placeholders, it copies the design and writes the content. To merge JSON data into a
    template with placeholders, compare [Carbone](/en/compare/carbone) and [Docmosis](/en/compare/docmosis).
  </Accordion>

  <Accordion title="What if I already have the text written?">
    To use a file's design you pass it in `sources`, and documents in `sources` only work with `prompt`. If you only need
    a style, describe it in `style` in your own words: see [style](/en/guides/style).
  </Accordion>

  <Accordion title="How much does it cost?">
    You pay per delivered document, by level: creating from a sentence costs €0.50 in `standard` and €1.50 in `best`.
    See [pricing](/en/guides/account#pricing).
  </Accordion>
</AccordionGroup>

## Keep reading

* [Create](/en/guides/create#copy-the-design-of-a-file): copying the design of a file.
* [Documents in your brand's style](/en/answers/brand-style-documents).
* [Quickstart](/en/quickstart).


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