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

# Word guide

> Generate and edit .docx files — letters, reports, memos, contracts.

The Word endpoint produces professional `.docx` output with proper heading
hierarchy, line spacing, tables, and (optionally) images. The agent auto-
accepts the inline preview diff on the backend, so edits apply immediately
— no user-in-the-loop required.

## What the Word agent can do

Ordered roughly from "used in almost every document" to specialized:

* **Paragraph and run styling** — heading levels, body styles, custom
  paragraph styles; bold, italic, underline, strikethrough, double
  strikethrough, superscript, subscript, all-caps, small-caps, hidden,
  highlight color, shading color, custom font + size + color; per-run
  hyperlinks; line spacing, space-before / space-after, indents,
  alignment (left / center / right / justify).
* **Lists** — bulleted and numbered, with custom markers and nesting
  levels; per-paragraph indent + marker control for designs like
  `• …` / `–  …` / `1.  …`.
* **Tables** — headered tables with shaded header row, per-cell
  borders and shading, cell merge / split, column-width control,
  alignment per cell, text formatting inside cells.
* **Document structure** — headers, footers (with left/center/right
  sections), section breaks (continuous, next-page, even/odd), column
  breaks, multi-column page layouts, drop caps, watermarks, page
  numbering fields.
* **Media** — images, charts (same chart types as Excel), shapes,
  text boxes (linked or standalone).
* **Citations as hyperlinks** — inline links to sources; pass
  `context_files` to give the agent specific references to cite.
* **Footnotes and endnotes** — full per-note content, with automatic
  renumbering.
* **Review / collaboration** — comments (with threaded replies and
  resolve), tracked-changes (accept / reject, individually or all at
  once).
* **References** — cross-references to headings, bookmarks, footnotes,
  tables, figures; merge fields for mail-merge flows; form controls
  (rich text, plain text, drop-down, checkbox); sub-documents and
  master-doc structure; document compare.
* **Equations / math** — full Equation schema for fractions, radicals,
  limits, integrals, sums, matrices, Greek letters. Renders natively
  in the embedded viewer and in any downloaded `.docx`.
* **Styles catalog** — create new paragraph / character styles, modify
  or delete existing ones, set a document-wide default style.
* **Page fields** — date, time, page number, total pages, file name,
  author; auto-updated on open.

Describe the document's purpose, audience, and tone in your prompt;
the agent picks the right styles, layouts, and structure. You can
steer with explicit hints ("use two-column layout for the analysis
section", "start Chapter 1 with a drop cap", "legal / contractual
tone") and the agent respects them.

## Quickstart

```python theme={null}
resp = requests.post(
    f"{API}/word/generate",
    headers={"X-API-Key": KEY},
    json={
        "prompt": (
            "Write a formal acceptance letter for an engineering manager role "
            "at Acme Corp dated April 17, 2026. Signed by Jane Smith."
        ),
    },
)
```

Output: a 3+ paragraph letter with header/footer, proper typography,
date right-aligned, sign-off block.

## Common patterns

### Reports

```python theme={null}
prompt = """
Produce a 4-page Q3 business review report for Acme SaaS:
- Executive summary (2 paragraphs)
- Revenue & growth (analysis paragraphs, one bullet list)
- Product highlights (3 subsections)
- Q4 priorities

Tone: professional, concise. Use Heading 1/2 hierarchy.
"""
resp = requests.post(f"{API}/word/generate", headers=headers,
                     json={"prompt": prompt})
```

The agent writes in sections with clean heading hierarchy, 1.15 line
spacing, and an accent color on H1s.

### Letters and memos

```python theme={null}
prompt = (
    "Write a formal termination letter. "
    "Recipient: Mr. John Doe, Senior Consultant, Acme LLC, 123 Broadway, NY 10001. "
    "Reason: ending of contract at end of current term (June 30, 2026). "
    "Tone: polite, firm. "
    "Include sign-off for Jane Smith, CEO."
)
```

### Editing an existing document

```python theme={null}
# 1. Upload
upload = requests.post(
    f"{API}/files",
    headers=headers,
    files={"file": open("draft_contract.docx", "rb")},
    data={"purpose": "init"},
).json()

# 2. Edit
resp = requests.post(f"{API}/word/generate", headers=headers, json={
    "prompt": "Replace the payment terms section with net-30 payment terms.",
    "init_file": upload["file_id"],
})
```

The agent:

1. Inspects the document to find the existing payment-terms section
2. Generates a `PreviewActionPlan` with the replacement
3. Auto-accepts the diff (no user clicking needed)
4. Returns the updated `.docx`

### Working with images

Upload images first, then reference them by `image_id`:

```python theme={null}
hero = requests.post(
    f"{API}/images",
    headers=headers,
    files={"file": open("logo.png", "rb")},
    data={"tags": '["logo"]'},
).json()

resp = requests.post(f"{API}/word/generate", headers=headers, json={
    "prompt": "Draft a company prospectus with our logo at the top",
    "image_assets": [{"image_id": hero["image_id"], "tags": ["logo"]}],
})
```

If you reference "logo" or "hero image" in the prompt but don't attach
images, the [preflight validator](/concepts/preflight) will reject the
request upfront.

## Writing quality

The underlying agent is tuned for professional prose. It avoids:

* Banned words: delve, leverage, utilize, robust, seamless, cutting-edge, etc.
* Banned transitions: Furthermore, Moreover, Additionally, In summary...
* Banned phrases: "in today's fast-paced world", "at the end of the day"
* Em dashes as a stylistic tic (max one per page)

The output reads like senior human professional work. If you want a
specific tone, specify it: "formal academic", "conversational but direct",
"legal/contractual". The agent obeys tone instructions.

## Things to watch for

* **Table of contents is not generated** today. If your prompt asks for
  a TOC, the agent skips it and notes the omission in `summary`.
* **Long documents (>5 pages)** are built page-by-page. Specify "first
  page preview only" if you want a quick iteration.
