> 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

# Rules for CompositeTemplate Usage

Each CompositeTemplate adds a new document and templates overlay into the envelope. For each CompositeTemplate these rules are applied:

* Templates are overlaid in the order of their Sequence value.
* If Document is not passed into the system, the first template’s document (based on template’s Sequence value) is used.
* Last in wins in all cases except for the document (i.e., envelope information, recipient information, secure field information). This was done to keep things simple. There is no special casing. For example, if you want higher security on a tab, then that needs to be specified in the last template in which the tab is included. If you want higher security on a role recipient it needs to be in the last template in which that role recipient is specified.
* Recipient matching is based on Recipient Role and Routing Order. If there are matches, the recipient information is merged together. A final pass is done on all CompositeTemplates, after all template overlays have been applied, to collapse recipients with the same email, username and routing order. This prevents having the same recipients at the same routing order.
* If you specify in a template that a recipient is locked, once that recipient is overlaid the recipient attributes can no longer be changed. The only items that can be changed for the recipient in this case are the email, username, access code and IDCheckInformationInput.
* Tab matching is based on Tab Labels, Tab Types and Documents. If a Tab Label matches but the Document is not supplied, the Tab is overlaid for all the Documents.For example, if you have a simple inline template with only one tab in it with a label and a value, the Signature, Initial, Company, Envelope ID, UserName tabs will only be matched and collapsed if they fall in the exact same X and Y locations.
* RoleName and TabLabel matching is case sensitive.
* A DefaultRecipient node has been introduced so that you can specify which recipient the generated tabs from the PDF form are mapped to. You can also set PDF form generated tabs to a recipient other than the DefaultRecipient by specifying the mapping of the tab label that is created to one of the template recipients (see the following example).You can also use tab label wild carding to map a series of tabs from the PDF form. To use this you must end a tab label with “\*” and then the system matches tabs that start with the label (see the following example).
* If no DefaultRecipient is specified, tabs must be explicitly mapped to recipients in order to be generated from the form. Unmapped form objects will not be generated into their Docusign equivalents. (In the case of Signature/Initials, the tabs will be disregarded entirely. In the case of PDF text fields, the field data will be flattened on the Envelope document, but there will not be a corresponding Docusign data tab.)
* Only the FieldTypes and FieldProperties listed below are extrapolated from the forms:FieldTypes that are extrapolated are: CheckBox, DateTime, ListBox, Numeric, Radio, Text, Signature, and Password.

**When extrapolating Adobe Digital Signatures, the following Adobe names correspond to Docusign names:**

* Adobe name contains DocusignSignHere or eSignSignHere = Docusign Signature
* Adobe name contains DocusignSignHereOptional or eSignSignHereOptional = Docusign Optional Signature
* Adobe name contains DocusignInitialHere or eSignInitialHere = Docusign Initials
* Adobe name contains DocusignInitialHereOptional or eSignInitialHereOptional = Docusign Optional Initials
* Any other Adobe name will default to Docusign Signature

**Note: When extrapolating Adobe text fields, the following Adobe names correspond to Docusign names:**

* Adobe name contains DocusignSignHere or eSignSignHere = Docusign Signature
* Adobe name contains DocusignSignHereOptional or eSignSignHereOptional = Docusign Optional Signature
* Adobe name contains DocusignInitialHere or eSignInitialHere = Docusign Initials
* Adobe name contains DocusignInitialHereOptional or eSignInitialHereOptional = Docusign Optional Initials
* Adobe name contains DocusignEnvelopeID or eSignEnvelopeID = Docusign EnvelopeID
* Adobe name contains DocusignCompany or eSignCompany = Docusign Company
* Adobe name contains DocusignDateSigned or eSignDateSigned = Docusign DateSigned
* Adobe name contains DocusignTitle or eSignTitle = Docusign Title
* Adobe name contains DocusignFullName or eSignFullName = Docusign FullName
* Adobe name contains DocusignSignerAttachmentOptional or eSignSignerAttachmentOptional = Docusign Optional Signer AttachmentAny other name will default to a Docusign data (text)

fieldNote: Docusign will not transform PDF form fields that have the text "DocusignIgnoreTransform" or "eSignIgnoreTransform" as part of the name of the PDF form field. Adobe date fields can be transformed to DocusignDateSigned fields using the same naming scheme.

