Partially update document template
Updates only the content and/or custom variables of a document template. All other fields remain unchanged.
What can be updated:
- Template content (optional - only if provided)
- Custom variables (optional - only if provided)
- Metadata fields (name, description, language, type) are NOT updated via this endpoint
Content format: If provided, content should be HTML or Markdown with support for:
- Rich text formatting (headings, lists, tables, etc.)
- System variables (e.g.,
#project.name,#organization.companyName) - Custom variables (defined in the
customVariablesarray) - Conditional sections and page breaks
Using variables:
Variables are represented as HTML spans: <span data-type="variable" data-id="project.name">...</span>
Custom variables use: <span data-type="variable" data-id="custom.variable_name">...</span>
Custom variables: If provided, the entire custom variables array replaces the existing one. Each variable defines a template-specific field with name, type, optional default value, and required flag.
What is returned: The updated template with content converted to HTML format and all custom variables included.
Note: For full updates including metadata, use the PUT endpoint instead.
/administration/document-templates/{id}AuthorizationOAuth2 access token · headerrequiredapi:writeAuthorizationBearer token (JWT) · headerrequiredidstringrequiredfieldsToReturnstringresponseShapestringcompactfullLT-Response-Shapestringfullapplication/jsoncontentstringrequiredcustomVariablesDocumentCustomVariableDto[]Show propertiesHide properties
DocumentCustomVariableDtodescriptionstringidstringnamestringrequiredoptionsstring[]requiredbooleantypestringrequiredTextLongTextNumberDateBooleanSelectMultiSelectvaluestring | number | boolean | string[]Show propertiesHide properties
stringnumberbooleanstringstringcontentstringrequiredcreatedAtstring<date-time>requiredcreatedBystringrequireddescriptionstringrequireddocumentCustomVariablesobject[]requiredidstringrequiredlanguagestringrequirednamestringrequiredtypestringrequiredProjectDocumentupdatedAtstring<date-time>requiredupdatedByobject | nullrequiredworkspaceIdstringrequiredcurl -X PATCH "https://leadtime.app/api/public/administration/document-templates/string" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"content": "<h1>Project Overview</h1><p>Created by <span data-type=\"variable\" data-id=\"currentUser.firstName\">John</span> for <span data-type=\"variable\" data-id=\"project.name\">Website Redesign</span>.</p>",
"customVariables": [
{
"description": "Client company name",
"name": "client_name",
"required": true,
"type": "Text",
"value": "Acme Corporation"
},
{
"description": "Project budget in USD",
"name": "project_budget",
"required": false,
"type": "Number",
"value": 50000
}
]
}'const response = await fetch("https://leadtime.app/api/public/administration/document-templates/string", {
method: "PATCH",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"content": "<h1>Project Overview</h1><p>Created by <span data-type=\"variable\" data-id=\"currentUser.firstName\">John</span> for <span data-type=\"variable\" data-id=\"project.name\">Website Redesign</span>.</p>",
"customVariables": [
{
"description": "Client company name",
"name": "client_name",
"required": true,
"type": "Text",
"value": "Acme Corporation"
},
{
"description": "Project budget in USD",
"name": "project_budget",
"required": false,
"type": "Number",
"value": 50000
}
]
})
});import requests
response = requests.patch(
"https://leadtime.app/api/public/administration/document-templates/string",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"content": "<h1>Project Overview</h1><p>Created by <span data-type=\"variable\" data-id=\"currentUser.firstName\">John</span> for <span data-type=\"variable\" data-id=\"project.name\">Website Redesign</span>.</p>",
"customVariables": [
{
"description": "Client company name",
"name": "client_name",
"required": True,
"type": "Text",
"value": "Acme Corporation"
},
{
"description": "Project budget in USD",
"name": "project_budget",
"required": False,
"type": "Number",
"value": 50000
}
]
},
){
"content": "<h1>Project Contract</h1><p>Project: <span data-type=\"variable\" data-id=\"project.name\">Website Redesign</span></p>",
"createdAt": "2024-01-15T10:30:00Z",
"createdBy": "123e4567-e89b-12d3-a456-426614174000",
"description": "Standard contract template for project agreements",
"documentCustomVariables": [
{
"description": "Client company name",
"id": "var-123",
"name": "client_name",
"options": [],
"required": true,
"type": "Text",
"value": "Acme Corp"
}
],
"id": "123e4567-e89b-12d3-a456-426614174000",
"language": "en",
"name": "Project Contract Template",
"type": "ProjectDocument",
"updatedAt": "2024-01-20T14:45:00Z",
"updatedBy": "123e4567-e89b-12d3-a456-426614174000",
"workspaceId": "123e4567-e89b-12d3-a456-426614174000"
}