I'm trying to create an envelope using DocuSign REST API. The signature tabs are generated by converting the PDF signature fields, and a signerAttachment tab is added manually.
In the final envelope, there is (as expected) only one signHere tab, but three overlapping signerAttachment tabs, which must be acted upon (read: upload a file) before the envelope can be effectively signed.
Case details
The envelope has 2 documents, one of which has signature tabs generated by transforming PDF fields. There are two recipients, one signer and one "Carbon Copy". The signer, before completing the envelope, must upload an additional document, so I added a signerAttachmentTab.
The JSON sent to the API endpoint /restapi/v2.1/accounts/{accountId}/envelopes follows (null values omitted and sensitive information redacted):
{
"compositeTemplates": [
{
"compositeTemplateId": "0",
"document": {
"documentBase64": "(redacted)",
"documentId": "1",
"fileExtension": "pdf",
"name": "Summary",
"transformPdfFields": "true"
},
"inlineTemplates": [
{
"envelope": {
"emailBlurb": "Just a test for development. Ignore this message",
"emailSubject": "from unit-test 01"
},
"recipients": {
"carbonCopies": [
{
"email": "john.doe#company.com",
"name": "John Doe",
"recipientId": "00283187",
"roleName": "CCOPY",
"routingOrder": "1"
}
],
"signers": [
{
"email": "jane.dee#company.com",
"name": "Jane Dee",
"recipientId": "00283183",
"recipientSignatureProviders": [
{
"signatureProviderName": "(redacted)",
"signatureProviderOptions": {
"sms": "+000-000-000"
}
}
],
"roleName": "SIGNER",
"routingOrder": "1",
"tabs": {
"signerAttachmentTabs": [
{
"xposition": "10",
"yposition": "10",
"documentId": "3",
"name": "Attachment",
"pageNumber": "1",
"recipientId": "00283183",
"tabLabel": "Attach-document",
"tooltip": "SignerAttachment",
"xPosition": "10",
"yPosition": "10"
}
],
"signHereTabs": [
{
"anchorAllowWhiteSpaceInCharacters": "true",
"recipientId": "00283183",
"tabLabel": "firmatario_00283183\\*"
}
]
},
"userId": "00283183"
}
]
},
"sequence": "1"
}
]
},
{
"compositeTemplateId": "1",
"document": {
"documentBase64": "(redacted)",
"documentId": "2",
"fileExtension": "pdf",
"name": "sample0",
"transformPdfFields": "true"
},
"inlineTemplates": [
{
"customFields": {
},
"envelope": {
"emailBlurb": "Just a test for development. Ignore this message",
"emailSubject": "from unit-test 01"
},
"recipients": {
"carbonCopies": [
{
"email": "john.doe#company.com",
"name": "John Doe",
"recipientId": "00283187",
"roleName": "CCOPY",
"routingOrder": "1"
}
],
"signers": [
{
"email": "jane.dee#company.com",
"name": "Jane Dee",
"recipientId": "00283183",
"recipientSignatureProviders": [
{
"signatureProviderName": "(redacted)",
"signatureProviderOptions": {
"sms": "+000-000-000"
}
}
],
"roleName": "SIGNER",
"routingOrder": "1",
"tabs": {
"signerAttachmentTabs": [
{
"xposition": "10",
"yposition": "10",
"documentId": "3",
"name": "Attachment",
"pageNumber": "1",
"recipientId": "00283183",
"tabLabel": "Attach-document",
"tooltip": "SignerAttachment",
"xPosition": "10",
"yPosition": "10"
}
],
"signHereTabs": [
{
"anchorAllowWhiteSpaceInCharacters": "true",
"recipientId": "00283183",
"tabLabel": "firmatario_00283183\\*"
}
]
},
"userId": "00283183"
}
]
},
"sequence": "2"
}
]
},
{
"compositeTemplateId": "2",
"document": {
"documentBase64": "(redacted)",
"documentId": "3",
"fileExtension": "pdf",
"name": "sample1",
"transformPdfFields": "true"
},
"inlineTemplates": [
{
"envelope": {
"emailBlurb": "Just a test for development. Ignore this message",
"emailSubject": "from unit-test 01"
},
"recipients": {
"carbonCopies": [
{
"email": "john.doe#company.com",
"name": "John Doe",
"recipientId": "00283187",
"roleName": "CCOPY",
"routingOrder": "1"
}
],
"signers": [
{
"email": "jane.dee#company.com",
"name": "Jane Dee",
"recipientId": "00283183",
"recipientSignatureProviders": [
{
"signatureProviderName": "(redacted)",
"signatureProviderOptions": {
"sms": "+000-000-000"
}
}
],
"roleName": "SIGNER",
"routingOrder": "1",
"tabs": {
"signerAttachmentTabs": [
{
"xposition": "10",
"yposition": "10",
"documentId": "3",
"name": "Attachment",
"pageNumber": "1",
"recipientId": "00283183",
"tabLabel": "Attach-document",
"tooltip": "SignerAttachment",
"xPosition": "10",
"yPosition": "10"
}
],
"signHereTabs": [
{
"anchorAllowWhiteSpaceInCharacters": "true",
"recipientId": "00283183",
"tabLabel": "firmatario_00283183\\*"
}
]
},
"userId": "00283183"
}
]
},
"sequence": "3"
}
]
}
],
"notification": {
"expirations": {
"expireAfter": "2",
"expireEnabled": "true"
}
},
"status": "sent",
"transactionId": "55909b0d-b54f-454e-b966-e58ca5fb4e7e"
}
The envelope definition has been written following the guidelines by DocuSign, namely by inserting a composite template for each document and assigning the recipients to each one of them.
Now, I expect that, despite the same recipients being declared three times (one for each document), they will be merged in the final envelopes, as per this quote from the same page:
When you use multiple templates to create an envelope, two or more templates may define the same recipient (a recipient with the same role or even the same name as other recipients), creating duplicate recipients. You can automatically merge these duplicate recipients by making sure that each of these duplicate recipients has the same email, user name, and routing order. In this case, any duplicate recipients are merged together after all template overlays have been applied.
What I observe is that, in the final envelope, there is -- as expected -- only one signature field, but three overlapping signerAttachment field. Therefore, the signer has to upload the same file three times to complete the envelope.
A call to the endpoint /restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs confirms the presence of three similar tabs:
{
"signHereTabs": [
{
"stampType": "signature",
"isSealSignTab": "false",
"name": "SignHere",
"tabLabel": "firmatario_00283183_Firma consulenza_001",
"scaleValue": "1",
"optional": "false",
"documentId": "3",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "391",
"yPosition": "719",
"width": "0",
"height": "0",
"tabId": "2cee0f3e-a2bb-4aae-a5b4-82c66b177c0a",
"tabType": "signhere"
}
],
"signerAttachmentTabs": [
{
"name": "Attachment",
"tabLabel": "Attach-document",
"scaleValue": "1",
"optional": "false",
"documentId": "3",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "10",
"yPosition": "10",
"width": "0",
"height": "0",
"tabId": "a67c3071-6ac4-4c3b-a20c-0197cda091ed",
"tabType": "signerattachment",
"tooltip": "SignerAttachment"
},
{
"name": "Attachment",
"tabLabel": "Attach-document",
"scaleValue": "1",
"optional": "false",
"documentId": "3",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "10",
"yPosition": "10",
"width": "0",
"height": "0",
"tabId": "c20809de-3792-4ff7-ab31-6f09a13f3fbc",
"tabType": "signerattachment",
"tooltip": "SignerAttachment"
},
{
"name": "Attachment",
"tabLabel": "Attach-document",
"scaleValue": "1",
"optional": "false",
"documentId": "3",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "10",
"yPosition": "10",
"width": "0",
"height": "0",
"tabId": "1d0c84cd-6511-47c2-a75f-73721ac2fb0f",
"tabType": "signerattachment",
"tooltip": "SignerAttachment"
}
]
}
Why the signerAttachment tabs are not merged like the signHere tabs and what can be done to merge them in the resulting envelope?
I believe the issue is that in the case of the SignHere tab, your InLineTemplate is not creating the SignHere tabs, it is providing/updating the settings for the existing tab where the tabLabel is "firmatario_00283183"
(The tab is existing because it was created as part of the PDF transformation.)
In contrast, your three definitions for the SignerAttachment tabs are each creating new tabs. So you're seeing the three new SignerAttachment tabs on the document.
Solution: only create as many SignerAttachment tabs as you want. There is no merging (supression) of tabs, just merging of the Recipients.
I will admit that I'm not a gonzo expert on CompositeTemplates. But I think I'm on reasonably firm ground here.
Each signerAttachmentTab specified in each compositeTemplate has specified the same document for placement - "documentId": "3", so each of your composites is placing a new signer attachment tab to the same document, ID 3. If you only want one signer attachment, only specify it in the requisite composite. For documentId = 3, that would be your third composite. If you want an attachment tab on each document, then make sure you specify the correct documentId.
Let my envelope be as below :
{
"allowReassign": "false",
"documents": [
{
"documentBase64": "JVBE",
"documentId": "1",
"fileExtension": "PDF",
"name": "DocumentToNotarize"
}
],
"emailSubject": "Notary Test",
"enableWetSign": "false",
"notification": {
"expirations": {
"expireAfter": "4",
"expireEnabled": "True"
}
},
"recipients": {
"inPersonSigners": [
{
"email": "signer#domain.com",
"inPersonSigningType": "notary",
"name": "Signer",
"notaryHost": {
"deliveryMethod": "email",
"email": "notary#domain.com",
"name": "Notary",
"recipientId": "995a0019-f0bc-47bf-94d5-426607388f7b",
"tabs": {
"notarizeTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "100",
"yPosition": "100"
}
]
}
},
"recipientId": "3fa6ffaf-f87e-4f27-9129-6d12d987f59b",
"tabs": {
"signHereTabs": [
{
"documentId": "1",
"pageNumber": "1",
"recipientId": "3fa6ffaf-f87e-4f27-9129-6d12d987f59b",
"scaleValue": "0.6",
"xPosition": "45",
"yPosition": "527"
}
]
}
}
]
},
"status": "sent"
}
Which triggers the following error :
{
"errorCode": "NOTARY_HOSTED_SIGNER_ID_REQUIRED",
"message": "The host signer Id is required to associate with notary in person signer."
}
I have found, surprisingly, that if I only change the signer's recipientId to an integer as below, it works !?
Am I missing something ? GUIDs are allowed right ?
"recipientId": "3",
"tabs": {
"signHereTabs": [
{
"documentId": "2",
"pageNumber": "1",
"recipientId": "3",
"scaleValue": "0.6",
"xPosition": "45",
"yPosition": "527"
}
]
}
}
I have found, surprisingly, that if I only change the signer's recipientId to an integer as below, it works !? Am I missing something ? GUIDs are allowed right ?
If it works when you use an integer, then I recommend you use an integer.
If you want to store a guid with the recipient as metadata that you can later retrieve from the envelope, then use the customFields attribute of the signer object.
For most API calls, there isn't a problem to set a GUID for recipientId because most recipient types aren't dependent on another recipient.
The problem here with notary is that the notary and signer recipient are associated by the recipientId and the API logic is designed to parse recipientId as Int, which likely caused the issue. You would also run into the same issue if using in-person signing as it's a very similar process where the host and the in-person signer are a single recipient.
Could anyone explain to me that how to set email subject line and email message using JSON in Docusign.
Note:(JSON string has to be passed as HTTP request).
Thank you,
Vignesh.B
Use the emailNotification property to set separate email subject and email body per each individual recipient. The emailNotification property should be set per recipient.
Here is a sample Json for the createEnvelope request.
POST /v2/accounts/{accountId}/envelopes
{
"recipients": {
"signers": [
{
"email": "recipientone#acme.com",
"name": "recipient one",
"recipientId": "1",
"routingOrder": "1",
"emailNotification": {
"emailSubject": "Please sign the document Recipient One ",
"emailBody": "Hello Recipient One,\r\n\r\nYour consultant has sent you a new document to view and sign. Please click on the View Documents link below, review the content, and sign the document. If you have any questions, please contact your consultant.\r\n\r\nThank you!",
"supportedLanguage": "en"
},
"tabs": {"signHereTabs": [{"documentId": "1", "pageNumber": "1", "xPosition": "100", "yPosition": "100"}]}
},
{
"email": "recipienttwo#acme.com",
"name": "recipient two",
"recipientId": "2",
"routingOrder": "2",
"emailNotification": {
"emailSubject": "Please sign the document Recipient Two ",
"emailBody": "Hello Recipient Two,\r\n\r\nYour consultant has sent you a new document to view and sign. Please click on the View Documents link below, review the content, and sign the document. If you have any questions, please contact your consultant.\r\n\r\nThank you!",
"supportedLanguage": "en"
},
"tabs": {"signHereTabs": [{"documentId": "1", "pageNumber": "1", "xPosition": "100", "yPosition": "200"}]}
}
]
},
"documents": [
{
"documentBase64": "RG9jIFRXTyBUV08gVFdP",
"documentId": "1",
"fileExtension": "txt",
"name": "Simple Contract",
"order": "1"
}
],
"status": "Sent"
}
Use the emailSubject and emailBlurb properties to set the subject and message for all the recipients in the envelope. These properties have to be set at the root level of your json request.
Note: You can override the properties at the envelope level by specifying the emailNotification property for each recipient as suggested in this answer
Here is a sample Json for the createEnvelope request.
POST /v2/accounts/{accountId}/envelopes
{
"emailSubject": "Email subject for all recipients",
"emailBlurb": "Email body for all recipients",
"status": "Sent",
"recipients": {
"signers": [
{
"email": "recipientone#acme.com",
"name": "recipientone",
"recipientId": "1",
"routingOrder": "1",
"tabs": { "signHereTabs": [ { "documentId": "1", "pageNumber": "1", "xPosition": "100", "yPosition": "100" } ] }
},
{
"email": "recipienttwo#acme.com",
"name": "recipient two",
"recipientId": "2",
"routingOrder": "1",
"tabs": { "signHereTabs": [ { "documentId": "1", "pageNumber": "1", "xPosition": "100", "yPosition": "200" } ] }
}
]
},
"documents": [
{
"documentBase64": "RG9jIFRXTyBUV08gVFdP",
"documentId": "1",
"fileExtension": "txt",
"name": "Simple Contract",
"order": "1"
}
]
}
Is there any REST API call to add a attachment tab while sending envelopes? For this I am referring to this link, but I don't know how to use this. Can you please tel me the full API call?
It's just like any other DocuSign tab, you just need to reference the name properly and set its parameters. Here's an example that would send one signature tab and one signer attachment tab:
POST v2/accounts/{accountId}/envelopes
{
"emailSubject": "Please sign this document",
"documents": [
{
"name": "test.pdf",
"documentId": "1"
}
],
"recipients": {
"signers": [
{
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"documentId": "1",
"yPosition": "100",
"xPosition": "100",
"tabLabel": "Signature Tab",
}
],
"signerAttachmentTabs": [
{
"pageNumber": "1",
"documentId": "1",
"yPosition": "100",
"xPosition": "200",
"required": "true",
"tabLabel": "Signer Attachment Tab",
}
]
},
"routingOrder": "1",
"recipientId": "1",
"name": "Jon Dough",
"email": "jon.dough#email.com"
}
]
},
"status": "sent"
}
We are integrating our BPM application with Docusign. We have a document which should be signed by n individuals. Should we have multiple recipient tags or just 1 recipient tag with multiple signer tags inside that? What would be the difference between both the approaches?
Each Recipient object has properties that identify a specific signer including a property that represents the signer's name, for example). Your "Create Envelope" API request will need to include a separate Recipient object for each Signer -- and then, for each recipient, you'll specify tags that belong to the recipient. (The other approach you describe -- i.e., facilitating multiple people signing an envelope by specifying only one recipient with multiple 'sign here' tags -- is not feasible under any circumstances.)
For example, the recipients structure that represents two Signers, each having one place to sign and one text box to complete, would look something like this:
"recipients": {
"signers": [
{
"name": "John Doe",
"email": "johnsemail#outlook.com",
"recipientId": "1",
"routingOrder": "1",
"clientUserId": "123",
"tabs":{
"signHereTabs":[
{
"tabLabel":"BSign1",
"documentId": "1",
"pageNumber": "1",
"xPosition": "200",
"yPosition": "200"
}
],
"textTabs":[
{
"tabLabel":"BorrowerPhone",
"value":"717-717-7171",
"documentId": "1",
"pageNumber": "1",
"xPosition": "100",
"yPosition": "100"
}
]
}
},
{
"name": "Jane Doe",
"email": "janesemail#outlook.com",
"recipientId": "2",
"routingOrder": "2",
"clientUserId": "567",
"tabs":{
"signHereTabs":[
{
"tabLabel":"CBSign1",
"documentId": "1",
"pageNumber": "2",
"xPosition": "200",
"yPosition": "200"
}
],
"textTabs":[
{
"tabLabel":"Co-BorrowerPhone",
"value":"111-222-3333",
"documentId": "1",
"pageNumber": "2",
"xPosition": "100",
"yPosition": "100"
}
]
}
}
]
}
Taking some time to review the information (and code samples) on the DocuSign Developer Center (https://www.docusign.com/developer-center) and within the REST API Guide (https://10226ec94e53f4ca538f-0035e62ac0d194a46695a3b225d72cc8.ssl.cf2.rackcdn.com/rest-api-guide-v2.pdf) would be time well spent.