DocuSign API yields CANNOT_EXCLUDE_DOCUMENT error - docusignapi

We have had code using the DocuSign C# API in production for well over a year now, including some that successfully excludes documents from some recipients but not others. Now, on a new envelope type, I am getting the above error and can't figure out why. Below are the lightly edited/anonymized JSON request payload and DocuSign response with the error (both captured with Fiddler).
As you can see, there are three documents and two signers, with both signers getting document id 1, and one signer being excluded from document id 2 and the other signer excluded from document id 3. There are also two carbon copy recipients who are both internal employees on our account. For what it's worth, the Document Visibility setting on the account is "Must sign to view, unless a member of sender's account."
Here is the JSON payload being sent to DocuSign to create the envelope:
{
"documents": [
{
"documentId": "1",
"name": "Document1",
"fileExtension": "pdf",
"order": "1",
"documentBase64": "blahblahblah"
},
{
"documentId": "2",
"name": "Document2",
"fileExtension": "pdf",
"order": "2",
"documentBase64": "blahblahblah"
},
{
"documentId": "3",
"name": "Document2",
"fileExtension": "pdf",
"order": "3",
"documentBase64": "blahblahblah"
}
],
"recipients": {
"signers": [
{
"tabs": {
"signHereTabs": [
{
"name": "Joe Smith",
"tabLabel": "Signature1",
"scaleValue": "0.9",
"documentId": "1",
"recipientId": "1",
"anchorString": "Some anchor text",
"anchorXOffset": "4",
"anchorYOffset": "46",
"anchorMatchWholeWord": "true",
"tabId": "Signature1"
},
{
"name": "Joe Smith",
"tabLabel": "Signature2",
"documentId": "2",
"recipientId": "1",
"anchorString": "Some other anchor text",
"anchorXOffset": "4",
"anchorYOffset": "67",
"anchorMatchWholeWord": "true",
"tabId": "Signature2"
}
],
"dateSignedTabs": [
{
"tabLabel": "DateSigned1",
"documentId": "1",
"recipientId": "1",
"anchorString": "Some anchor text",
"anchorXOffset": "175",
"anchorYOffset": "38",
"anchorMatchWholeWord": "true",
"tabId": "DateSigned1"
}
],
"textTabs": []
},
"recipientSuppliesTabs": "false",
"excludedDocuments": [ "3" ],
"name": "Joe Smith",
"email": "joesmith#example.com",
"emailRecipientPostSigningURL": "https://www.foocorp.com/e-consent-complete/",
"recipientId": "1",
"customFields": [],
"routingOrder": "1",
"roleName": "Signer",
"emailNotification": {
"emailSubject": "Joe Smith has documents from Foo Corp",
"emailBody": "Blah blah blah"
}
},
{
"tabs": {
"signHereTabs": [
{
"name": "Bob Jones",
"tabLabel": "Signature1",
"scaleValue": "0.9",
"documentId": "1",
"recipientId": "2",
"anchorString": "Some anchor text",
"anchorXOffset": "277",
"anchorYOffset": "46",
"anchorMatchWholeWord": "true",
"tabId": "Signature1"
},
{
"name": "Bob Jones",
"tabLabel": "Signature3",
"documentId": "3",
"recipientId": "2",
"anchorString": "Some other anchor text",
"anchorXOffset": "4",
"anchorYOffset": "67",
"anchorMatchWholeWord": "true",
"tabId": "Signature3"
}
],
"dateSignedTabs": [
{
"tabLabel": "DateSigned1",
"documentId": "1",
"recipientId": "2",
"anchorString": "Some anchor text",
"anchorXOffset": "448",
"anchorYOffset": "38",
"anchorMatchWholeWord": "true",
"tabId": "DateSigned1"
}
],
"textTabs": []
},
"recipientSuppliesTabs": "false",
"excludedDocuments": [ "2" ],
"name": "Bob Jones",
"email": "bobjones#example.com",
"emailRecipientPostSigningURL": "https://www.foocorp.com/e-consent-complete/",
"recipientId": "2",
"customFields": [],
"routingOrder": "1",
"roleName": "Signer",
"emailNotification": {
"emailSubject": "Bob Jones has documents from Foo Corp",
"emailBody": "Blah blah blah"
}
}
],
"carbonCopies": [
{
"name": "Sue Employee",
"email": "sue#foocorp.com",
"emailRecipientPostSigningURL": "https://www.foocorp.com/e-consent-complete/",
"recipientId": "3",
"customFields": [],
"routingOrder": "1",
"roleName": "Internal",
"emailNotification": {
"emailSubject": "Joe Smith has documents from Foo Corp",
"emailBody": "Blah blah blah"
}
},
{
"name": "Sam Employee",
"email": "sam#foocorp.com",
"emailRecipientPostSigningURL": "https://www.foocorp.com/e-consent-complete/",
"recipientId": "4",
"customFields": [],
"routingOrder": "1",
"roleName": "Internal",
"emailNotification": {
"emailSubject": "Joe Smith has documents from Foo Corp",
"emailBody": "Blah blah blah"
}
}
],
"certifiedDeliveries": []
},
"status": "created",
"emailSubject": "Joe Smith has documents from Foo Corp",
"emailBlurb": "Blah blah blah",
"allowMarkup": "false",
"allowReassign": "false",
"recipientsLock": "true",
"emailSettings": {
"replyEmailAddressOverride": "sue#foocorp.com",
"replyEmailNameOverride": "Sue Employee"
}
}
And here is the HTTP response:
HTTP/1.1 400 Bad Request
Cache-Control: no-cache
Content-Length: 177
Content-Type: application/json; charset=utf-8
X-RateLimit-Reset: 1519927200
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 997
X-DocuSign-TraceToken: deadbeef-dead-beef-dead-beefdeadbeef
Date: Thu, 01 Mar 2018 17:25:01 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains
{
"errorCode": "CANNOT_EXCLUDE_DOCUMENT",
"message": "This document cannot be excluded for this recipient. Recipient: Joe Smith cannot be excluded from Document:"
}
Any direction appreciated.
Edited to show that the excluded documents both share the same name because it's a "logical name" to me, e.g., "W9" that I use in combination with custom fields on the document to then route to the right place in doc management when it comes back via a Connect call. If I send document id 2 and 3 with different names, then it all works. But exclusions work by document id, not document name, so why would that matter?
Edit #2: I was able to prove to myself that it doesn't matter what the document name is - whether they're the same or different, I get the error.

