Alpha: Document API is currently alpha and subject to breaking changes.
Summary
- Operation ID:
query.match - API member path:
editor.doc.query.match(...) - Mutates document:
no - Idempotency:
idempotent - Supports tracked mode:
no - Supports dry run:
no - Deterministic target resolution:
yes
Input fields
| Field | Type | Required | Description | |
|---|---|---|---|---|
includeNodes | boolean | no | ||
limit | integer | no | ||
mode | enum | no | "strict", "candidates" | |
offset | integer | no | ||
require | enum | no | "any", "first", "exactlyOne", "all" | |
select | object(type=“text”) \ | object(type=“node”) | yes | One of: object(type=“text”), object(type=“node”) |
within | NodeAddress | no | NodeAddress |
Example request
Copy
Ask AI
{
"require": "any",
"select": {
"caseSensitive": true,
"mode": "contains",
"pattern": "hello world",
"type": "text"
},
"within": {
"kind": "block",
"nodeId": "node-def456",
"nodeType": "paragraph"
}
}
Output fields
| Field | Type | Required | Description | |
|---|---|---|---|---|
evaluatedRevision | string | yes | ||
items | object(matchKind=“text”) \ | object(matchKind=“node”)[] | yes | |
page | PageInfo | yes | PageInfo | |
total | integer | yes |
Example response
Copy
Ask AI
{
"evaluatedRevision": "rev-001",
"items": [
{
"address": {
"kind": "block",
"nodeId": "node-def456",
"nodeType": "paragraph"
},
"blocks": [
{
"blockId": "block-abc123",
"nodeType": "paragraph",
"paragraphStyle": {
"isListItem": true,
"styleId": "style-001"
},
"range": {
"end": 10,
"start": 0
},
"ref": "handle:abc123",
"runs": [
{
"range": {
"end": 10,
"start": 0
},
"ref": "handle:abc123",
"styleId": "style-001",
"styles": {
"bold": true,
"color": "example",
"highlight": "example",
"italic": true,
"strike": true,
"underline": true
},
"text": "Hello, world."
}
],
"text": "Hello, world."
}
],
"handle": {
"ref": "handle:abc123",
"refStability": "stable",
"targetKind": "text"
},
"highlightRange": {
"end": 10,
"start": 0
},
"id": "id-001",
"matchKind": "text",
"snippet": "...the quick brown fox..."
}
],
"page": {
"limit": 50,
"offset": 0,
"returned": 1
},
"total": 1
}
Pre-apply throws
MATCH_NOT_FOUNDAMBIGUOUS_MATCHINVALID_INPUTINTERNAL_ERROR
Non-applied failure codes
- None
Raw schemas
Raw input schema
Raw input schema
Copy
Ask AI
{
"additionalProperties": false,
"properties": {
"includeNodes": {
"type": "boolean"
},
"limit": {
"minimum": 1,
"type": "integer"
},
"mode": {
"enum": [
"strict",
"candidates"
]
},
"offset": {
"minimum": 0,
"type": "integer"
},
"require": {
"enum": [
"any",
"first",
"exactlyOne",
"all"
]
},
"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": {
"enum": [
"paragraph",
"heading",
"listItem",
"table",
"tableRow",
"tableCell",
"image",
"sdt",
"run",
"bookmark",
"comment",
"hyperlink",
"footnoteRef",
"tab",
"lineBreak"
]
},
"type": {
"const": "node"
}
},
"required": [
"type"
],
"type": "object"
}
]
},
"within": {
"$ref": "#/$defs/NodeAddress"
}
},
"required": [
"select"
],
"type": "object"
}
Raw output schema
Raw output schema
Copy
Ask AI
{
"additionalProperties": false,
"properties": {
"evaluatedRevision": {
"type": "string"
},
"items": {
"items": {
"oneOf": [
{
"additionalProperties": false,
"properties": {
"address": {
"$ref": "#/$defs/NodeAddress"
},
"blocks": {
"items": {
"$ref": "#/$defs/MatchBlock"
},
"minItems": 1,
"type": "array"
},
"handle": {
"$ref": "#/$defs/ResolvedHandle"
},
"highlightRange": {
"$ref": "#/$defs/Range"
},
"id": {
"type": "string"
},
"matchKind": {
"const": "text"
},
"snippet": {
"type": "string"
}
},
"required": [
"id",
"handle",
"matchKind",
"address",
"snippet",
"highlightRange",
"blocks"
],
"type": "object"
},
{
"additionalProperties": false,
"properties": {
"address": {
"$ref": "#/$defs/NodeAddress"
},
"blocks": {
"items": {
"$ref": "#/$defs/MatchBlock"
},
"maxItems": 0,
"type": "array"
},
"handle": {
"$ref": "#/$defs/ResolvedHandle"
},
"id": {
"type": "string"
},
"matchKind": {
"const": "node"
}
},
"required": [
"id",
"handle",
"matchKind",
"address",
"blocks"
],
"type": "object"
}
]
},
"type": "array"
},
"page": {
"$ref": "#/$defs/PageInfo"
},
"total": {
"minimum": 0,
"type": "integer"
}
},
"required": [
"evaluatedRevision",
"total",
"items",
"page"
],
"type": "object"
}

