comments.patch
Patch exactly one field on an existing comment (`text`, `target`, `status`, or `isInternal`). The `target` branch accepts a plain TextAddress or a TrackedChangeCommentTarget, with or without `kind: "trackedChange"`, that names a logical tracked-change id. The legacy `isInternal` input sets or clears the `sdcom:internal` attribute for v1 backward compatibility. Multi-field patches and no-op edits are rejected with `INVALID_INPUT`; reply target / status patches are rejected with `INVALID_CONTEXT`.
doc.comments.patch(…)Expected result
Returns a Receipt with `updated` populated on success. Reports `NO_OP` for byte-identical edits, rejects empty-body / trim-equivalent edits with `INVALID_INPUT`, no-op resolve/reopen/setInternal with `INVALID_INPUT`, reply target/status with `INVALID_CONTEXT`, cross-story moves with `INVALID_CONTEXT`, materializing inherited slot moves with `CAPABILITY_UNAVAILABLE`, stale tracked-change targets with `TARGET_NOT_FOUND`, and formatting / structural / unpaired-move tracked-change targets with `CAPABILITY_UNAVAILABLE`.
Inputs
commentIdstringrequired4 additional input fields
textstringUpdated comment text.
targetTextAddress | SelectionTarget | CommentTrackedChangeTarget | objectNew anchor for the comment. Accepts a plain TextAddress, a SelectionTarget {kind:'selection', start, end}, a TextSearchCommentTarget {text, story?}, or a TrackedChangeCommentTarget, with or without kind, that names a logical tracked-change id as a convenience re-anchor target .
TextAddress
kind"text"requiredblockIdstringrequiredrangeRangerequiredFields
startintegerrequiredendintegerrequiredstoryStoryLocatorStory 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"requiredsectionSectionAddressrequiredheaderFooterKind"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"requiredtextboxIdstringrequiredSelectionTarget
kind"selection"requiredstartSelectionPointrequiredA point in the document. Use {kind:'text', blockId, offset} for character positions or {kind:'nodeEdge', node:{kind:'block', nodeType, nodeId}, edge:'before'|'after'} for block boundaries.
text
kind"text"requiredblockIdstringrequiredoffsetintegerrequiredstoryStoryLocatorStory 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"requiredsectionSectionAddressrequiredheaderFooterKind"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"requiredtextboxIdstringrequirednodeEdge
kind"nodeEdge"requirednodeSelectionEdgeNodeAddressrequirededge"before" | "after"requiredendSelectionPointrequiredA point in the document. Use {kind:'text', blockId, offset} for character positions or {kind:'nodeEdge', node:{kind:'block', nodeType, nodeId}, edge:'before'|'after'} for block boundaries.
text
kind"text"requiredblockIdstringrequiredoffsetintegerrequiredstoryStoryLocatorStory 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"requiredsectionSectionAddressrequiredheaderFooterKind"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"requiredtextboxIdstringrequirednodeEdge
kind"nodeEdge"requirednodeSelectionEdgeNodeAddressrequirededge"before" | "after"requiredstoryStoryLocatorStory 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"requiredsectionSectionAddressrequiredheaderFooterKind"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"requiredtextboxIdstringrequiredcoordinateSpaceTextCoordinateSpaceCommentTrackedChangeTarget
kind"trackedChange"Optional discriminator. Omit it for the Labs-compatible { trackedChangeId } shape.
trackedChangeIdstringrequiredside"inserted" | "deleted" | "source" | "destination"Which revision side to anchor the comment on. Optional for paired replacements (defaults to inserted) and paired moves (defaults to destination); required for independent replacements where both sides are separately reviewable.
storyStoryLocatorStory 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"requiredsectionSectionAddressrequiredheaderFooterKind"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"requiredtextboxIdstringrequiredVariant 4
textstringrequiredText to find and anchor the comment to. The adapter resolves the first body/story match.
storyStoryLocatorStory 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"requiredsectionSectionAddressrequiredheaderFooterKind"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"requiredtextboxIdstringrequiredstatus"resolved" | "active"Set comment status. Use 'resolved' to resolve a comment, or 'active' to reopen a previously resolved comment (lifecycle inverse).
isInternalbooleanLegacy v1/document-api compatibility field. V2 adapters set or clear the target comment `sdcom:internal` attribute and preserve the field in the schema so v1 callers keep their input shape.
Result
Output fields
true
successtruerequiredidstringinsertedEntityAddress[]updatedEntityAddress[]removedEntityAddress[]invalidatedRefsAffectedRef[]remappedRefsAffectedRefRemapping[]affectedStoriesStoryLocator[]textRangeShiftsTextRangeShift[]txIdstringwarningsReviewWarning[]effectsReceiptEffectsFields
insertedTextTextMutationEffect[]insertedBlocksBlockMutationEffect[]false
successfalserequiredfailureobjectrequiredFields
code"INVALID_INPUT" | "INVALID_TARGET" | "INVALID_CONTEXT" | "TARGET_NOT_FOUND" | "CAPABILITY_UNAVAILABLE" | "NO_OP"requiredmessagestringrequireddetailsunknownFailures
Pre-apply throws
TARGET_NOT_FOUNDCAPABILITY_UNAVAILABLEINVALID_TARGET
1 more codes
INVALID_INPUT
Non-applied receipt codes
INVALID_INPUTINVALID_TARGETINVALID_CONTEXT
3 more codes
TARGET_NOT_FOUNDCAPABILITY_UNAVAILABLENO_OP
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