EnvelopeTemplates: applyToDocument

Adds templates to a document in the specified envelope.

Request

HTTP request

POST /v2/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/templates

Parameters

Parameter NameValueDescription
Path Parameters
accountIdstring

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

documentIdstring

The ID of the document being accessed.

envelopeIdstring

The envelope's GUID. Eg 93be49ab-afa0-4adf-933c-f752070d71ec

Responses

CodeDescriptionReference
201

Successful response.

documentTemplateList
400

Error encountered.

errorDetails

SDK Method

Envelopes::applyTemplateToDocument

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

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

An error code associated with the error.

messagestring

A short error message.

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