Reputation: 129
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,
Upvotes: 1
Views: 1257
Reputation: 698
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":"[email protected]",
"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--
Upvotes: 4