Skip to main content
Alpha: Document API is currently alpha and subject to breaking changes.

Summary

Retrieve a single node by its unique ID.
  • Operation ID: getNodeById
  • API member path: editor.doc.getNodeById(...)
  • Mutates document: no
  • Idempotency: idempotent
  • Supports tracked mode: no
  • Supports dry run: no
  • Deterministic target resolution: yes

Expected result

Returns an SDNodeResult envelope with the projected SDM/1 node and canonical address.

Input fields

FieldTypeRequiredDescription
nodeIdstringyes
nodeTypeenumno"paragraph", "heading", "listItem", "table", "tableRow", "tableCell", "tableOfContents", "image", "sdt"

Example request

{
  "nodeId": "node-def456",
  "nodeType": "paragraph"
}

Output fields

FieldTypeRequiredDescription
addressobjectyes
address.anchorobjectno
address.anchor.endobjectno
address.anchor.end.blockIdstringno
address.anchor.end.offsetintegerno
address.anchor.startobjectno
address.anchor.start.blockIdstringno
address.anchor.start.offsetintegerno
address.evaluatedRevisionstringno
address.kindenumyes"content", "inline", "annotation", "section"
address.nodeIdstringno
address.pathstring \integer[]no
address.stabilityenumyes"stable", "ephemeral"
contextobjectno
nodeobjectyes

Example response

{
  "address": {
    "anchor": {
      "end": {
        "blockId": "block-abc123",
        "offset": 0
      },
      "start": {
        "blockId": "block-abc123",
        "offset": 0
      }
    },
    "kind": "content",
    "nodeId": "node-def456",
    "stability": "stable"
  },
  "context": {},
  "node": {}
}

Pre-apply throws

  • TARGET_NOT_FOUND

Non-applied failure codes

  • None

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "nodeId": {
      "type": "string"
    },
    "nodeType": {
      "enum": [
        "paragraph",
        "heading",
        "listItem",
        "table",
        "tableRow",
        "tableCell",
        "tableOfContents",
        "image",
        "sdt"
      ]
    }
  },
  "required": [
    "nodeId"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "address": {
      "additionalProperties": false,
      "properties": {
        "anchor": {
          "additionalProperties": false,
          "properties": {
            "end": {
              "additionalProperties": false,
              "properties": {
                "blockId": {
                  "type": "string"
                },
                "offset": {
                  "type": "integer"
                }
              },
              "required": [
                "blockId",
                "offset"
              ],
              "type": "object"
            },
            "start": {
              "additionalProperties": false,
              "properties": {
                "blockId": {
                  "type": "string"
                },
                "offset": {
                  "type": "integer"
                }
              },
              "required": [
                "blockId",
                "offset"
              ],
              "type": "object"
            }
          },
          "type": "object"
        },
        "evaluatedRevision": {
          "type": "string"
        },
        "kind": {
          "enum": [
            "content",
            "inline",
            "annotation",
            "section"
          ]
        },
        "nodeId": {
          "type": "string"
        },
        "path": {
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "integer"
              }
            ]
          },
          "type": "array"
        },
        "stability": {
          "enum": [
            "stable",
            "ephemeral"
          ]
        }
      },
      "required": [
        "kind",
        "stability"
      ],
      "type": "object"
    },
    "context": {
      "type": "object"
    },
    "node": {
      "type": "object"
    }
  },
  "required": [
    "node",
    "address"
  ],
  "type": "object"
}