> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# Creating and using templates

> Learn how to create and use templates in the Docusign eSignature API.

## Creating and using templates

This topic describes how you can use templates to simplify sending eSignature requests.

## Creating a template

There are three ways to create a template:

* Templates can be [manually created](https://support.docusign.com/s/document-item?bundleId=xry1643227563338\&topicId=dqj1578456412286.html&_LANG=enus\&language=en_US\&rsc_301&_gl=1*1fmkbfk*_gcl_au*NDcwMzg2NzM3LjE3NjczNDg4OTM.) through the Docusign website.
* Templates can be created using the [Templates:create](/docs/esign-rest-api/reference/templates/templates/create) endpoint or the CreateTemplate method from one of the Docusign SDKs.
* Templates (in JSON or XML format) can be [uploaded](https://support.docusign.com/s/document-item?language=en_US\&rsc_301\&bundleId=xry1643227563338\&topicId=jjd1578456627966.html&_LANG=enus&_gl=1*iux7fj*_gcl_au*NDcwMzg2NzM3LjE3NjczNDg4OTM.) into your account.

A unique `templateId` is automatically generated by the Docusign platform and assigned to each template that you create. You'll need this ID to create envelopes from the template using the eSignature API or SDK.

You can retrieve the `templateId` of a template by logging in to your account, selecting the **Templates** tab, selecting the template in question, then clicking the **Template ID** link. The `templateId` is also part of the template's URL.

To see a code example demonstrating how to create a template, see [How to create a template](/docs/esign-rest-api/how-to/create-template).

To see the definition of the template object in the eSignature API, see the **Request Body** section of the [Templates:create](/docs/esign-rest-api/reference/templates/templates/create) API reference page.

## Adding tab data to a template

To add default tab data to a document within a template, add the desired value of the tab to the value property of the tab identified by `tabLabel`.

To see a code example demonstrating how to add tabs to a template, see [How to create a template](/docs/esign-rest-api/how-to/create-template).

## Sending from a template

You can create and send an envelope built from a template by:

* Referencing the template’s unique templateId
* Assigning your recipients to the roles defined within the template's templateRoles node

For example, you might create a template with a signer [recepient](/docs/esign-rest-api/esign101/concepts/recipients) named Signer1, and a Signature tab assigned to that role. The following example JSON envelope body could be used to send an envelope to recipient Hank Scorpio from the template referenced by the `templateId`:

```text
"accountId": "301424",
"emailSubject": "This request is sent from a Template",
"templateId": "55A80182-xxxx-xxxx-xxxx-FD1E1C0F9D74",
"templateRoles": [{
  "roleName": "Signer1",
  "name": "Hank Scorpio",
  "email": "hscorpio@example.com"
}],
"status": "sent"
```

Because all tab, routing, and document information is set within the template, you do not need to set it within the envelope body.

To see a code example demonstrating how to send an envelope built from a template, see [How to request a signature by email using a template](/docs/esign-rest-api/how-to/request-signature-template-remote).

## Best practices

* **Use of templates**: Cache the template ID in your client application and use it when sending envelopes for signature.
* **Merging data**: If envelope fields need to be pre-populated with data from your application, you can populate them using tab data labels. Since the template and the tabs in the template do not change, Docusign recommends that you cache the data structure of the [Envelopes:create](/docs/esign-rest-api/reference/envelopes/envelopes/create) call, including the relevant tab data labels, so that you do not need to fetch the template every single time.

## Next steps

* See [How to create a template](/docs/esign-rest-api/how-to/create-template) for an example demonstrating how to create and add data to a template.
* See [How to request a signature by email using a template](/docs/esign-rest-api/how-to/request-signature-template-remote) for an example demonstrating how to use a template to create an envelope and request a signature.
* See [How to set tab values in a template](/docs/esign-rest-api/how-to/set-template-tab-values) in a template for an example of how to set tab values in a template.
* See the MyAPICalls sample app [Remote Signing with Template](https://myapicalls.sampleapps.docusign.com/scenario/1?_gl=1*1c1v4wt*_gcl_au*NDcwMzg2NzM3LjE3NjczNDg4OTM.) scenario, which walks you through a sequence of API calls that create a template and then create an envelope from the template.
* Review  [Working with Templates](https://support.docusign.com/s/document-item?bundleId=xry1643227563338\&topicId=dqj1578456412286.html&_LANG=enus\&language=en_US\&rsc_301&_gl=1*1qd7xtm*_gcl_au*NDcwMzg2NzM3LjE3NjczNDg4OTM.) on Docusign Support.