Document apiReferenceExport

export.toDocx

Serialize a copy of the current document with independent policies for trackedChanges (review-preserving, final, original), comments (preserve, resolve, remove), and contentControls (preserve, flatten). Defaults preserve all three. Resolve closes every open comment thread in the copy. The mode alias selects trackedChanges; conflicting values and unknown policies reject with INVALID_INPUT. Unsupported revision semantics, loss of preserved comment anchors, and collaborative Document API export reject with CAPABILITY_UNSUPPORTED before returning bytes. Use browser export for collaborative sessions. Returns exported bytes and a structured report of allowed warnings without changing the live document.

read-onlyidempotent
doc.export.toDocx(…)

Expected result

Returns an ExportToDocxResult with the resolved mode, base64 DOCX bytes, byte length, and a report.warnings array.

Inputs

mode"review-preserving" | "final" | "original"
policiesobject
Fields
trackedChanges"review-preserving" | "final" | "original"
comments"preserve" | "resolve" | "remove"
contentControls"preserve" | "flatten"

Result

Output fields
mode"review-preserving" | "final" | "original"required
byteLengthintegerrequired
contentBase64stringrequired
reportobjectrequired
Fields
warningsobject[]required

Failures

Pre-apply throws

  • INVALID_INPUT
  • CAPABILITY_UNSUPPORTED

Raw schemas

Open the generated JSON artifact for the exact input, output, success, and failure schemas represented by this contract version.

View raw JSON schemas