> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# extract

> Extract all document content with stable IDs for RAG pipelines. Returns blocks with full text, comments, and tracked changes: each with an ID compatible with scrollToElement().

## Summary

Extract all document content with stable IDs for RAG pipelines. Returns blocks with full text, comments, and tracked changes: each with an ID compatible with scrollToElement().

* Operation ID: `extract`
* API member path: `editor.doc.extract(...)`
* Mutates document: `no`
* Idempotency: `idempotent`
* Supports tracked mode: `no`
* Supports dry run: `no`
* Deterministic target resolution: `yes`

## Expected result

Returns an ExtractResult with blocks (nodeId, type, text, headingLevel), comments (entityId, text, anchoredText, blockId, status, author), tracked changes (entityId, type, excerpt, author, date), and revision.

## Input fields

*No fields.*

### Example request

```json theme={null}
{}
```

## Output fields

| Field | Type | Required | Description |
| - | - | - | - |
| `blocks` | object\[] | yes | |
| `comments` | object\[] | yes | |
| `revision` | string | yes | |
| `trackedChanges` | object\[] | yes | |

### Example response

```json theme={null}
{
  "blocks": [
    {
      "headingLevel": 1,
      "nodeId": "node-def456",
      "text": "Hello, world.",
      "textSpans": [
        {
          "text": "Hello, world.",
          "trackedChanges": [
            {
              "entityId": "entity-789",
              "type": "insert"
            }
          ]
        }
      ],
      "type": "example"
    }
  ],
  "comments": [
    {
      "anchoredText": "example",
      "entityId": "entity-789",
      "status": "open",
      "text": "Hello, world."
    }
  ],
  "revision": "example",
  "trackedChanges": [
    {
      "blockIds": [
        "example"
      ],
      "entityId": "entity-789",
      "type": "insert",
      "wordRevisionIds": {
        "delete": "example",
        "insert": "example"
      }
    }
  ]
}
```

## Pre-apply throws

* None

## Non-applied failure codes

* None

## Raw schemas