When you use Anchor string then DocuSign searches for that anchor string on complete envelope and anchors are not at document scope instead anchors are on envelope scope. So if you have same two documents added into the envelope then DocuSign will find the anchor string in both the documents and will assign DS Tabs on both documents to the recipients. Now since you are using same documents twice, so DS Tabs from both documents will be assigned to the recipient and excludedDocuments will not make sense in this scenario.

Related

DocuSign: recipient signerAttachmentTabs inappropriately replicated

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.

RecipientId get changed by docusign

I am creating envelope using DocuSign API. While creating envelope I am also passing list of signers and also set my own unique "RecipientId" (GUID) for each signers. But when envelope gets created and checking the list of recipients(signers) and found that recipient id gets changed all time. It is not "RecipientId" which I am passing.
Can you help me how can we set own "RecipientId" while creating envelope?
-- Create envelope request
{ "documents": [{
"documentBase64": "<Base64BytesHere>",
"documentId": "1",
"fileExtension": "pdf",
"name": "lite"
}],
"emailSubject": "test recipient 2",
"recipients": { "signers": [ { "email": "xxx.yyy#xxx.com",
"name": "xxx yyy",
"recipientId": "1"
} ]
},
"status": "sent"
}
-- Web hook Response see recipient Id --
<DocuSignEnvelopeInformation><EnvelopeStatus>
<RecipientStatuses>
<RecipientStatus>
<Type>Signer</Type>
<Email>xxx.yyy#abc.com</Email>
<UserName>xxx yyy</UserName>
<RoutingOrder>1</RoutingOrder>
<Sent>2017-08-29T02:13:33.853</Sent>
<DeclineReason xsi:nil="true"/>
<Status>Sent</Status>
<RecipientIPAddress/>
<CustomFields/>
<AccountStatus>Active</AccountStatus>
<RecipientId>011eac75-f2fa-4f57-94df-5aedaxxxxxxx</RecipientId>
</RecipientStatus>
</RecipientStatuses>
....
<DocuSignEnvelopeInformation><EnvelopeStatus>
Another way around this is to use recipient.customFields. It's an array of strings:
someEnvelopeSigner.customFields = [yourUUID, somethingElse]
In the webhook / event notification, it will come through in DocuSignEnvelopeInformation.EnvelopeStatus[0].RecipientStatuses[0].RecipientStatus[i].CustomFields and look something like (in JSONified form)
{
"CustomFields": [{
"CustomField": [
"6e45cb20-3953-11ea-b02d-dedef9da77b9",
"something else!"
]
}],
}
You can specify a unique recipientId for each recipient while creating an envelope.
Here is a sample CreateEnvelope request
POST /v2/accounts/{accountId}/envelopes
Json Payload.
{
"emailSubject": "Please sign the agreement",
"status": "sent",
"recipients": {
"signers": [
{
"email": "janedoe#acme.com",
"name": "jane doe",
"recipientId": 1,
"routingOrder": 1,
"tabs": {
"signHereTabs": [
{
"documentId": "1", "pageNumber": "1", "xPosition": "80", "yPosition": "80"
}
]
}
},
{
"email": "johnsmith#acme.com",
"name": "john smith",
"recipientId": 2,
"routingOrder": 2,
"tabs": {
"signHereTabs": [
{
"documentId": "1", "pageNumber": "1", "xPosition": "80", "yPosition": "180"
}
]
}
}
]
},
"documents": [
{
"documentId": "1",
"name": "Contract",
"fileExtension": "txt",
"documentBase64": "RG9jIFRXTyBUV08gVFdP"
}
]
}
Use the listEnvelopeRecipients api to retrieve the list of recipients in the envelope.
{
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"name": "jane doe",
"email": "janedoe#acme.com",
"recipientId": "1",
"recipientIdGuid": "98d60cc3-5f67-46e4-9fc0-ca6bb519f1c9",
"requireIdLookup": "false",
"userId": "585b8733-b1a9-4329-87e7-4f20bcde00c2",
"routingOrder": "1",
"status": "sent"
},
{
"creationReason": "sender",
"isBulkRecipient": "false",
"name": "john smith",
"email": "johnsmith#acme.com",
"recipientId": "2",
"recipientIdGuid": "726bd54d-89ed-41ba-a751-fdb129894b8b",
"requireIdLookup": "false",
"userId": "45abe022-ae12-4816-8c42-fd66d207807a",
"routingOrder": "2",
"status": "created"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "2",
"currentRoutingOrder": "1"
}

