> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superdoc.dev/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](https://docs.superdoc.dev/getting-started/ai.md). 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.

## Surfaces

Three surfaces, same operations underneath.

| Surface | Best for | Runtime |
| - | - | - |
| [Document API](https://docs.superdoc.dev/document-api/overview.md) | Programmatic edits against an open editor | Browser |
| [SDKs](https://docs.superdoc.dev/document-engine/sdks.md) | Node / Python backend automation | Server |
| [CLI](https://docs.superdoc.dev/document-engine/cli.md) | 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](https://docs.superdoc.dev/document-api/overview.md) |
| Custom UI around a visible editor | [Custom UI](https://docs.superdoc.dev/editor/custom-ui/overview.md) + [Document API](https://docs.superdoc.dev/document-api/overview.md) |
| Backend automation (Node / Python) | [SDKs](https://docs.superdoc.dev/document-engine/sdks.md) |
| Shell scripts or CI | [CLI](https://docs.superdoc.dev/document-engine/cli.md) |
| Serverless function (Lambda, Vercel, Workers) | [SDKs](https://docs.superdoc.dev/document-engine/sdks.md) or [CLI](https://docs.superdoc.dev/document-engine/cli.md) |
| Claude Code, Cursor, Windsurf, or model tools | [Use SuperDoc with AI](https://docs.superdoc.dev/getting-started/ai.md) |

## Where to next

> [card] [Document API](https://docs.superdoc.dev/document-api/overview.md)
>
> The operation contract. Every method the editor and SDKs share.

> [card] [SDKs](https://docs.superdoc.dev/document-engine/sdks.md)
>
> Node and Python typed methods for backend automation

> [card] [CLI](https://docs.superdoc.dev/document-engine/cli.md)
>
> Scriptable DOCX operations from the shell

> [card] [Diffing](https://docs.superdoc.dev/document-engine/diffing.md)
>
> Compare two DOCX files. Produce a redlined third document.


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