Skip to navigation

Creating and using templates

View as Markdown

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 through the Docusign website.
  • Templates can be created using the Templates:create endpoint or the CreateTemplate method from one of the Docusign SDKs.
  • Templates (in JSON or XML format) can be uploaded 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.

To see the definition of the template object in the eSignature API, see the Request Body section of the 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.

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

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

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 call, including the relevant tab data labels, so that you do not need to fetch the template every single time.

Next steps