Docusign : create envelope with recipient custom field

I'm trying to create an envelope based on a template and assign a custom field to one of the recipients ("customFields": ["5616999"] , which is the employee ID).
This is my POST REST API:
URI : https://demo.docusign.net/restapi/v2/accounts/{accountid}/envelopes
Payload:
{ "status":"sent",
"emailSubject": "Test with template and custom field",
"templateId": "447e6671-74d1-45ce-bf3b-aa7a5c235ea5", "documents": [{ "documentId": "25407849", "name": "testTemplateDoc2.pdf", "documentBase64": " my base64 string of the document"}],
"templateRoles": [{
"email": "test#gmail.com",
"name": "john doe",
"recipientId": "10501840",
"roleName": "RH",
"routingOrder": "1",
"emailNotification": {
"emailBody": "text12808",
"emailSubject": "Signez ce document [[Collaborateur_UserName]]",
"supportedLanguage": "fr"
},
"recipientSignatureProviders": [{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"sms": "+33265555555"
}
}
],
"tabs": {
"signHereTabs": [{
"anchorString": "/RH1/",
"anchorUnits": "pixels",
"anchorXOffset": "0",
"anchorYOffset": "0",
"name": "Please sign here",
"optional": "false",
"recipientId": "10501840",
"scaleValue": 1
}
]
}
}, {
"email": "test2#gmail.com",
"name": "jane doe",
"recipientId": "61432066",
"roleName": "Collaborateur",
"routingOrder": "2",
"emailNotification": {
"emailBody": "text2 2808",
"emailSubject": "Signez votre document Mr. [[Collaborateur_UserName]]",
"supportedLanguage": "fr"
},
"recipientSignatureProviders": [{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"oneTimePassword": "1234"
}
}
],
"tabs": {
"signHereTabs": [{
"anchorString": "/S1/",
"anchorUnits": "pixels",
"anchorXOffset": "0",
"anchorYOffset": "0",
"name": "Please sign here",
"optional": "false",
"recipientId": "61432066",
"scaleValue": 1
}
]
},
"customFields": ["5616999"]
}, {
"email": "test3#gmail.com",
"name": "john3 doe3",
"recipientId": "64377607",
"roleName": "Directeur",
"routingOrder": "3",
"emailNotification": {
"emailBody": "text3 2808",
"emailSubject": "consultez le document de Mr. [[Collaborateur_UserName]]",
"supportedLanguage": "fr"
},
"recipientSignatureProviders": [{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"oneTimePassword": "1234"
}
}
]
}
]
}
SO I got a 200 OK and my envelope was created successfully, however the recipient custom field does not appear when I do a simple GET on the envelope.
I think it's not taken into account.
This is my GET URI
https://demo.docusign.net/restapi/v2/accounts/{accountID}/envelopes/{envelopeid}/recipients?include_extended=true&include_tabs=true
this is the result :
{
"signers": [
{
"tabs": {
"signHereTabs": [
{
"stampType": "signature",
"name": "Please sign here",
"tabLabel": "Sign Here",
"scaleValue": 1,
"optional": "false",
"documentId": "1",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "69",
"yPosition": "688",
"anchorString": "/RH1/",
"anchorXOffset": "0",
"anchorYOffset": "0",
"anchorUnits": "pixels",
"tabId": "a3c9e24a-054c-4e39-bb85-ff602c9afd15"
}
]
},
"signInEachLocation": "false",
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSignatureProviders": [
{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"sms": "+330642037079"
}
}
],
"name": "john doe",
"email": "test#gmail.com",
"recipientId": "1",
"recipientIdGuid": "77e97f08-552e-4e5b-ab0d-1802d72813cf",
"requireIdLookup": "false",
"userId": "0358b4e5-2c64-4d37-a6c2-d9f099ff5071",
"routingOrder": "1",
"note": "",
"roleName": "RH",
"status": "created",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "[BPMED] Signez ce document [[Collaborateur_UserName]]",
"emailBody": "text12808",
"supportedLanguage": "fr"
},
"totalTabCount": "1"
},
{
"tabs": {
"signHereTabs": [
{
"stampType": "signature",
"name": "Please sign here",
"tabLabel": "Sign Here",
"scaleValue": 1,
"optional": "false",
"documentId": "1",
"recipientId": "2",
"pageNumber": "1",
"xPosition": "69",
"yPosition": "264",
"anchorString": "/S1/",
"anchorXOffset": "0",
"anchorYOffset": "0",
"anchorUnits": "pixels",
"tabId": "5bf64798-f22a-4f08-9bfd-da5745c1c0a0"
}
]
},
"signInEachLocation": "false",
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSignatureProviders": [
{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"oneTimePassword": "1234"
}
}
],
"name": "jane doe",
"email": "test2#gmail.com",
"recipientId": "2",
"recipientIdGuid": "c3de6e46-be6a-4ccf-b939-30c0cd251849",
"requireIdLookup": "false",
"userId": "e0a726f8-a89d-4b86-99fc-153150cd4892",
"routingOrder": "2",
"note": "",
"roleName": "Collaborateur",
"status": "created",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "[BPMED] Signez votre document Mr. [[Collaborateur_UserName]]",
"emailBody": "text2 2808",
"supportedLanguage": "fr"
},
"totalTabCount": "2"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [
{
"name": "john3 doe3",
"email": "test3#gmail.com",
"recipientId": "3",
"recipientIdGuid": "b9569f7c-996d-4549-88f6-1e05e9b96ea7",
"requireIdLookup": "false",
"userId": "6f0b5463-3baa-4607-bcc9-1958873c12e2",
"routingOrder": "3",
"note": "",
"roleName": "Directeur",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": " consultez le document de Mr. [[Collaborateur_UserName]]",
"emailBody": " text3 2808",
"supportedLanguage": "fr"
},
"totalTabCount": "0"
}
],
"inPersonSigners": [],
"recipientCount": "3"
}
I've tried creating the envelope in draft mode and then making a PUT request to add the custom field, but it didn't work either...
PS: I've successfully created envelopes with recipient custom fields (not based on a template) and it was ok and the recipient custom field was well integrated in the envelope.
You can use DocuSign compositeTemplates and specify the recipient custom fields. Here is an example. templateRoles does not support specifying recipient custom fields
{
"emailSubject": "Test with template and custom field",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "447e6671-74d1-45ce-bf3b-aa7a5c235ea5"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "test#gmail.com",
"name": "john doe",
"recipientId": "10501840",
"roleName": "RH",
"routingOrder": "1",
"customFields": [ "5616999" ],
"tabs": { },
"emailNotification": { },
"recipientSignatureProviders": { }
}
]
}
}
],
"document": {
"documentId": "25407849",
"name": "testTemplateDoc2.pdf",
"fileExtension": "pdf",
"documentBase64": ""
}
}
]
}

