A document editing API for DOCX files.

Read and change Word documents through an Office.js-compatible API. Run these operations in an open editor or against DOCX bytes on a server.

edit-contract.tsLIVE
1const matches = body.search('renewal term');
2matches.load('items'); await context.sync();
3matches.items[0].insertText('12 months', 'Replace');
4await context.sync();
Document changeParagraph 12
Before

The initial renewal term is unlimited.

→
AfterPending

The initial renewal term is unlimited.

Contract.docx

The initial renewal term is unlimited.

Operation queued

Connect your editor to a TypeScript backend.

Frontend
React or Vue
Backend
TypeScript / Node.js
Result
Edited DOCX
/ Capabilities

Use one document API in the browser and on the server.

DOCX editor API in the browser

Read Structured Document Tags (SDTs) by ID, tag, or title. Search text and queue document changes.

Read the guide→

Server-side DOCX editing

Process document bytes in a Node route, worker, script, or background job.

Read the guide→

Office.js-compatible automation

Attach the browser runtime to the document that your user already has open.

Read the guide→
/ Implementation

How to edit DOCX files programmatically.

Use the Office.js-style load, write, and sync pattern in an open editor or a TypeScript backend.

  1. 01

    Choose the document runtime

    Attach the browser runtime to a React or Vue editor. Use the server runtime for Node routes, workers, and scripts.

  2. 02

    Find text and structured fields

    Search document text or address Structured Document Tags by ID, tag, or title. Load values before you read them.

  3. 03

    Apply a batch and save the DOCX

    Queue related writes, then call sync. The server runtime returns saved bytes. The browser host controls saving.

/ Industry applications

Examples by industry.

You define access, validation, retention, and approval rules. DOCX Editor applies supported document operations.

Legal

Contract lifecycle automation

Extract clauses, apply approved terms, and create reviewable contract changes from your workflow.

  • Replace defined terms
  • Insert approved clauses
  • Add comments and revisions

Healthcare

Forms and document generation

Fill templates and update structured fields while preserving the DOCX file your organization uses.

  • Fill patient-facing templates
  • Generate referral documents
  • Update headers, paragraphs, and fields

Insurance

Policy and claims documents

Move document work into your application instead of scripting desktop Word.

  • Generate notices from case data
  • Update policy schedules
  • Batch documents in server jobs
/ Questions

Common questions

How do I use the API in a React or Vue application?+

Use the browser runtime with the React or Vue editor. It reads and edits the document your user has open.

Can I use the API from a TypeScript backend?+

Yes. Pass DOCX bytes to the server runtime from a Node route, worker, script, or background job. It returns saved bytes.

Does the API require Microsoft Word?+

No. Browser and server operations run without Word, Office.js, or desktop UI automation.

Can existing Office.js code work with this API?+

The object model follows Office.js patterns. Check the compatibility guide for supported operations.

Can the DOCX editor API create tracked changes?+

Yes. Add Pro to write proposed insertions, replacements, and deletions as native tracked changes.

Add DOCX editing to your application.

Start with the open-source editor. Add commercial review and automation features when your workflow needs them.

More document solutions

Markdown Converter

Convert Word (.docx) files to paginated Markdown for agents and retrieval-augmented generation (RAG). Keep page references with body text and read headers and footers separately.

Explore Markdown Converter→

PDF converter

Convert DOCX files to PDF on your Node.js server. Use the same fonts and layout settings as the editor to keep page breaks consistent.

Explore PDF converter→

Custom UI

Build a DOCX editor interface in React or Vue with your own components and CSS. Replace toolbars, comment threads, and tracked-change controls. Public hooks and chrome slots connect your UI to the editor's state and commands.

Explore Custom UI→

DOCX agents

Build AI agents that read, draft, comment, and redline DOCX files through typed document operations. You control the model, tools, permissions, and review steps.

Explore DOCX agents→

Collaborative editor

Let several people edit one DOCX file together. Show live carets and selections, keep each person's undo history separate, and merge offline edits after reconnection.

Explore Collaborative editor→

Word-faithful document preview

Add a React or Vue DOCX viewer with paginated layout and document fonts. Render tables, images, headers, and footers. Add Pro to review comments and tracked changes.

Explore Word-faithful document preview→