Document apiReferenceTemplates
templates.apply
Apply detected DOCX template/substrate (styles, numbering, settings, theme, font table, web settings, headers/footers, section defaults) from a source package onto the current document, preserving body content. Scopes are auto-detected from source package evidence.
mutates documentdry runconditional
await doc.templates.apply(…)Expected result
Returns a TemplatesApplyReceipt with detected/applied/skipped scopes, unsupported items, changed parts, id mappings, and warnings.
Inputs
sourcepath | base64requiredpath
kind"path"requiredpathstringrequiredbase64
kind"base64"requireddatastringrequiredfilenamestring1 additional input field
bodyPolicy"preserve"Result
Output fields
true
successtruerequiredchangedbooleanrequireddryRunbooleanrequiredbodyPolicy"preserve"requiredsourceobjectrequiredFields
kind"path" | "base64"requiredfingerprintstringrequiredpartCountintegerrequireddetectedScopesobject[]requiredappliedScopesobject[]requiredskippedScopesobject[]requiredunsupportedItemsobject[]requiredchangedPartsobject[]requiredidMappingsobjectrequiredFields
stylesobject[]numberingobject[]relationshipsobject[]warningsobject[]requiredfalse
successfalserequiredfailureobjectrequiredFields
code"UNSUPPORTED_SOURCE" | "INVALID_PACKAGE" | "CAPABILITY_UNAVAILABLE" | "UNSUPPORTED_TEMPLATE_CONTENT"requiredmessagestringrequiredFailures
Pre-apply throws
INVALID_INPUTCAPABILITY_UNAVAILABLEREVISION_MISMATCH
Non-applied receipt codes
UNSUPPORTED_SOURCEINVALID_PACKAGECAPABILITY_UNAVAILABLE
1 more codes
UNSUPPORTED_TEMPLATE_CONTENT
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