Summary
Insert content into the document. Two input shapes: text-based (value + type) inserts inline content at a SelectionTarget or ref position within an existing block; structural SDFragment (content) inserts one or more blocks as siblings relative to a BlockNodeAddress target. When target/ref is omitted, content appends at the end of the document. Text mode supports text (default), markdown, and html content types via thetype field. Structural mode uses placement (before/after/insideStart/insideEnd) to position relative to the target block.
- Operation ID:
insert - API member path:
editor.doc.insert(...) - Mutates document:
yes - Idempotency:
non-idempotent - Supports tracked mode:
yes - Supports dry run:
yes - Deterministic target resolution:
yes
Expected result
Returns an SDMutationReceipt with applied status; resolution reports the inserted TextAddress for text insertion or a BlockNodeAddress for structural insertion. Receipt reports NO_OP if the insertion point is invalid or content is empty.Input fields
Variant 1.1 (target.kind=“selection”)
| Field | Type | Required | Description |
|---|---|---|---|
in | StoryLocator | no | StoryLocator |
target | SelectionTarget | yes | SelectionTarget |
target.end | SelectionPoint | yes | SelectionPoint |
target.kind | "selection" | yes | Constant: "selection" |
target.start | SelectionPoint | yes | SelectionPoint |
type | enum | no | "text", "markdown", "html" |
value | string | yes |
Variant 1.2 (required: ref, value)
| Field | Type | Required | Description |
|---|---|---|---|
in | StoryLocator | no | StoryLocator |
ref | string | yes | |
type | enum | no | "text", "markdown", "html" |
value | string | yes |
Variant 1.3 (required: value)
| Field | Type | Required | Description |
|---|---|---|---|
in | StoryLocator | no | StoryLocator |
type | enum | no | "text", "markdown", "html" |
value | string | yes |
Variant 2 (target.kind=“block”)
| Field | Type | Required | Description | |
|---|---|---|---|---|
content | object \ | object[] | yes | One of: object, object[] |
in | StoryLocator | no | StoryLocator | |
nestingPolicy | object | no | ||
nestingPolicy.tables | enum | no | "forbid", "allow" | |
placement | enum | no | "before", "after", "insideStart", "insideEnd" | |
target | BlockNodeAddress | no | BlockNodeAddress | |
target.kind | "block" | no | Constant: "block" | |
target.nodeId | string | no | ||
target.nodeType | enum | no | "paragraph", "heading", "listItem", "table", "tableRow", "tableCell", "tableOfContents", "image", "sdt" |
Example request
Output fields
Variant 1 (success=true)
| Field | Type | Required | Description | |
|---|---|---|---|---|
evaluatedRevision | object | no | ||
evaluatedRevision.after | string | no | ||
evaluatedRevision.before | string | no | ||
resolution | object | no | ||
resolution.range | TextMutationRange | no | TextMutationRange | |
resolution.range.from | integer | no | ||
resolution.range.to | integer | no | ||
resolution.selectionTarget | SelectionTarget | no | SelectionTarget | |
resolution.selectionTarget.end | SelectionPoint | no | SelectionPoint | |
resolution.selectionTarget.kind | "selection" | no | Constant: "selection" | |
resolution.selectionTarget.start | SelectionPoint | no | SelectionPoint | |
resolution.target | TextAddress \ | BlockNodeAddress | no | One of: TextAddress, BlockNodeAddress |
success | true | yes | Constant: true |
Variant 2 (success=false)
| Field | Type | Required | Description | |
|---|---|---|---|---|
evaluatedRevision | object | no | ||
evaluatedRevision.after | string | no | ||
evaluatedRevision.before | string | no | ||
failure | object | yes | ||
failure.code | enum | yes | "INVALID_TARGET", "NO_OP", "CAPABILITY_UNAVAILABLE", "UNSUPPORTED_ENVIRONMENT", "INVALID_NESTING", "INVALID_PLACEMENT", "INVALID_PAYLOAD", "CAPABILITY_UNSUPPORTED", "ADDRESS_STALE", "DUPLICATE_ID", "INVALID_CONTEXT", "RAW_MODE_REQUIRED", "PRESERVE_ONLY_VIOLATION", "INVALID_INPUT" | |
failure.details | any | no | ||
failure.message | string | yes | ||
resolution | object | no | ||
resolution.range | TextMutationRange | no | TextMutationRange | |
resolution.range.from | integer | no | ||
resolution.range.to | integer | no | ||
resolution.selectionTarget | SelectionTarget | no | SelectionTarget | |
resolution.selectionTarget.end | SelectionPoint | no | SelectionPoint | |
resolution.selectionTarget.kind | "selection" | no | Constant: "selection" | |
resolution.selectionTarget.start | SelectionPoint | no | SelectionPoint | |
resolution.target | TextAddress \ | BlockNodeAddress | no | One of: TextAddress, BlockNodeAddress |
success | false | yes | Constant: false |
Example response
Pre-apply throws
TARGET_NOT_FOUNDCAPABILITY_UNAVAILABLEINVALID_TARGETINVALID_INPUTADDRESS_STALEDUPLICATE_IDRAW_MODE_REQUIREDPRESERVE_ONLY_VIOLATIONCAPABILITY_UNSUPPORTEDSTORY_NOT_FOUNDSTORY_MISMATCHSTORY_NOT_SUPPORTEDCROSS_STORY_PLANMATERIALIZATION_FAILED
Non-applied failure codes
INVALID_TARGETNO_OPCAPABILITY_UNAVAILABLEUNSUPPORTED_ENVIRONMENTINVALID_NESTINGINVALID_PLACEMENTINVALID_PAYLOADCAPABILITY_UNSUPPORTEDADDRESS_STALEDUPLICATE_IDINVALID_CONTEXTRAW_MODE_REQUIREDPRESERVE_ONLY_VIOLATIONINVALID_INPUT
Raw schemas
Raw input schema
Raw input schema
Raw output schema
Raw output schema
Raw success schema
Raw success schema
Raw failure schema
Raw failure schema

