Templates
Learn how to create, update and publish PDFMonkey Templates using our API.
The DocumentTemplate object
States
Attributes
{
"id": "8ac0d8f7-dbd3-46dd-b2d3-af036a2776d9",
"app_id": "3161c5e5-9966-4630-9b07-63f718092784",
"identifier": "My Awesome Template",
"edition_mode": "code",
"body": "<p>Hello {{name}}</p>",
"body_draft": "<p>Hello, <strong>{{name}}!</strong></p>",
"scss_style": "p { color: green; }",
"scss_style_draft": "p { color: purple; }",
"sample_data": "{ \"name\": \"Peter Parker\" }",
"sample_data_draft": "{ \"name\": \"Spider-Man\" }",
"settings": {
"footer": {
"center": null,
"content": null,
"left": null,
"right": "page [page]/[topage]"
},
"header": {
"center": null,
"content": null,
"left": null,
"right": null,
},
"inject_javascript": false,
"margin": {
"bottom": 0,
"left": 0,
"right": 0,
"top": 0
},
"orientation": "portrait",
"paper_format": "a4",
"paper_height": 297,
"paper_width": 210,
"use_emojis": false,
"use_forms": false,
"use_paged": false
},
"settings_draft": {
"footer": {
"center": null,
"content": null,
"left": null,
"right": "page [page]/[topage]"
},
"header": {
"center": null,
"content": null,
"left": null,
"right": null,
},
"inject_javascript": false,
"margin": {
"bottom": 0,
"left": 0,
"right": 0,
"top": 0
},
"orientation": "portrait",
"paper_format": "a4",
"paper_height": 297,
"paper_width": 210,
"use_emojis": false,
"use_forms": false,
"use_paged": false
},
"pdf_engine_id": "5c709522-90db-4aea-b49f-15aeaa7180c7",
"pdf_engine_draft_id": "5c709522-90db-4aea-b49f-15aeaa7180c7",
"template_folder_id": null,
"ttl": 86400,
"created_at": "2050-01-02T03:04:05.678+02:00",
"updated_at": "2050-01-02T03:04:05.678+02:00",
"auth_token": "ZCsspcSZieyfdCUHYjKW1B9D8mnrz2ck",
"checksum": "kfYsx6xzMx3JkYxLd4LW6YeU5rkcuTxQ",
"preview_url": "https://preview.pdfmonkey.io/pdf/..."
}Settings
PDF Engines
API Requests
List all templates
The workspace to search within
Comma separated list of folder IDs to search within, use "none" to search only in root folder
Pagination parameters
The page number to return
Attribute to sort by
Document templates found
Document templates found
Create a template
The ID of the document template
The ID of the workspace
The human name of the document template
The edition mode of the document template
codePossible values: The published body of the document template. Used to generate documents.
The draft body of the document template. Used to preview changes.
The published (S)CSS style of the document template. Used to generate documents.
The draft (S)CSS style of the document template. Used to preview changes.
The sample data of the document template. Used only to allow reverting changes.
The draft sample data of the document template. Used to preview changes.
The ID of the PDF engine used to generate documents
The ID of the PDF engine used to preview changes, allowing to test a template against a new engine.
The time-to-live of the document template. Used to automatically delete documents after a certain amount of time. Available options depend on you plan. In case the value is too high, the highest available value will be used instead.
300: 5 minutes 1200: 20 minutes 3600: 1 hour 86400: 1 day 604800: 1 week (Pro, Pro+, Premium) 2592000: 1 month (Pro+, Premium) 31536000: 1 year (Pro+, Premium) 0: None (Pro+, Premium)
The date and time the document template was created
The date and time the document template was last updated
Internal
Internal
URL of the template preview. Can be used directly or in an iframe to preview the template.
Template created
Template created
Update a template
The ID of the template
The ID of the document template
The ID of the workspace
The human name of the document template
The edition mode of the document template
codePossible values: The published body of the document template. Used to generate documents.
The draft body of the document template. Used to preview changes.
The published (S)CSS style of the document template. Used to generate documents.
The draft (S)CSS style of the document template. Used to preview changes.
The sample data of the document template. Used only to allow reverting changes.
The draft sample data of the document template. Used to preview changes.
The ID of the PDF engine used to generate documents
The ID of the PDF engine used to preview changes, allowing to test a template against a new engine.
The time-to-live of the document template. Used to automatically delete documents after a certain amount of time. Available options depend on you plan. In case the value is too high, the highest available value will be used instead.
300: 5 minutes 1200: 20 minutes 3600: 1 hour 86400: 1 day 604800: 1 week (Pro, Pro+, Premium) 2592000: 1 month (Pro+, Premium) 31536000: 1 year (Pro+, Premium) 0: None (Pro+, Premium)
The date and time the document template was created
The date and time the document template was last updated
Internal
Internal
URL of the template preview. Can be used directly or in an iframe to preview the template.
Template updated
Template updated
Last updated
Was this helpful?
