I've been working on integrating the DocuSign REST API into my company's app. Things are mostly working, but there is still one problem. If I upload multiple (>= 2) documents, each with an associated server template, then all of the templates end up getting applied to the first document.
For example, the following API call to /accounts/account_id/envelopes
should upload two documents: document1.pdf
(7 pages) and document2.pdf
(2 pages). document1.pdf
's server template has a sign-here field on the 7th page and document2.pdf
's server template has a sign-here field on the 2nd page.
What appears on the DocuSign website is an envelope with the two documents correctly uploaded, but with document2.pdf
's sign-here field appearing on page 2 of document1.pdf
. If I manually remove and reapply the template on document2.pdf
, then the field gets correctly placed. I suspect this is due to a subtle problem with my sequence
attributes, but I have been unable to figure out exactly what is wrong.
{
"allowReassign": false,
"emailBlurb": "email text",
"emailSubject": "subject",
"status": "created",
"compositeTemplates": [
{
"document": {
"name": "document1.pdf",
"documentId": "1"
},
"serverTemplates": [
{
"sequence": "1",
"templateId": "12345678-abcd-1234-abcd-1234567890ab"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"name": "Test Primary",
"email": "test@example.com",
"recipientId": "1",
"routingOrder": "1",
"roleName": "RoleOne"
}
]
}
}
]
},
{
"document": {
"name": "document2.pdf",
"documentId": "2"
},
"serverTemplates": [
{
"sequence": "2",
"templateId": "abcdef12-1234-abcd-1234-abcdef123456"
}
],
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"name": "Test Primary",
"email": "test@example.com",
"recipientId": "1",
"routingOrder": "1",
"roleName": "RoleOne"
}
]
}
}
]
}
]
}