Skip to main content
The SuperDoc CLI lets you open, query, and edit .docx files from any shell. It exposes the same operations as the Document API through a stdio-based process.

Installation

Or run without installing:

Workflow

The CLI uses persistent sessions. Open a document, run operations, then save and close.

Edit an existing document

Use query match for edits against existing content because it returns mutation-ready targets with explicit cardinality.

Generate a synthetic document body

Use open --content-override when you want to seed a document body from Markdown, HTML, or plain text:
For generation, start with content-override or insert. Do not begin with query match unless you are modifying pre-existing content.

Seed text, then reuse the insert receipt target

For deterministic probe docs, insert the text first and format the returned range directly:
The insert receipt exposes the resolved insertion point under receipt.resolution.target. For replace, delete, and format.*, prefer canonical SelectionTarget JSON or a mutation-ready ref. The CLI still accepts legacy single-block text ranges such as {"kind":"text","blockId":"...","range":{"start":0,"end":9}} and upgrades them automatically for compatibility, but new scripts should use the canonical selection form.

Inline tabs and line breaks

insert tab and insert line-break create real inline Word nodes in the current paragraph:
This is different from paragraph tab stops. Tab stops define layout positions on the paragraph. Tab nodes and line-break nodes are inline document content that export as w:tab and w:br.

Tracked mode for mutations

Use --tracked on mutating commands to apply edits as tracked changes instead of direct edits.
--tracked is shorthand for --change-mode tracked:
For commands that do not support tracked mode, the CLI returns TRACK_CHANGE_COMMAND_UNAVAILABLE.

User identity

By default, the CLI attributes edits to a generic “CLI” user. Pass --user-name and --user-email on open to identify your automation in comments, tracked changes, and collaboration presence:

Commands

Lifecycle

Document operations

The CLI exposes all Document API operations as commands. The command name matches the operation’s member path, converted to kebab-case: Run superdoc --help for the full list, or superdoc describe for machine-readable metadata.

Session management

Introspection

JSON I/O

All commands accept --input-json or --input-file for structured input and return JSON output. Use superdoc call <operationId> for raw operation invocation:
In --output json mode, command results are returned as a JSON envelope. Use --quiet to suppress non-essential warnings in pretty mode.
  • SDKs: typed Node.js and Python wrappers over the CLI
  • Document API: the in-browser API that defines the operation set