1

I would like to create envelopes using static/composite templates. I have created template, roles and have configured tags related to the roles into my DocuSign account. I also have retrieved the templateid of this template to reference this template from API call.

Is there a way to overlay the document from the template with another document at runtime using an API call? I tried doing the same using the API Explorer(using REST based API call) but instead of overlaying the document, it got appended to the document from the template.

My main reason of doing this is to use the tags for recipient roles so that at run time, I do not need configure the tags for the recipients. In my case, the recipient tags remain the same for all the recipients/envelopes but the document changes every time I create an envelope.

Please advise,

Larry K
  • 47,808
  • 15
  • 87
  • 140
Juiced Tech
  • 129
  • 7

1 Answers1

4

Yes you can do this. Composite templates are the way to go. When you make the call, create a single composite template structure which references both the server-side template and your document. The inlineTemplate with your document should be in sequence 1 whereas your serverTemplate should be in sequence 2. E.g.:

    --f6e755d3-bbcf-44e5-b276-8ae626f97220
    Content-Type: application/json
    Content-Disposition: form-data

    {
       "emailSubject":"DocuSign API - Composite Templates",
       "emailBlurb":"Composite Templates Sample 1",
       "status":"sent",
       "compositeTemplates":[
          {
            "compositeTemplateId": "1",
             "inlineTemplates":[
                {
                   "sequence":"1",
                   "recipients":{
                      "signers":[
                         {
                            "email":"me@u.them",
                            "name":"My Signer",
                            "recipientId":1,
                            "roleName":"Signer1",
                            "tabs":{
                               "textTabs":[
                                  {
                                     "tabLabel":"NDACompany",
                                     "value":"ACME Co USA"
                                  }
                               ]
                            }
                         }
                      ]
                   },
                    "documents": [
                        {
                            "documentId": "1",
                            "name": "Test Doc.txt"
                        }
                    ]
                }
             ],
             "serverTemplates":[
                {
                   "sequence":"2",
                   "templateId":"83A07CB0-CF0C-4823-B68A-42EE983F301A"
                }
             ]
          }
       ]
    }
    --f6e755d3-bbcf-44e5-b276-8ae626f97220
    Content-Type: text/plain
    Content-Disposition: file; filename="Test Doc.txt"; documentid=1; compositeTemplateId=1

    Howdy.  Please sign!
    --f6e755d3-bbcf-44e5-b276-8ae626f97220--
Jeff Kyllo
  • 698
  • 3
  • 8
  • Thank you so much for the detailed answer. I was able to overlay a document to the document from the composite template and create an envelope. Though, I could only create an envelope if I have assigned recipients to the roles in the template itself. I could not add/update the recipients at run time. Can I add recipients to the roles that I have created in the template while creating an envelope? – Juiced Tech Mar 19 '15 at 17:54
  • Indeed. Within each composite template structure (you could have more than just the one above) anything present in any inlineTemplate or serverTemplate is merged. In the example above, I have a Signer1 role in my server template that gets merged, but I could add in a Signer2 as well. All of these templates get mashed together to create a single composite template. – Jeff Kyllo Mar 20 '15 at 09:56
  • Do we need to specifically use REST based API call to create an envelope from composite templates? – Juiced Tech Mar 30 '15 at 20:05
  • You can also do this via SOAP. The method to use is CreateEnvelopeFromTemplatesAndForms. – Jeff Kyllo Apr 01 '15 at 08:41