> For the complete documentation index, see [llms.txt](https://developers.docstudio.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.docstudio.com/api-documentation/template-api/template-structure-api.md).

# Template Structure API

Use this page to understand the template object returned by the API and the XML stored in the `data` field. Reuse the same template UUID, version, role IDs, document IDs, and field names in [Create Template](/api-documentation/api-methods/create-template.md), [Send Envelope](/api-documentation/envelope/send-envelope.md), and [Fill Envelope](/api-documentation/envelope/fill-envelope.md).

### Overview

The template object has two parts:

1. Template object fields.
2. Template XML in the `data` field.

The template object fields describe the template metadata. The `data` field stores the full template XML structure.

### Template object example

```json
{
  "access": "account",
  "archive": false,
  "categories": [0],
  "createdAt": "2026-06-04T10:00:00.000Z",
  "data": "<template>...</template>",
  "dataCreatedAt": "2026-06-04T10:00:00.000Z",
  "dataModifiedAt": "2026-06-04T10:00:00.000Z",
  "description": "Template description",
  "modifiedAt": "2026-06-04T10:00:00.000Z",
  "name": "Template name",
  "uuid": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "version": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
```

### Template object fields

<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>

{% hint style="info" %}
Treat `archive`, `createdAt`, `modifiedAt`, `dataCreatedAt`, and `dataModifiedAt` as response metadata. Do not build request logic around these values.
{% endhint %}

### Reusable identifiers

Use these values later in envelope requests:

* `uuid` — template UUID
* `version` — template version UUID
* `role id` — recipient role identifier
* `document id` — document identifier inside the template
* `field name` — field identifier used when sending values

### data field

{% hint style="info" %}
The `data` field contains template XML.
{% endhint %}

```xml
<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>
```

### How template XML is organized

The template XML contains these main blocks:

* `info` — template-level settings
* `documents` — structured and external documents
* `signatures` — signature placements
* `flow` — recipient roles and their order

#### 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](/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](/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

<table><thead><tr><th width="359">Argument</th><th>Description</th></tr></thead><tbody><tr><td>role id</td><td>Role identifier</td></tr><tr><td>title</td><td>Role name in the flow</td></tr><tr><td>type</td><td>Role type. Can be <code>sender</code>, <code>assignee</code>, or <code>signer</code></td></tr><tr><td>order</td><td>Role order number</td></tr></tbody></table>

### Related topics

* [Create Template](/api-documentation/api-methods/create-template.md)
* [Template Static Elements API](/api-documentation/template-api/template-static-elements-api.md)
* [Template Dynamic Fields API](/api-documentation/template-api/template-dynamic-fields-api.md)
* [PDF Fields in Template](/api-documentation/template-api/pdf-fields-in-template.md)
