# Template Structure API

### Template object (JSON)

```
{
  "access": "account",
  "archive": true,
  "categories": [
    0
  ],
  "createdAt": "string",
  "data": "string",
  "dataCreatedAt": "string",
  "dataModifiedAt": "string",
  "description": "string",
  "modifiedAt": "string",
  "name": "string",
  "uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "version": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
```

Template consists of two blocks:

1. **Template information block**
2. **‘data’ parameter**

### Template information block

```
{
  "access": "account",
  "archive": true,
  "categories": [
    0
  ],
  "createdAt": "string",
  "dataCreatedAt": "string",
  "dataModifiedAt": "string",
  "description": "string",
  "modifiedAt": "string",
  "name": "string",
  "uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "version": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
```

<table><thead><tr><th width="140.20001220703125">Argument</th><th width="106.20001220703125">Format</th><th>Description</th></tr></thead><tbody><tr><td>access</td><td>string</td><td><p>Template access level:</p><p><strong>Mailbox</strong> — available only for the mailbox where it was created.</p><p><strong>Account</strong> — available for all account mailboxes where it was created.</p><p><strong>Public</strong> — available system-wide by UUID.</p></td></tr><tr><td>archive</td><td>boolean</td><td><p><strong>true</strong> — the template was deleted and moved to the archive.</p><p><strong>false</strong> — the template is active and available.</p></td></tr><tr><td>categories</td><td>Int(10)</td><td>Digit that corresponds to the category ID where the template is located</td></tr><tr><td>createdAt</td><td>string</td><td>Template creation date</td></tr><tr><td>dataCreatedAt</td><td>string</td><td>Template version creation date</td></tr><tr><td>modifiedAt</td><td>string</td><td>Template update date</td></tr><tr><td>dataModifiedAt</td><td>string</td><td>Template version update date</td></tr><tr><td>name</td><td>string</td><td>Template name</td></tr><tr><td>description</td><td>string</td><td>Template description</td></tr><tr><td>uuid</td><td>binary(16)</td><td>Template UUID (Universally Unique Identifier)</td></tr><tr><td>version</td><td>binary(16)</td><td>Template version UUID (Universally Unique Identifier)</td></tr></tbody></table>

### ‘data’ parameter

{% hint style="info" %}
**‘data’ parameter** is a XML.
{% endhint %}

```
<template>
    <info>
        <name>TEST template</name>
        <description>TEST template</description>
        <subject/>
        <message/>
        <expire/>
    </info>
    <documents>
        <document id="ef247568-559a-4ec1-9ecc-6b44c9fb8215">
            <info>
                <title>New document</title>
            </info>
            <body>
                <div class="editor-div">
                    <field type="text" name="TEST template 1" roleId="fd8cb669-db1d-41e1-8f6c-2ad3f8fa981a" placeholder="TEST template 1"/>
                    <field type="number" name="TEST template 2" roleId="3f29b3a8-3baa-4218-80b1-5a0bb85af247" placeholder="TEST template 2" precision="0"/>
                </div>
            </body>
        </document>
        <document type="singleAttachment" id="43d47e65-011d-4890-9eaf-c1c6d860b3b2">
            <info>
                <title>New External Document 1</title>
            </info>
            <body>
                <field type="attachment" name="990f11c1-48de-4ac8-8479-a5989d5f08dc" roleId="fd8cb669-db1d-41e1-8f6c-2ad3f8fa981a" attachmentType="all"/>
            </body>
        </document>
    </documents>
    <signatures>
        <signature name="Test signer" roleId="348c486d-2901-4ecd-be0c-9a7e6c2ae2a2" documentId="ef247568-559a-4ec1-9ecc-6b44c9fb8215"/>
        <signature name="Test signer" roleId="348c486d-2901-4ecd-be0c-9a7e6c2ae2a2" documentId="43d47e65-011d-4890-9eaf-c1c6d860b3b2"/>
    </signatures>
    <flow>
        <roles>
            <role id="fd8cb669-db1d-41e1-8f6c-2ad3f8fa981a" title="Sender" type="sender" order="0"/>
            <role id="3f29b3a8-3baa-4218-80b1-5a0bb85af247" title="Assignee" type="assignee" order="1"/>
            <role id="348c486d-2901-4ecd-be0c-9a7e6c2ae2a2" title="Test signer" type="signer" order="2"/>
        </roles>
    </flow>
</template>
```

#### Info

<table><thead><tr><th width="114.4000244140625">Argument</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>Template name</td></tr><tr><td>description</td><td>Template short description</td></tr><tr><td>subject</td><td>Envelope subject. You can provide it in the template or in the envelope</td></tr><tr><td>message</td><td>Envelope short message. You can provide it in the template or in the envelope</td></tr><tr><td>expire</td><td>Envelope expiration date — how many days after creation the envelope expires</td></tr></tbody></table>

#### Structured document info

| Argument    | Description         |
| ----------- | ------------------- |
| document id | Document identifier |
| title       | Document name       |

**Body**

This block contains static data such as text and tables, plus [dynamic fields](/docstudio-docs/docstudio-for-developers/api-documentation/template-api/template-dynamic-fields-api.md).

#### External document info

<table><thead><tr><th width="141.60003662109375">Argument</th><th>Description</th></tr></thead><tbody><tr><td>document type</td><td>Document type. This attribute is provided only for an external document. It can be <code>&#x3C;type="singleAttachment"></code></td></tr><tr><td>document id</td><td>Document identifier</td></tr><tr><td>title</td><td>Document name</td></tr></tbody></table>

**Body**

This block contains an [attachment field](/docstudio-docs/docstudio-for-developers/api-documentation/template-api/template-dynamic-fields-api/file-field-api.md) by default.

#### Signatures

| Argument    | Description         |
| ----------- | ------------------- |
| name        | Signature name      |
| role id     | Role identifier     |
| document id | Document identifier |

#### Flow

| Argument | Description                                         |
| -------- | --------------------------------------------------- |
| role id  | Role identifier                                     |
| title    | Role name in the flow                               |
| type     | Role type. Can be `sender`, `assignee`, or `signer` |
| order    | Role order number                                   |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.docstudio.com/docstudio-docs/docstudio-for-developers/api-documentation/template-api/template-structure-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
