Document apiReferenceFields

fields.insert

Insert a raw field code at a target location, optionally preserving cached result text. The current v1 runtime supports rebuild flows; `cachedResultText` / `updatePolicy: "preserveCached"` currently return `CAPABILITY_UNAVAILABLE`.

mutates documentdry runnon-idempotent
doc.fields.insert(…)

Expected result

Returns a FieldMutationResult indicating success with the field address or a failure.

Inputs

mode"raw"required
atTextTargetrequired
Fields
kind"text"required
segmentsTextSegment[]required
storyStoryLocator

Story 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"required
storyType"body"required
headerFooterSlot
kind"story"required
storyType"headerFooterSlot"required
sectionSectionAddressrequired
headerFooterKind"header" | "footer"required
variant"default" | "first" | "even"required
resolution"effective" | "explicit"
onWrite"materializeIfInherited" | "editResolvedPart" | "error"
headerFooterPart
kind"story"required
storyType"headerFooterPart"required
refIdstringrequired
footnote
kind"story"required
storyType"footnote"required
noteIdstringrequired
endnote
kind"story"required
storyType"endnote"required
noteIdstringrequired
textbox
kind"story"required
storyType"textbox"required
textboxIdstringrequired
instructionstringrequired
2 additional input fields
cachedResultTextstring
updatePolicy"rebuild" | "preserveCached"

Result

Output fields
true
successtruerequired
fieldobjectrequired
Fields
kind"field"required
blockIdstringrequired
occurrenceIndexintegerrequired
nestingDepthinteger
storyIdstring
fieldIdstring
false
successfalserequired
failureobjectrequired
Fields
codestringrequired
messagestringrequired
detailsunknown

Failures

Pre-apply throws

  • TARGET_NOT_FOUND
  • INVALID_TARGET
  • INVALID_INPUT
1 more codes
  • CAPABILITY_UNAVAILABLE

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