DocuSign Rest API send envelope using composite template

I have a composite template that I use to send the following:
1 document for signing
Another document that doesn't requiring signing, but is included
A document stored in a template
I am receiving the this error : Error performing web request. {
"errorCode": "UNSPECIFIED_ERROR",
"message": "Invalid length for a Base-64 char array or string." I have verified that the Base64 is a multiple of 4. I think that the issue is that I don't have the right content type. I am using Nintex and SharePoint to send the Rest API to DocuSign.
Content type: multipart/form-data;boundary=MY_BOUNDARY
Accept: application/json
Host: na2.docusign.net
--MY_BOUNDARY
Content-Type: application/json
Content-Disposition: form-data
{
"emailSubject": "Contract Package for {ItemProperty:Title}",
"status" : "sent",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence" : 2,
"recipients": {
"signers" : [
{
"email": "{WorkflowVariable:varCreatedByEmail}",
"name": "{WorkflowVariable:varCreatedByName}",
"recipientId": "1",
"roleName": "MI Employee",
"routingOrder": "1",
"tabs":
{"signerAttachmentTabs": [
{"anchorString": "/ea1/",
"anchorXOffset": "1",
"anchorYOffset": "0",
"tabLabel": "Scope of Work Attachment",
"optional": "true",
"tabOrder": 1},
{"anchorString": "/ea2/",
"anchorXOffset": "1",
"anchorYOffset": "0",
"tabLabel": "Pricing Attachment",
"optional": "true",
"tabOrder": 3}],
"textTabs":[
{"anchorString": "/ec1/",
"anchorXOffset": "1",
"anchorYOffset": "0",
"tabLabel": "Scope of Work Text",
"disableAutoSize": true,
"width": 550,
"height": 220,
"tabOrder": 2},
{"anchorString": "/ec2/",
"anchorXOffset": "1",
"anchorYOffset": "0",
"tabLabel": "Pricing Text",
"disableAutoSize": true,
"width": 550,
"height": 220,
"tabOrder": 4}]
}
},
{
"email": "{ItemProperty:E_x002d_Mail}",
"name": "{ItemProperty:Primary_x0020_Contact}",
"recipientId": "2",
"roleName": "Vendor",
"routingOrder": "2",
"tabs":
{"fullNameTabs": [
{"anchorString": "/vn/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"signHereTabs":[
{"anchorString": "/vs/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"dateSignedTabs":[
{"anchorString": "/dvs/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"initialHereTabs":[
{"anchorString": "/vi/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"titleTabs":[
{"anchorString": "/vt/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"emailAddressTabs":[
{"anchorString": "/ve/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"textTabs":[
{"anchorString": "/va1/",
"anchorXOffset": "1",
"anchorYOffset": "0",
"tabLabel": "Address Line 1"},
{"anchorString": "/va2/",
"anchorXOffset": "1",
"anchorYOffset": "0",
"tabLabel": "Address Line 2",
"required": false},
{"anchorString": "/va3/",
"anchorXOffset": "1",
"anchorYOffset": "0",
"tabLabel": "Address Line 3",},
{"anchorString": "/vc/",
"anchorXOffset": "1",
"anchorYOffset": "0",
"tabLabel": "Vendor Name",
"disableAutoSize": true,
"width": 225,
"height": 32}]
}
},
{
"email": "{WorkflowVariable:varContractApproverEmail}",
"name": "{WorkflowVariable:varContractApproverName}",
"recipientId": "3",
"roleName": "MI Approver",
"routingOrder": "3",
"tabs":
{"signHereTabs":[
{"anchorString": "/as/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"dateSignedTabs":[
{"anchorString": "/das/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"fullNameTabs":[
{"anchorString": "/an/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"titleTabs":[
{"anchorString": "/at/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
,
"emailAddressTabs":[
{"anchorString": "/ae/",
"anchorXOffset": "1",
"anchorYOffset": "0"}]
}
} ]
}
} ],
"document": {
"documentId": 1,
"name": "{WorkflowVariable:varContractName}",
"documentbase64": "{WorkflowVariable:varContractBase64}"
}
},
{
"inlineTemplates": [
{
"sequence" : 3,
"recipients": {
"carbonCopies" : [
{
"email": "{WorkflowVariable:varCreatedByEmail}",
"name": "{Common:InitiatorsDisplayName}",
"recipientId": "1",
"roleName": "MI Employee",
"routingOrder": "1"
},
{
"email": "{ItemProperty:E_x002d_Mail}",
"name": "{ItemProperty:Primary_x0020_Contact}",
"recipientId": "2",
"roleName": "Vendor",
"routingOrder": "2"
},
{
"email": "{WorkflowVariable:varContractApproverEmail}",
"name": "{WorkflowVariable:varContractApproverName}",
"recipientId": "3",
"roleName": "MI Approver",
"routingOrder": "3"
}]
}
}],
"document": {
"documentId": 2,
"name": "{WorkflowVariable:varExhibitAName}",
"documentbase64": "{WorkflowVariable:varExhibitABase64}"
}
},
{
"serverTemplates": [
{
"sequence" : 6,
"templateId": "D7472F81-46F9-4BEB-9017-DFAD3C0BCE83"
}],
"inlineTemplates": [
{
"sequence" : 7,
"recipients": {
"signers" : [{
"email": "{WorkflowVariable:varCreatedByEmail}",
"name": "{Common:InitiatorsDisplayName}",
"recipientId": "1",
"roleName": "MI Employee",
"routingOrder": "1"
},
{
"email": "{ItemProperty:E_x002d_Mail}",
"name": "{ItemProperty:Primary_x0020_Contact}",
"recipientId": "2",
"roleName": "Vendor",
"routingOrder": "2",
"tabs": {
"textTabs": [
{
"tabLabel": "VendorName"}]}
},
{
"email": "{WorkflowVariable:varContractApproverEmail}",
"name": "{WorkflowVariable:varContractApproverName}",
"recipientId": "3",
"roleName": "MI Approver",
"routingOrder": "3"
}
]
}
}],
"document": {
"documentId": 4,
"name": "CCare_Pledge.pdf"
}
}]
}
--MY_BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="{WorkflowVariable:varContractName}"; documentid="1"
<document bytes removed>
--MY_BOUNDARY--
Content-Type: application/pdf
Content-Disposition: file; filename="{WorkflowVariable:varExhibitAName}"; documentid="2"
<document bytes removed>
--MY_BOUNDARY--
Content-Type: application/pdf
Content-Disposition: file; filename="CCare_Pledge.pdf"; documentid="4"
Link to base64-
http://www.mihomes.com/corp/vit/Base64.txt
In looking at the request you've posted, a few things jump out at me:
First, you've incorrectly specified the boundary separator for the part that specifies documentid=2 as "--MY_BOUNDARY--"
--MY_BOUNDARY--
Content-Type: application/pdf
Content-Disposition: file; filename="{WorkflowVariable:varExhibitAName}"; documentid="2"
By including the -- at the end of this boundary string, you're indicating the end of the multipart message, so it's quite possible that DocuSign is not reading any of the request content that follows this string. I'd suggest changing this to "--MY_BOUNDARY"
Secondly, you're specifying document bytes multiple times for two of the documents (documentid=1 and documentid=2) -- once as part of the document object (using the documentbase64 attribute) in each Composite Template, and again in the additional parts of the multipart request. I'd suggest removing the documentbase64 attribute from the document object of each Composite Template object -- it's not needed if you're specifying the document bytes in additional parts of the multipart message.
Next, if CCare_Pledge.pdf is the first document contained in the Template you're using, then you should remove the document attribute (object) from that Composite Template object:
"document": {
"documentId": 4,
"name": "CCare_Pledge.pdf"
}
And also remove the final part of the request:
--MY_BOUNDARY--
Content-Type: application/pdf
Content-Disposition: file; filename="CCare_Pledge.pdf"; documentid="4"
This is not needed because the document's coming from the Template itself, so you don't need to specify document info in the request.
Finally, make sure that your request ends with the correct boundary terminator string:
--MY_BOUNDARY--
(The answer to this other post shows a good example of overall request structure with regard to boundary separators.)
Once you've implemented these suggested changes, your request structure should look like this:
--MY_BOUNDARY
Content-Type: application/json
Content-Disposition: form-data
{
"emailSubject": "Contract Package for {ItemProperty:Title}",
"status" : "sent",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence" : 2,
"recipients": {
...
}
}
],
"document": {
"documentId": 1,
"name": "{WorkflowVariable:varContractName}"
}
},
{
"inlineTemplates": [
{
"sequence" : 3,
"recipients": {
...
}
}
],
"document": {
"documentId": 2,
"name": "{WorkflowVariable:varExhibitAName}"
}
},
{
"serverTemplates": [
{
"sequence" : 6,
"templateId": "D7472F81-46F9-4BEB-9017-DFAD3C0BCE83"
}
],
"inlineTemplates": [
{
"sequence" : 7,
"recipients": {
...
}
}
]
}
]
}
--MY_BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="{WorkflowVariable:varContractName}"; documentid="1"
<document bytes removed>
--MY_BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="{WorkflowVariable:varExhibitAName}"; documentid="2"
<document bytes removed>
--MY_BOUNDARY--

can i modify tabs of a template using API in docusign

Reading the API documentation i understood that I can edit the tabs of recipients for an envelope which is created/sent
However i am trying to undertsand can i also modify tabs for a template?
When i used the same request, as the one below i am getting error
Any reference would be appreciable.
The reason for my question is, everytime when i update the feed document for some corrections i have to redo creating the fields over it. Rather if i can send the fields through API that would save me a lot of time
Thank you
Sample JSON while updating the TABS (trying to add Tabs)
{
"signers": [
{
"tabs": {
"fullNameTabs": [
{
"name": "Full Name",
"tabLabel": "Full Name",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
"pageNumber": "1",
"xPosition": "321",
"yPosition": "676",
"tabId": "82be754a-47c6-47fc-9793-6fdec6758060"
}
],
"dateSignedTabs": [
{
"name": "Date Signed",
"value": "",
"tabLabel": "Date Signed",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
"pageNumber": "1",
"xPosition": "504",
"yPosition": "676",
"tabId": "1e3f16e8-77a9-4726-9876-66e6d377a0c1"
}
]
},
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
"recipientIdGuid": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
"requireIdLookup": "false",
"routingOrder": "1",
"roleName": "ONE",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "Subject",
"emailBody": "Body",
"supportedLanguage": "en"
}
},
{
"tabs": {
"signHereTabs": [
{
"name": "Sign Here",
"tabLabel": "Signature 3",
"scaleValue": 0.9,
"optional": "false",
"documentId": "1",
"recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"pageNumber": "1",
"xPosition": "106",
"yPosition": "591",
"tabId": "9b20f825-f37c-4dc6-aa57-d29b3d531d6b"
}
],
"fullNameTabs": [
{
"name": "Full Name",
"tabLabel": "Full Name",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"pageNumber": "1",
"xPosition": "319",
"yPosition": "622",
"tabId": "79c35daf-cada-4a57-ac82-8a2a149839e8"
}
],
"dateSignedTabs": [
{
"name": "Date Signed",
"value": "",
"tabLabel": "Date Signed",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"pageNumber": "1",
"xPosition": "504",
"yPosition": "622",
"tabId": "14d47f01-a911-49b9-bf04-1c4cadb2924a"
}
]
},
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"recipientIdGuid": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"requireIdLookup": "false",
"routingOrder": "2",
"roleName": "TWO",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "Subject",
"emailBody": "Body",
"supportedLanguage": "en"
}
},
{
"tabs": {
"approveTabs": [
{
"buttonText": "Approve",
"width": 60,
"height": 18,
"tabLabel": "Approve 9",
"font": "lucidaconsole",
"bold": "false",
"italic": "false",
"underline": "false",
"fontSize": "size9",
"documentId": "1",
"recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
"pageNumber": "1",
"xPosition": "228",
"yPosition": "718",
"tabId": "5083943e-bdf0-42fe-87ff-d92778b13be7"
}
],
"declineTabs": [
{
"buttonText": "Decline",
"width": 60,
"height": 18,
"declineReason": "",
"tabLabel": "Decline 10",
"font": "lucidaconsole",
"bold": "false",
"italic": "false",
"underline": "false",
"fontSize": "size9",
"documentId": "1",
"recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
"pageNumber": "1",
"xPosition": "350",
"yPosition": "718",
"tabId": "b1c1ad78-e3b9-4630-b411-09127997f7dd"
}
]
},
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
"recipientIdGuid": "95f1d73e-df27-4f19-86ea-c921f0321d26",
"requireIdLookup": "false",
"routingOrder": "3",
"roleName": "THREE",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "Subject",
"emailBody": "Body",
"supportedLanguage": "en"
}
}
],
"agents": [],
"editors": [],
"intermediaries": [
{
"name": "",
"email": "",
"recipientId": "fa2bffdb-81d7-4de4-a964-e543e2d1d3cf",
"recipientIdGuid": "fa2bffdb-81d7-4de4-a964-e543e2d1d3cf",
"requireIdLookup": "false",
"routingOrder": "3",
"roleName": "FOUR",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "Subject",
"emailBody": "Body",
"supportedLanguage": "en"
}
}
],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "5"
}
URL (tried both POST/PUT)
https://DOMAIN/restapi/v2/accounts/ACCTID/envelopes/ENVELOPID/recipients
RESPONSE
{
"errorCode": "ENVELOPE_CANNOT_CORRECT_INVALID_STATE",
"message": "This account may not have 'correct' permission, or the envelope state is not 'sent' or 'delivered'."
}
I don't believe it's possible to modify the tabs in the Template itself, using the API. The "Modify or Correct Recipient Information" operation you're trying to use allows you to "modify recipients in a draft envelope or correct recipient information for an in process envelope." (from p156 of the REST API guide: https://08d1d92f490618f41c65-8fb00e97ac499a7066a18ce9c66b019b.ssl.cf2.rackcdn.com/REST_API_Guide_v2.pdf). Since a Template is neither a draft envelope nor an in-process envelope, I wouldn't expect this operation to work for modifying tags within a Template.
If you wanted to use a template to specify the document(s), and then specify fields via the "Create Envelope" API call each time you send the envelope, you could achieve this by using a technique like I describe below. (The same technique could also be applied if you're using "Composite Templates" in your Create Envelope API call.)
For example, let's say that I've created a template via the DocuSign UI that has a single recipient (Signer1) and no tags within the document(s). I could then use the following request to create an Envelope that has the document(s) and recipient(s) that the template defines, with the tag(s) that my API request specifies (in this example, just a single Text Tab):
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
"emailSubject": "Please sign this",
"emailBlurb": "Please sign...thanks!",
"templateId": "TEMPLATE_ID",
"templateRoles": [
{
"roleName": "Signer1",
"name": "John Doe",
"email": "johnsemail#outlook.com",
"recipientId": "1",
"tabs":{
"textTabs":[
{
"documentId": "1",
"pageNumber": "1",
"recipientId": "1",
"xPosition": "100",
"yPosition": "400",
"tabLabel":"Address",
"name":"Address",
"value":"123 Main Street",
"locked": "false"
},
],
}
}
],
"status": "sent"
}
The example above uses templateRoles in the "Create Envelope" request. If you're instead using Composite Templates in your "Create Envelope" request, the request body would look like this:
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
"emailSubject": "Please sign",
"emailBlurb": "Please sign...thanks!",
"status": "sent",
"compositeTemplates": [{
"serverTemplates": [{
"sequence": 1,
"templateId": "TEMPLATE_ID"
}],
"inlineTemplates": [{
"sequence": 2,
"recipients": {
"signers": [{
"email": "sallysemail#outlook.com",
"name": "Sally Adamson",
"recipientId": "1",
"roleName": "Signer1",
"tabs":{
"textTabs":[
{
"documentId": "1",
"pageNumber": "1",
"recipientId": "1",
"xPosition": "100",
"yPosition": "400",
"tabLabel":"Address",
"name":"Address",
"value":"123 Main Street",
"locked": "false"
},
],
}
}]
}
}]
}]
}
If you're going to implement this approach, I'd suggest that you consider using the "anchor text" technique of specify tag placement, rather than specifying x-y coordinates for each and every tag. Using "anchor text" placement technique means that you specify placement of each tag relative to some existing text within your document(s), such that the tag location will always be correct, even if the format of your document changes slightly -- as long as the anchor text string still exists in the doc and can therefore be used to place the tag. See pages 324-325 of the REST API guide for more info on using anchor text to specify tag placement.

Resources