> [accordion] Raw input schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {},
>   "type": "object"
> }
> ```

> [accordion] Raw output schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "blocks": {
>       "items": {
>         "additionalProperties": false,
>         "properties": {
>           "headingLevel": {
>             "description": "Heading level (1-6). Only present for headings.",
>             "type": "integer"
>           },
>           "nodeId": {
>             "description": "Stable block ID: pass to scrollToElement() for navigation.",
>             "type": "string"
>           },
>           "tableContext": {
>             "additionalProperties": false,
>             "properties": {
>               "colspan": {
>                 "description": "Number of columns the cell spans.",
>                 "type": "integer"
>               },
>               "columnIndex": {
>                 "description": "0-based logical grid column, not the row child order.",
>                 "type": "integer"
>               },
>               "parentColumnIndex": {
>                 "description": "Column index in the parent table. Set with parentTableOrdinal.",
>                 "type": "integer"
>               },
>               "parentRowIndex": {
>                 "description": "Row index in the parent table. Set with parentTableOrdinal.",
>                 "type": "integer"
>               },
>               "parentTableOrdinal": {
>                 "description": "Ordinal of the parent table when the containing table is nested.",
>                 "type": "integer"
>               },
>               "rowIndex": {
>                 "description": "0-based row index of the containing cell.",
>                 "type": "integer"
>               },
>               "rowspan": {
>                 "description": "Number of rows the cell spans.",
>                 "type": "integer"
>               },
>               "tableOrdinal": {
>                 "description": "0-based table ordinal, unique within one extract() result.",
>                 "type": "integer"
>               }
>             },
>             "required": [
>               "tableOrdinal",
>               "rowIndex",
>               "columnIndex",
>               "rowspan",
>               "colspan"
>             ],
>             "type": "object"
>           },
>           "text": {
>             "description": "Full plain text content of the block.",
>             "type": "string"
>           },
>           "textSpans": {
>             "description": "Block text broken into runs with tracked-change marks preserved per run. Present only when the block contains at least one tracked change. Concatenating span text yields `text`.",
>             "items": {
>               "additionalProperties": false,
>               "properties": {
>                 "text": {
>                   "description": "Raw text of the run.",
>                   "type": "string"
>                 },
>                 "trackedChanges": {
>                   "description": "Tracked-change marks applied to this run.",
>                   "items": {
>                     "additionalProperties": false,
>                     "properties": {
>                       "entityId": {
>                         "description": "Tracked change entity ID matching an entry in trackedChanges[].",
>                         "type": "string"
>                       },
>                       "type": {
>                         "enum": [
>                           "insert",
>                           "delete",
>                           "format"
>                         ],
>                         "type": "string"
>                       }
>                     },
>                     "required": [
>                       "entityId",
>                       "type"
>                     ],
>                     "type": "object"
>                   },
>                   "type": "array"
>                 }
>               },
>               "required": [
>                 "text"
>               ],
>               "type": "object"
>             },
>             "type": "array"
>           },
>           "type": {
>             "description": "Block type: paragraph, heading, listItem, image, tableOfContents.",
>             "type": "string"
>           }
>         },
>         "required": [
>           "nodeId",
>           "type",
>           "text"
>         ],
>         "type": "object"
>       },
>       "type": "array"
>     },
>     "comments": {
>       "items": {
>         "additionalProperties": false,
>         "properties": {
>           "anchoredText": {
>             "description": "The document text the comment is anchored to.",
>             "type": "string"
>           },
>           "author": {
>             "description": "Comment author name.",
>             "type": "string"
>           },
>           "blockId": {
>             "description": "Block ID the comment is anchored to.",
>             "type": "string"
>           },
>           "entityId": {
>             "description": "Comment entity ID: pass to scrollToElement() for navigation.",
>             "type": "string"
>           },
>           "status": {
>             "enum": [
>               "open",
>               "resolved"
>             ],
>             "type": "string"
>           },
>           "text": {
>             "description": "Comment body text.",
>             "type": "string"
>           }
>         },
>         "required": [
>           "entityId",
>           "status"
>         ],
>         "type": "object"
>       },
>       "type": "array"
>     },
>     "revision": {
>       "description": "Document revision at the time of extraction.",
>       "type": "string"
>     },
>     "trackedChanges": {
>       "items": {
>         "additionalProperties": false,
>         "properties": {
>           "author": {
>             "description": "Change author name.",
>             "type": "string"
>           },
>           "blockIds": {
>             "description": "Block IDs whose textSpans carry this change.",
>             "items": {
>               "type": "string"
>             },
>             "type": "array"
>           },
>           "date": {
>             "description": "Change date (ISO string).",
>             "type": "string"
>           },
>           "entityId": {
>             "description": "Tracked change entity ID. Pass to scrollToElement() for navigation.",
>             "type": "string"
>           },
>           "excerpt": {
>             "description": "Short text excerpt of the changed content. Omitted for paired replacements; read block.textSpans for the per-half text.",
>             "type": "string"
>           },
>           "type": {
>             "description": "Aggregate type at the entity level. In paired replacement mode, a delete+insert pair shares one entity and this surfaces as 'replacement'; per-half type lives on block.textSpans[].trackedChanges[].",
>             "enum": [
>               "insert",
>               "delete",
>               "replacement",
>               "format"
>             ],
>             "type": "string"
>           },
>           "wordRevisionIds": {
>             "additionalProperties": false,
>             "properties": {
>               "delete": {
>                 "description": "Original OOXML w:id from a w:del mark.",
>                 "type": "string"
>               },
>               "format": {
>                 "description": "Original OOXML w:id from a w:rPrChange mark.",
>                 "type": "string"
>               },
>               "insert": {
>                 "description": "Original OOXML w:id from a w:ins mark.",
>                 "type": "string"
>               }
>             },
>             "type": "object"
>           }
>         },
>         "required": [
>           "entityId",
>           "type"
>         ],
>         "type": "object"
>       },
>       "type": "array"
>     }
>   },
>   "required": [
>     "blocks",
>     "comments",
>     "trackedChanges",
>     "revision"
>   ],
>   "type": "object"
> }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.