mutations.preview
Dry-run a mutation plan, returning resolved targets without applying changes.
doc.mutations.preview(…)Expected result
Returns a MutationsPreviewOutput with resolved targets and step details without applying changes.
Inputs
atomictruerequiredMust be true. All steps execute as one atomic transaction.
changeMode"direct" | "tracked"requiredRequired. Use 'direct' for immediate edits or 'tracked' for suggestions. Must always be provided.
stepstext.rewrite | text.insert | text.delete | format.apply | structural.replace | assert | comments.patch | trackChanges.decide[]requiredOrdered array of mutation steps. Each step needs 'op' (text.rewrite, text.insert, text.delete, format.apply, structural.replace, assert, comments.patch, or trackChanges.decide). Core steps use 'where'; review steps use explicit native args and require direct body-only plans with relocations before decisions. Check runtime capabilities for operation-specific content and targeting restrictions.
4 additional input fields
inStoryLocatorStory scope. Defaults to document body when omitted. Use {kind:'story', storyType:'body'} for body, or other storyType values for headers, footers, footnotes, endnotes.
body
kind"story"requiredstoryType"body"requiredheaderFooterSlot
kind"story"requiredstoryType"headerFooterSlot"requiredsectionSectionAddressrequiredFields
kind"section"requiredsectionIdstringrequiredheaderFooterKind"header" | "footer"requiredvariant"default" | "first" | "even"requiredresolution"effective" | "explicit"onWrite"materializeIfInherited" | "editResolvedPart" | "error"headerFooterPart
kind"story"requiredstoryType"headerFooterPart"requiredrefIdstringrequiredfootnote
kind"story"requiredstoryType"footnote"requirednoteIdstringrequiredendnote
kind"story"requiredstoryType"endnote"requirednoteIdstringrequiredtextbox
kind"story"requiredstoryType"textbox"requiredtextboxIdstringrequiredauthorobjectDisplay author for one tracked body text plan. Accepts only name; does not change the session user or inherit its email. Unsupported step combinations are rejected before mutation.
Fields
namestringrequiredexpectedRevisionstringDocument revision for optimistic concurrency. Mutation fails if document was modified since this revision.
detailobjectFields
offsetnumberlimitnumberResult
Output fields
evaluatedRevisionstringrequiredstepsobject[]requiredvalidbooleanrequiredfailuresobject[]Failures
Pre-apply throws
REVISION_MISMATCHMATCH_NOT_FOUNDAMBIGUOUS_MATCH
17 more codes
STYLE_CONFLICTPRECONDITION_FAILEDINVALID_INPUTCROSS_BLOCK_MATCHSPAN_FRAGMENTEDTARGET_MOVEDPLAN_CONFLICT_OVERLAPINVALID_STEP_COMBINATIONREVISION_CHANGED_SINCE_COMPILEINVALID_INSERTION_CONTEXTDOCUMENT_IDENTITY_CONFLICTCAPABILITY_UNAVAILABLESTORY_NOT_FOUNDSTORY_MISMATCHSTORY_NOT_SUPPORTEDCROSS_STORY_PLANMATERIALIZATION_FAILED
Raw schemas
Open the generated JSON artifact for the exact input, output, success, and failure schemas represented by this contract version.
View raw JSON schemas