I am trying to add a PDF document to an existing draft envelope by using a CompositeTemplate so DocuSign can convert the PDF fields to tabs automatically for me. Unfortunately the request fails with a HTTP code 400 and the following response:
{"errorCode":"INVALID_MULTI_PART_REQUEST","message":"An error was found while parsing the multipart request. No documents found in request."}
This error makes no sense to me since I am specifying the document by using the documentBase64
property so it should not be using multipart.
I am calling PUT .../accounts/???/envelopes/???/documents
with a body of:
{
"compositeTemplates" : [ {
"document" : {
"documentBase64" : "...",
"documentId" : "200",
"name" : "document.pdf",
"transformPdfFields" : "true"
},
"inlineTemplates" : [ {
"recipients" : {
"signers" : [ {
"defaultRecipient" : "true",
"email" : "jdoe@domain.test",
"name" : "John Doe",
"recipientId" : "1"
} ]
},
"sequence" : "1"
} ]
} ]
}
Adding documents to the envelope works fine if I don't use a CompositeTemplate and just put the document directly in the documents
attribute at the top level of the request JSON. Unfortunately, responses to other questions in stackoverflow seem to indicate that transformPdfFields
only works when the document is inside a CompositeTemplate (and indeed it didn't convert PDF fields to tabs when I tried it that way).