Skip to main content
The Document API is a new way to interact with documents programmatically. Query content, make changes, and build automations — all without touching editor internals.
Coming Soon — The Document API is currently in development. This page previews what’s coming.

Why Document API?

Today, programmatic access requires using internal editor methods:
// Current approach - uses internal APIs
editor.commands.insertContent(content);
editor.state.doc.descendants((node) => { ... });
This works, but:
  • Internal APIs can change between versions
  • Requires understanding ProseMirror internals
  • Tightly coupled to the editor implementation

What’s Coming

The Document API provides a stable, high-level interface:
// Document API - stable public interface
const paragraphs = doc.query({ type: 'paragraph' });
const tables = doc.query({ type: 'table', contains: 'Revenue' });

doc.replace(paragraphs[0], { text: 'New content' });

Query DSL

Find content by type, attributes, or text. Filter tables, paragraphs, lists — anything in the document.

Stable Interface

Public API that won’t break between versions. Build with confidence.

Engine Agnostic

Works the same whether you’re in the browser, Node.js, or headless mode.

Type Safe

Full TypeScript support with autocomplete and type checking.

Feature Preview

Querying Content

Find any content in your document:
// Find all paragraphs
const paragraphs = doc.query({ type: 'paragraph' });

// Find tables containing specific text
const tables = doc.query({
  type: 'table',
  contains: 'Q4 Revenue'
});

// Find content by attributes
const signatures = doc.query({
  type: 'field-annotation',
  attrs: { fieldType: 'signature' }
});

Making Changes

Modify documents with a clean API:
// Replace content
doc.replace(address, { text: 'Updated text' });

// Insert at position
doc.insert(address, { type: 'paragraph', text: 'New paragraph' });

// Delete content
doc.delete(address);

Working with Tables

First-class table operations:
// Add a row
doc.table(tableAddress).addRow({ after: 2 });

// Update a cell
doc.table(tableAddress).cell(1, 2).replace({ text: 'New value' });

Timeline

1

v0 — Read-only API

Query DSL for finding and reading document content
2

v1 — Mutations

Insert, replace, and delete operations
3

v2 — Advanced Operations

Table operations, list manipulation, track changes integration

Stay Updated

Join our Discord to get notified when Document API launches:

Join Discord

Get early access and share feedback