> ## 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 convert Markdown to Word with styles via API?

> Send your Markdown in content and the look in one sentence to POST /documents with format docx: you get an editable .docx and its PDF.

To convert Markdown to Word with styles, send your text in `content.markdown` and describe the look in `style`
("Lora font, blue headings, with page numbers") with `format: "docx"`. Doconda lays the text out as is, applies the
style to the Word styles (`Normal`, `Heading 1`…) and returns the editable `.docx` and its PDF.

## Steps

1. Create an API key in the dashboard, under **API keys**, and store it in `DOCONDA_API_KEY`.
2. Install the SDK: `pip install doconda` or `npm install @doconda/sdk`.
3. Call `documents.create` with your Markdown and the style, and download the Word file.

<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",
      content={"markdown": "# Internal note\n\nMonday's meeting moves to 10:00."},
      style="Lora font, blue headings, with page numbers",
  )
  Path("note.docx").write_bytes(doconda.documents.download(doc["id"], "docx"))
  ```

  ```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",
    content: { markdown: "# Internal note\n\nMonday's meeting moves to 10:00." },
    style: "Lora font, blue headings, with page numbers",
  })
  await writeFile("note.docx", await doconda.documents.download(doc.id, "docx"))
  ```
</CodeGroup>

The Markdown supports headings, paragraphs, lists, tables, bold and italics, links, page breaks and images
(`![Caption](img:1)` for the first image in `sources`).

## What you get back

* An editable `.docx`: the look lives in the document's styles, so whatever you add later follows the same design.
* Its PDF, with the font embedded (`download(id, "pdf")`).
* `style_applied`: how the style was understood (font, colors, alignment…), so you can check it.
* `style_unsupported`: whatever you asked for that couldn't be applied. It is never silently ignored.
* `status`: `ready`, `ready_with_warnings`, `needs_review` or `failed` (not charged).

## Limits

* The text is used as is: Doconda doesn't rewrite it. If you want it written for you, use `prompt` instead of
  `content`.
* With `quality: "fast"` you get the basic style: font, size, colors, alignment, margins, cover page, table of
  contents, header and footer. Anything else comes back in `style_unsupported`.
* Copying the design of one of your files needs `standard` or `best`.

## FAQ

<AccordionGroup>
  <Accordion title="Which fonts can I use?">
    Any Google Fonts family, plus Calibri, Cambria, Arial, Times New Roman and Courier New. See
    [Style](/en/guides/style).
  </Accordion>

  <Accordion title="Can I use the API without the SDK?">
    Yes. It's a `POST https://api.eu.doconda.com/v1/documents` with the same body. See the [Quickstart](/en/quickstart).
  </Accordion>

  <Accordion title="Is it cheaper than creating from a sentence?">
    Yes. With your Markdown Doconda only lays it out, so it is faster and cheaper. See
    [pricing](/en/guides/account#pricing).
  </Accordion>

  <Accordion title="Can I get only the PDF?">
    Yes, with `format: "pdf"`.
  </Accordion>
</AccordionGroup>

## Keep reading

* [Create](/en/guides/create) and [Style](/en/guides/style).
* [Quickstart](/en/quickstart).


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