Document apiReferenceCreate

create.tableOfContents

Insert a new table of contents at the target position.

mutates documentdry runnon-idempotent
doc.create.tableOfContents(…)

Expected result

Returns a CreateTableOfContentsResult with the new TOC block address.

Inputs

atdocumentStart | documentEnd | before | after
documentStart
kind"documentStart"required
documentEnd
kind"documentEnd"required
before
kind"before"required
targetBlockNodeAddressrequired
Fields
kind"block"required
nodeType"paragraph" | "heading" | "listItem" | "table" | "tableRow" | "tableCell" | "tableOfContents" | "image" | "sdt"required
nodeIdstringrequired
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
after
kind"after"required
targetBlockNodeAddressrequired
Fields
kind"block"required
nodeType"paragraph" | "heading" | "listItem" | "table" | "tableRow" | "tableCell" | "tableOfContents" | "image" | "sdt"required
nodeIdstringrequired
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
configobject
Fields
outlineLevelsobject
Fields
fromintegerrequired
tointegerrequired
useAppliedOutlineLevelboolean
tcFieldIdentifierstring
tcFieldLevelsobject
Fields
fromintegerrequired
tointegerrequired
hyperlinksboolean
hideInWebViewboolean
omitPageNumberLevelsobject
Fields
fromintegerrequired
tointegerrequired
separatorstring
includePageNumbersboolean
tabLeader"none" | "dot" | "hyphen" | "underscore" | "middleDot"
rightAlignPageNumbersboolean
instructionstring

Result

Output fields
true
successtruerequired
tocobjectrequired
Fields
kind"block"required
nodeType"tableOfContents"required
nodeIdstringrequired
false
successfalserequired
failureobjectrequired
Fields
code"NO_OP" | "INVALID_TARGET" | "TARGET_NOT_FOUND" | "CAPABILITY_UNAVAILABLE" | "INVALID_INSERTION_CONTEXT" | "PAGE_NUMBERS_NOT_MATERIALIZED"required
messagestringrequired
detailsunknown

Failures

Pre-apply throws

  • INVALID_TARGET
  • TARGET_NOT_FOUND
  • INVALID_INPUT
1 more codes
  • CAPABILITY_UNAVAILABLE

Non-applied receipt codes

  • NO_OP
  • INVALID_INSERTION_CONTEXT

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