Document API is in alpha and subject to breaking changes while the contract and adapters continue to evolve. The current API is not yet comprehensive, and more commands and namespaces are being added on an ongoing basis.
Why use Document API
- Build automations without editor-specific code.
- Work with predictable inputs and outputs defined per operation.
- Check capabilities up front and branch safely when features are unavailable.
Reference
- Full operation reference: /document-api/reference/index
- Machine-readable files are available for automation use (contract schema, tool manifest, and agent compatibility artifacts).
Available operations
Use the tables below to see what operations are available and where each one is documented.| Editor method | Operation ID |
|---|---|
editor.doc.find(...) | find |
editor.doc.getNode(...) | getNode |
editor.doc.getNodeById(...) | getNodeById |
editor.doc.getText(...) | getText |
editor.doc.info(...) | info |
editor.doc.insert(...) | insert |
editor.doc.replace(...) | replace |
editor.doc.delete(...) | delete |
editor.doc.format.bold(...) | format.bold |
editor.doc.format.italic(...) | format.italic |
editor.doc.format.underline(...) | format.underline |
editor.doc.format.strikethrough(...) | format.strikethrough |
editor.doc.create.paragraph(...) | create.paragraph |
editor.doc.create.heading(...) | create.heading |
editor.doc.lists.list(...) | lists.list |
editor.doc.lists.get(...) | lists.get |
editor.doc.lists.insert(...) | lists.insert |
editor.doc.lists.setType(...) | lists.setType |
editor.doc.lists.indent(...) | lists.indent |
editor.doc.lists.outdent(...) | lists.outdent |
editor.doc.lists.restart(...) | lists.restart |
editor.doc.lists.exit(...) | lists.exit |
editor.doc.comments.add(...) | comments.add |
editor.doc.comments.edit(...) | comments.edit |
editor.doc.comments.reply(...) | comments.reply |
editor.doc.comments.move(...) | comments.move |
editor.doc.comments.resolve(...) | comments.resolve |
editor.doc.comments.remove(...) | comments.remove |
editor.doc.comments.setInternal(...) | comments.setInternal |
editor.doc.comments.setActive(...) | comments.setActive |
editor.doc.comments.goTo(...) | comments.goTo |
editor.doc.comments.get(...) | comments.get |
editor.doc.comments.list(...) | comments.list |
editor.doc.trackChanges.list(...) | trackChanges.list |
editor.doc.trackChanges.get(...) | trackChanges.get |
editor.doc.trackChanges.accept(...) | trackChanges.accept |
editor.doc.trackChanges.reject(...) | trackChanges.reject |
editor.doc.trackChanges.acceptAll(...) | trackChanges.acceptAll |
editor.doc.trackChanges.rejectAll(...) | trackChanges.rejectAll |
editor.doc.capabilities() | capabilities.get |
Common workflows
These patterns show how operations compose to cover typical tasks.Find and mutate
Locate text in the document, then replace it:Tracked-mode insert
Insert text as a tracked change so reviewers can accept or reject it:resolution with the resolved insertion point and inserted entries with tracked-change IDs.
Check capabilities before acting
Usecapabilities() to branch on what the editor supports:
Dry-run preview
PassdryRun: true to validate an operation without applying it:
Programmatic invocation
Every operation is also available through a dynamicinvoke method on the Document API instance. It accepts an operationId string and dispatches to the corresponding method. This is useful when the operation to run is determined at runtime (for example, from a tool-use payload).
invoke delegates to the same direct methods — there is no separate execution path. Type safety is available through InvokeRequest<T> for callers who know the operation at compile time, and DynamicInvokeRequest for dynamic dispatch.