FieldProperties that are extrapolated are: ReadOnly, Required, MaxLength, Positions, and Initial Data.

## Example:

This example XML posted to our API would create an envelope draft where:

* The document included is the document used. The form fields are extracted from the document and turned into secure fields.
* The server template is applied first.
* The 2 inline templates are applied 2nd and 3rd.In the first inline template, the tabs fld1 and fld2\* are matched against the tabs and the form fields that were converted and their values are placed into the matching tabs. The tab fld2\* finds all tabs that have a label that starts with fld2.\* The PDF metadata template is applied 4th.

```
<CreateEnvelopeFromTemplatesAndForms xmlns="http://www.docusign.net/API/3.0">
   <EnvelopeInformation>
      <TransactionID></TransactionID>
      <Asynchronous>false</Asynchronous>
      <AccountId>ACCOUNT ID</AccountId>
      <EmailBlurb>Test CreateEnvelopeFromTemplatesAndForms</EmailBlurb>
      <Subject>Test CreateEnvelopeFromTemplatesAndForms</Subject>
      <SigningLocation>Online</SigningLocation>
      <CustomFields>
         <CustomField>
            <Name>FromEnvelope</Name>
            <Show>true</Show>
            <Required>false</Required>
            <Value>FromEnvelope</Value>
            <CustomFieldType>Text</CustomFieldType>
         </CustomField>
      </CustomFields>
      <AutoNavigation>true</AutoNavigation>
      <EnvelopeIdStamping>true</EnvelopeIdStamping>
      <AuthoritativeCopy>false</AuthoritativeCopy>
      <EnforceSignerVisibility>false</EnforceSignerVisibility>
      <EnableWetSign>false</EnableWetSign>
      <AllowRecipientRecursion>true</AllowRecipientRecursion>
      <AllowMarkup>false</AllowMarkup>
   </EnvelopeInformation>
   <CompositeTemplates>
      <CompositeTemplate>
         <ServerTemplates>
            <ServerTemplate>
               <Sequence>1</Sequence>
               <TemplateID>TEMPLATE ID</TemplateID>
            </ServerTemplate>
         </ServerTemplates>
         <InlineTemplates>
            <InlineTemplate>
               <Sequence>2</Sequence>
               <Envelope>
                  <Recipients>
                     <Recipient>
                        <ID>1</ID>
                        <UserName>User Name 1</UserName>
                        <Email>user.name1@myemail.com </Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>1</RoutingOrder>
                        <Note />
                        <RoleName>SignerOne</RoleName>
                        <DefaultRecipient>true</DefaultRecipient>
                     </Recipient>
                     <Recipient>
                        <ID>2</ID>
                        <UserName>User Name 2</UserName>
                        <Email>user.name2@myemail.com</Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>2</RoutingOrder>
                        <Note />
                        <RoleName>SignerTwo</RoleName>
                     </Recipient>
                     <Recipient>
                        <ID>3</ID>
                        <UserName>User Name 3</UserName>
                        <Email>user.name3@myemail.com</Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>1</RoutingOrder>
                        <Note />
                        <RoleName>SignerThree</RoleName>
                     </Recipient>
                     <Recipient>
                        <ID>4</ID>
                        <UserName>User Name 4</UserName>
                        <Email>user.name4@myemail.com </Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>2</RoutingOrder>
                        <Note />
                        <RoleName>SignerOne</RoleName>
                     </Recipient>
                  </Recipients>
                  <Tabs>
                     <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>1</RecipientID>
                        <PageNumber>1</PageNumber>
                        <XPosition>12</XPosition>
                        <YPosition>10</YPosition>
                        <ScaleValue>1.00000</ScaleValue>
                        <Type>SignHere</Type>
                        <Name>SignHere</Name>
                        <TabLabel>Sign Here 1</TabLabel>
                        <Value />
                        <CustomTabHeight>0</CustomTabHeight>
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                        <CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>
                        <TemplateLocked>false</TemplateLocked>
                        <TemplateRequired>false</TemplateRequired>
                     </Tab>
                     <Tab>
                        <RecipientID>2</RecipientID>
                        <TabLabel>fld1</TabLabel>
                        <Value>From Inline Template</Value>
                        <Type>Custom</Type>
                     </Tab>
                     <Tab>
                        <RecipientID>2</RecipientID>
                        <TabLabel>fld2*
                        <Value>Wild card from Inline Template</Value>
                        <Type>Custom</Type>
                     </Tab>
                  </Tabs>
                  <Subject>Sample Form</Subject>
                  <EmailBlurb />
                  <SigningLocation>Online</SigningLocation>
                  <CustomFields>
                     <CustomField>
                        <Name>Custom Field</Name>
                        <Show>True</Show>
                        <Required>True</Required>
                        <Value />
                     </CustomField>
                     <CustomField>
                        <Name>Custom Field List</Name>
                        <Show>True</Show>
                        <Required>True</Required>
                        <Value />
                        <CustomFieldType>List</CustomFieldType>
                        <ListItems>One; Two; Three</ListItems>
                     </CustomField>
                  </CustomFields>
                  <AutoNavigation>false</AutoNavigation>
                  <EnvelopeIdStamping>false</EnvelopeIdStamping>
                  <AuthoritativeCopy>false</AuthoritativeCopy>
                  <Notification>
                     <Reminders>
                        <ReminderEnabled>false</ReminderEnabled>
                        <ReminderDelay>0</ReminderDelay>
                        <ReminderFrequency>0</ReminderFrequency>
                     </Reminders>
                     <Expirations>
                        <ExpireEnabled>true</ExpireEnabled>
                        <ExpireAfter>120</ExpireAfter>
                        <ExpireWarn>0</ExpireWarn>
                     </Expirations>
                  </Notification>
                  <EnableWetSign>true</EnableWetSign>
               </Envelope>
            </InlineTemplate>
            <InlineTemplate>
               <Sequence>3</Sequence>
               <Envelope>
                  <Recipients>
                     <Recipient>
                        <ID>1</ID>
                        <UserName>User Name 1</UserName>
                        <Email>user.name1@email.com</Email>
                        <Type>Signer</Type>
                        <AccessCode />
                        <RequireIDLookup>false</RequireIDLookup>
                        <RoutingOrder>1</RoutingOrder>
                        <Note />
                        <RoleName>SignerOne</RoleName>
                        <DefaultRecipient>true</DefaultRecipient>
                     </Recipient>
                  </Recipients>
                  <Tabs>
                     <Tab>
                        <DocumentID>1</DocumentID>
                        <RecipientID>1</RecipientID>
                        <PageNumber>2</PageNumber>
                        <XPosition>12</XPosition>
                        <YPosition>10</YPosition>
                        <ScaleValue>1.00000</ScaleValue>
                        <Type>SignHere</Type>
                        <Name>SignHere</Name>
                        <TabLabel>Sign Here 1</TabLabel>
                        <Value />
                        <CustomTabHeight>0</CustomTabHeight>
                        <CustomTabRequired>false</CustomTabRequired>
                        <CustomTabLocked>false</CustomTabLocked>
                        <CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>
                        <TemplateLocked>false</TemplateLocked>
                        <TemplateRequired>false</TemplateRequired>
                     </Tab>
                  </Tabs>
               </Envelope>
            </InlineTemplate>
         </InlineTemplates>
         <PDFMetaDataTemplate>
            <Sequence>4</Sequence>
         </PDFMetaDataTemplate>
         <Document>
            <ID>1</ID>
            <Name>Form Document</Name>
            <PDFBytes>PDFBYTES_GO_HERE</PDFBytes>
            <TransformPdfFields>true</TransformPdfFields>
            <FileExtension>pdf</FileExtension>
         </Document>
      </CompositeTemplate>
      <!--
         Add another composite template to the mix

<CompositeTemplate>

<ServerTemplates>

....

<InlineTemplates>

...

</InlineTemplates>

<PDFMetaDataTemplate>

...

</PDFMetaDataTemplate>

<Document>

...

</Document>

</CompositeTemplate>

-->
   </CompositeTemplates>
   <ActivateEnvelope>false</ActivateEnvelope>
</CreateEnvelopeFromTemplatesAndForms>
```