Document apiReferenceHyperlinks

hyperlinks.insert

Insert new linked text at a target position.

mutates documenttracked modedry runnon-idempotent
doc.hyperlinks.insert(…)

Expected result

Returns a HyperlinkMutationResult with the created hyperlink address on success, or a failure code.

Inputs

textstringrequired
linkobjectrequired
Fields
destinationobjectrequired
Fields
hrefstring
anchorstring
docLocationstring
tooltipstring
targetstring
relstring

Browser relationship tokens kept for the current editing session; not persisted in DOCX or reviewed by Word.

1 additional input field
targetTextAddress
Fields
kind"text"required
blockIdstringrequired
rangeRangerequired
Fields
startintegerrequired
endintegerrequired
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

Result

Output fields
true
successtruerequired
hyperlinkobjectrequired
Fields
kind"inline"required
nodeType"hyperlink"required
anchorInlineAnchorrequired
Fields
startPositionrequired
endPositionrequired
appliedChangeMode"direct" | "tracked"
false
successfalserequired
failureobjectrequired
Fields
code"NO_OP" | "INVALID_TARGET" | "TARGET_NOT_FOUND" | "CAPABILITY_UNAVAILABLE"required
messagestringrequired
detailsobject

Failures

Pre-apply throws

  • TARGET_NOT_FOUND
  • CAPABILITY_UNAVAILABLE
  • INVALID_TARGET
1 more codes
  • INVALID_INPUT

Non-applied receipt codes

  • NO_OP
  • INVALID_TARGET

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