These are the recommended patterns for new integrations.
Plan with query.match, then apply with mutations
This is the recommended default for most apps: match first, preview, then apply.
Run multiple edits as one plan
When several changes should stay together, group them into one plan:
Quick search and single edit
For lightweight text edits, use query.match and apply against the matched block range:
Tracked-mode insert
Insert text as a tracked change so reviewers can accept or reject it:
The receipt includes a resolution with the resolved insertion point and inserted entries with tracked-change IDs.
Check capabilities before acting
Use capabilities() to branch on what the editor supports:
Cross-session block addressing
When you load a DOCX, close the editor, and load the same file again, sdBlockId values change — they’re regenerated on every open. For cross-session block targeting, use query.match addresses (NodeAddress with kind: 'block'), which carry DOCX-native paraId-derived IDs when available.
This pattern is common in headless pipelines: extract block references in one session, then apply edits in another.
nodeId stability depends on the ID source. For DOCX-imported content, nodeId comes from paraId when available and is best-effort stable across loads. For nodes created at runtime, it falls back to sdBlockId, which is volatile.
No ID is guaranteed to survive all Microsoft Word round-trips. Re-extract addresses after major external edits or transformations, since Word (or other tools) may rewrite paragraph IDs and SuperDoc may rewrite duplicate IDs on import.
Dry-run preview
Pass dryRun: true to validate an operation without applying it: