Docs

Apply Document Template

POST /documents/{documentId}/apply-template

POST/documents/{documentId}/apply-template

Fills a document with an empty body from a template: its title (renaming the doc's file, only while it is still named "Untitled document"), content and filters, each filter with a new id; the document's existing filters are replaced. Needs Edit on the doc's file. version is the document's content version from DynamicDocs_GetDocument; returns the new version. 409 with currentVersion and isEmpty when the body has content or a print header or footer (isEmpty false), or the version is stale (isEmpty true); 400 for a coming soon template or a malformed payload. Data tables are checked and stamped under your access as on DynamicDocs_UpdateContent; one you can't save rejects the apply with 400. A token path through a field or record you can't see is saved as "[hidden field]". An Event template in an organization-drive doc answers 400.

Path Parameters

FieldTypeRequiredDescription
documentIduuidRequired

Request Body

FieldTypeRequiredDescription
templateIduuidOptional
versionintegerOptional

Response

FieldTypeDescription
versioninteger
blocksSavedContentBlock[]| null
tokensSavedContentToken[]| null

SavedContentBlock

FieldTypeDescription
blockIdstring| null
stampobject| null
stampLabelstring| null
authoredBySavedContentBlockAuthoredByInfo| null
errorSavedContentBlockErrorInfo| null

SavedContentToken

FieldTypeDescription
attributeIduuid| null
attributeNamestring| null
referencestring| null
segmentstring| null
errorstring| null

SavedContentBlockAuthoredByInfo

FieldTypeDescription
userIduuid
namestring| null

SavedContentBlockErrorInfo

FieldTypeDescription
pathstring| null
usagestring| null
labelstring| null
reasonstring| null