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

Summary

Search the document for text or node matches using SDM/1 selectors. Returns discovery-grade results — for mutation targeting, use query.match instead.
  • Operation ID: find
  • API member path: editor.doc.find(...)
  • Mutates document: no
  • Idempotency: idempotent
  • Supports tracked mode: no
  • Supports dry run: no
  • Deterministic target resolution: no

Expected result

Returns an SDFindResult envelope ({ total, limit, offset, items }). Each item is an SDNodeResult ({ node, address }).

Input fields

FieldTypeRequiredDescription
limitintegerno
offsetintegerno
optionsobjectno
options.includeContextbooleanno
options.includeProvenancebooleanno
options.includeResolvedbooleanno
selectobject(type=“text”) \object(type=“node”)yesOne of: object(type=“text”), object(type=“node”)
withinBlockNodeAddressnoBlockNodeAddress
within.kind"block"noConstant: "block"
within.nodeIdstringno
within.nodeTypeenumno"paragraph", "heading", "listItem", "table", "tableRow", "tableCell", "tableOfContents", "image", "sdt"

Example request

{
  "limit": 50,
  "select": {
    "caseSensitive": true,
    "mode": "contains",
    "pattern": "hello world",
    "type": "text"
  },
  "within": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "paragraph"
  }
}

Output fields

FieldTypeRequiredDescription
itemsobject[]yes
limitintegeryes
offsetintegeryes
totalintegeryes

Example response

{
  "items": [
    {
      "address": {
        "kind": "block",
        "nodeId": "node-def456",
        "nodeType": "paragraph"
      },
      "context": {},
      "node": {}
    }
  ],
  "limit": 50,
  "offset": 0,
  "total": 1
}

Pre-apply throws

  • CAPABILITY_UNAVAILABLE
  • INVALID_INPUT
  • ADDRESS_STALE

Non-applied failure codes

  • None

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "limit": {
      "type": "integer"
    },
    "offset": {
      "type": "integer"
    },
    "options": {
      "additionalProperties": false,
      "properties": {
        "includeContext": {
          "type": "boolean"
        },
        "includeProvenance": {
          "type": "boolean"
        },
        "includeResolved": {
          "type": "boolean"
        }
      },
      "type": "object"
    },
    "select": {
      "oneOf": [
        {
          "additionalProperties": false,
          "properties": {
            "caseSensitive": {
              "type": "boolean"
            },
            "mode": {
              "enum": [
                "contains",
                "regex"
              ]
            },
            "pattern": {
              "type": "string"
            },
            "type": {
              "const": "text"
            }
          },
          "required": [
            "type",
            "pattern"
          ],
          "type": "object"
        },
        {
          "additionalProperties": false,
          "properties": {
            "kind": {
              "enum": [
                "block",
                "inline"
              ]
            },
            "nodeType": {
              "type": "string"
            },
            "type": {
              "const": "node"
            }
          },
          "required": [
            "type"
          ],
          "type": "object"
        }
      ]
    },
    "within": {
      "$ref": "#/$defs/BlockNodeAddress"
    }
  },
  "required": [
    "select"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "items": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "address": {
            "$ref": "#/$defs/NodeAddress"
          },
          "context": {
            "type": "object"
          },
          "node": {
            "type": "object"
          }
        },
        "required": [
          "node",
          "address"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "limit": {
      "minimum": 0,
      "type": "integer"
    },
    "offset": {
      "minimum": 0,
      "type": "integer"
    },
    "total": {
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "total",
    "limit",
    "offset",
    "items"
  ],
  "type": "object"
}