---
search:
  tags:
    - administration
    - POST
seo:
  description: >-
    Creates a new document template for generating standardized… Reference for
    the POST /administration/document-templates endpoint in the Leadtime Public
    API API.
sidebar:
  badge: POST
  label: Create document template
title: Create document template
type: openapi-operation
---
Creates a new document template for generating standardized documents with dynamic content.

**What are Document Templates?**
Document templates standardize recurring documents (contracts, cover letters, requirement specs) by combining static text with variables that get automatically replaced with actual values when generating documents in projects.

**Step-by-step process:**
1. Provide template metadata (name, description, language, type)
2. Define the template content as HTML or Markdown
3. Optionally define custom variables for template-specific placeholders
4. The system converts your content to internal format and stores the template

**Content format:**
You can provide content as HTML or Markdown. The content supports:
- Rich text formatting (headings, lists, tables, bold, italic, etc.)
- System variables (e.g., `#project.name`, `#organization.companyName`, `#currentUser.firstName`)
- Custom variables (defined in the `customVariables` array)
- Conditional sections that show/hide based on variable values
- Page breaks for document structure

**Using variables in content:**
Variables are represented as HTML spans: `<span data-type="variable" data-id="project.name">...</span>`
Custom variables use the format: `<span data-type="variable" data-id="custom.variable_name">...</span>`

**Custom variables:**
Custom variables allow you to add template-specific fields that aren't covered by standard system variables. Each variable has a name, type (Text, Number, Date, Boolean, Select, etc.), optional default value, and can be marked as required. When generating a document, users will be prompted to fill in these values.

**What is returned:**
The created template with content converted back to HTML format and all custom variables included.

<Operation source="api-reference" id="documenttemplatescontroller-createdocumenttemplate" />
