Adds templates to the specified envelope.

Request

HTTP request

POST /v2.1/accounts/{accountId}/envelopes/{envelopeId}/templates

Parameters

Parameter NameValueDescription
Path Parameters
accountIdstring

The external account number (int) or account ID GUID.

envelopeIdstring

The envelope's GUID. (For example, 93be49ab-afa0-4adf-933c-f752070d71ec).

Responses

CodeDescriptionReference
201

Successful response.

documentTemplateList
400

Error encountered.

errorDetails

SDK Method

Envelopes::applyTemplate

Definitions

documentTemplate

documentEndPagestring

documentIdstring

Specifies the document ID number that the tab is placed on. This must refer to an existing Document's ID attribute.

documentStartPagestring

errorDetailserrorDetails

Object that describes errors that occur. Only valid for responses; ignored in requests.

templateIdstring

The unique identifier of the template. If this is not provided, DocuSign generates an error and the call fails.

documentTemplateList

documentTemplates[documentTemplate]

errorDetails

This object describes errors that occur. It is only valid for responses, and ignored in requests.

errorCodestring

A code associated with the error condition.

messagestring

A brief message describing the error condition.

Examples

Generic JSON Request/Response

Request
{
  "documentTemplates": [
    {
      "documentId": "sample string 1",
      "templateId": "sample string 2",
      "documentStartPage": "sample string 3",
      "documentEndPage": "sample string 4"
    }
  ]
}
Response
{
  "documentTemplates": [
    {
      "documentId": "sample string 1",
      "templateId": "sample string 2",
      "documentStartPage": "sample string 3",
      "documentEndPage": "sample string 4",
      "errorDetails": {
        "errorCode": "sample string 1",
        "message": "sample string 2"
      }
    }
  ]
}
Generic XML Request/Response

Request
<documentTemplates xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.com/restapi">
  <documentTemplates>
    <documentTemplate>
      <documentEndPage>sample string 4</documentEndPage>
      <documentId>sample string 1</documentId>
      <documentStartPage>sample string 3</documentStartPage>
      <templateId>sample string 2</templateId>
    </documentTemplate>
  </documentTemplates>
</documentTemplates> 
Response
<documentTemplates xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.com/restapi">
  <documentTemplates>
    <documentTemplate>
      <documentEndPage>sample string 4</documentEndPage>
      <documentId>sample string 1</documentId>
      <documentStartPage>sample string 3</documentStartPage>
      <errorDetails>
        <errorCode>sample string 1</errorCode>
        <message>sample string 2</message>
      </errorDetails>
      <templateId>sample string 2</templateId>
    </documentTemplate>
  </documentTemplates>
</documentTemplates> 
}} />