> ## Documentation Index
> Fetch the complete documentation index at: https://superdoc-caio-pizzol-docs-ai-core-preset.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Document Engine

> The programmatic layer for reading, editing, and saving .docx files.

Document Engine is SuperDoc's programmatic layer for `.docx` files. Use it when code needs to read, search, edit, format, comment, redline, or save a Word document.

It powers browser editor workflows through `editor.doc.*`, backend automation through the SDKs, and shell workflows through the CLI.

<Note>
  **Building with AI?** Start with [Use SuperDoc with AI](/getting-started/ai). AI integrations use the same document operations, but the setup path depends on whether you're using MCP, SDK tool definitions, or a visible editor.
</Note>

## Surfaces

Three surfaces, same operations underneath.

| Surface                                | Best for                                  | Runtime   |
| -------------------------------------- | ----------------------------------------- | --------- |
| [Document API](/document-api/overview) | Programmatic edits against an open editor | Browser   |
| [SDKs](/document-engine/sdks)          | Node / Python backend automation          | Server    |
| [CLI](/document-engine/cli)            | Shell scripts and CI pipelines            | Any shell |

## How it works

The Document API is the operation contract. It defines every document action SuperDoc supports (search, replace, insert, format, comments, tracked changes, lists, tables) as a typed input/output pair.

* The **browser editor** exposes those operations as `editor.doc.*`.
* The **SDKs** manage a CLI process and expose the same operations as typed Node and Python methods.
* The **CLI** runs in persistent sessions: open a document, run operations, save and close. Each operation takes arguments and emits JSON output.

All three call the same underlying engine. A redline written by your backend, a CI script, and a browser editor produce the same result on the same `.docx` file.

## Which surface should I use?

| Your setup                                    | Start here                                                                       |
| --------------------------------------------- | -------------------------------------------------------------------------------- |
| Web app with a visible editor                 | [Document API](/document-api/overview)                                           |
| Custom UI around a visible editor             | [Custom UI](/editor/custom-ui/overview) + [Document API](/document-api/overview) |
| Backend automation (Node / Python)            | [SDKs](/document-engine/sdks)                                                    |
| Shell scripts or CI                           | [CLI](/document-engine/cli)                                                      |
| Serverless function (Lambda, Vercel, Workers) | [SDKs](/document-engine/sdks) or [CLI](/document-engine/cli)                     |
| Claude Code, Cursor, Windsurf, or model tools | [Use SuperDoc with AI](/getting-started/ai)                                      |

## Where to next

<CardGroup cols={2}>
  <Card title="Document API" icon="code" href="/document-api/overview">
    The operation contract. Every method the editor and SDKs share.
  </Card>

  <Card title="SDKs" icon="box" href="/document-engine/sdks">
    Node and Python typed methods for backend automation
  </Card>

  <Card title="CLI" icon="terminal" href="/document-engine/cli">
    Scriptable DOCX operations from the shell
  </Card>

  <Card title="Diffing" icon="git-compare" href="/document-engine/diffing">
    Compare two DOCX files. Produce a redlined third document.
  </Card>
</CardGroup>
