Alpha: Document API is currently alpha and subject to breaking changes.
Summary
Insert a new cross-reference field at a target location.- Operation ID:
crossRefs.insert - API member path:
editor.doc.crossRefs.insert(...) - Mutates document:
yes - Idempotency:
non-idempotent - Supports tracked mode:
no - Supports dry run:
no - Deterministic target resolution:
yes
Expected result
Returns a CrossRefMutationResult indicating success with the cross-reference address or a failure.Input fields
| Field | Type | Required | Description | |||||
|---|---|---|---|---|---|---|---|---|
at | TextTarget | yes | TextTarget | |||||
at.kind | "text" | yes | Constant: "text" | |||||
at.segments | TextSegment[] | yes | ||||||
display | enum | yes | "content", "pageNumber", "noteNumber", "labelAndNumber", "aboveBelow", "numberOnly", "numberFullContext", "styledContent", "styledPageNumber" | |||||
target | object(kind=“bookmark”) \ | object(kind=“heading”) \ | object(kind=“note”) \ | object(kind=“caption”) \ | object(kind=“numberedItem”) \ | object(kind=“styledParagraph”) | yes | One of: object(kind=“bookmark”), object(kind=“heading”), object(kind=“note”), object(kind=“caption”), object(kind=“numberedItem”), object(kind=“styledParagraph”) |
Example request
Output fields
Variant 1 (crossRef.kind=“inline”)
| Field | Type | Required | Description |
|---|---|---|---|
crossRef | object(kind=“inline”) | yes | |
crossRef.anchor | InlineAnchor | yes | InlineAnchor |
crossRef.anchor.end | Position | yes | Position |
crossRef.anchor.end.blockId | string | yes | |
crossRef.anchor.end.offset | integer | yes | |
crossRef.anchor.start | Position | yes | Position |
crossRef.anchor.start.blockId | string | yes | |
crossRef.anchor.start.offset | integer | yes | |
crossRef.kind | "inline" | yes | Constant: "inline" |
crossRef.nodeType | "crossRef" | yes | Constant: "crossRef" |
success | true | yes | Constant: true |
Variant 2 (success=false)
| Field | Type | Required | Description |
|---|---|---|---|
failure | object | yes | |
failure.code | string | yes | |
failure.details | any | no | |
failure.message | string | yes | |
success | false | yes | Constant: false |
Example response
Pre-apply throws
TARGET_NOT_FOUNDINVALID_TARGETINVALID_INPUTCAPABILITY_UNAVAILABLE
Non-applied failure codes
- None
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

