<a id="document-templates"></a>
<a id="id1"></a>
# Document Templates

When you generate a document (see : [User Documents](../../user_documents.html.md#user-documents)) the definition of the document comes from a Document Template.

Document Templates define the layout and content of documents. They may also have [settings](template_settings.html.md#template-settings) which allow the user generating a document to modify the content (e.g. whether to include Matrices in a Draft document).

A Template which is not Active does not appear in the list of available Templates. Setting the Active flag to False is useful to retire Document Templates or during development of new versions of Templates which are not yet ready for use by other users.

Locked Templates cannot be modified until they are unlocked. Lock templates when you do not wish them to be modified by accident.

Each Document Template has a unique *fingerprint* which is generated from its definition — the name, description, template text, type, file extension and scope, the Object Type for a Draft Object List Template, and the definitions of its [settings](template_settings.html.md#template-settings). Changing any of those will change this fingerprint, while making a Template Active or Locked will not. This can be used to track validated versions of Document Templates and this fingerprint can be included in the output of the template.

Document Templates may be copied between URLs that a user has access to. Users must have the Manage Document Template permission in order to copy Document Templates into a URL, to create or modify existing Document Templates or to delete Document Templates from a URL.

Writing a Template

- [Document Template Basics](document_template_basics.html.md)
- [Template Settings](template_settings.html.md)
- [Filters](template_filters.html.md)
- [Transforming content with the AI tag](ai_tag.html.md)
- [Getting data back as JSON](ai_json.html.md)
- [Tips and Tricks](tips_and_tricks.html.md)

Data a Template receives

- [Template Context](template_context.html.md)
- [Accessing Metadata and Labels](accessing_metadata_and_labels.html.md)
- [Accessing Custom Objects](accessing_custom_objects.html.md)
- [Choosing and Counting Objects](querying_objects.html.md)
- [Comparing Objects](comparing_objects.html.md)
- [Object Model Reference](attribute_reference.html.md)

Producing each output format

- [Generating Word Documents](generating_word_documents.html.md)
- [Generating PDF Documents](generating_pdf_documents.html.md)
- [Generating Excel Documents](generating_excel_documents.html.md)
- [Generating AI Summaries](generating_ai_summaries.html.md)
