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
| Field | Type | Required | Description |
|---|
| documentId | uuid | Required | |
Request Body
| Field | Type | Required | Description |
|---|
| templateId | uuid | Optional | |
| version | integer | Optional | |
Response
| Field | Type | Description |
|---|
| version | integer | |
| blocks | SavedContentBlock[]| null | |
| tokens | SavedContentToken[]| null | |
SavedContentBlock
| Field | Type | Description |
|---|
| blockId | string| null | |
| stamp | object| null | |
| stampLabel | string| null | |
| authoredBy | SavedContentBlockAuthoredByInfo| null | |
| error | SavedContentBlockErrorInfo| null | |
SavedContentToken
| Field | Type | Description |
|---|
| attributeId | uuid| null | |
| attributeName | string| null | |
| reference | string| null | |
| segment | string| null | |
| error | string| null | |
SavedContentBlockAuthoredByInfo
| Field | Type | Description |
|---|
| userId | uuid | |
| name | string| null | |
SavedContentBlockErrorInfo
| Field | Type | Description |
|---|
| path | string| null | |
| usage | string| null | |
| label | string| null | |
| reason | string| null | |