Docusign : create envelope with recipient custom field - docusignapi

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": ""
}
}
]
}

Related

How to pre-fill custom fields when creating an envelope?

My business process is like this:
I have one template with one document.
The document must have several fields that must be filled in differently for each signatory.
For example:
fields "company_name", "signer_name", etc.
I assume that when creating an envelope, the fields must be pre-filled for each signer:
Signer 1 should receive values for the fields: "Alice's company", "Alice",
Signer 2 should receive values for the fields: "Bob's company", "Bob".
To do that, I make POST request to endpoint:
/restapi/v2.1/accounts/{accountId}/envelopes
Body:
{
"emailSubject": "Email Subject",
"templateId": "my-template-id",
"status": "sent",
"customFields": {
"textCustomFields": [
{
"fieldId": "10851848897",
"name": "company_name",
"required": "true",
"show": "true",
"value": "Alice's company"
},
{
"fieldId": "10851848898",
"name": "signer_name",
"required": "true",
"show": "true",
"value": "Alice"
}
]
},
"templateRoles": [
{
"email": "alice#maildomain.com",
"emailNotification": {
"emailBody": "email body",
"emailSubject": "email subject",
"supportedLanguage": "en"
},
"roleName": "signer",
"routingOrder": "1"
}
]
}
Alice recieve link to sign the document without pre-filled fields.
Also, GET request to list document's fields
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields
gives no fields:
{
"documentFields": []
}
Envelope Custom fields can be obtained by a different endpoint:
/restapi/v2.1/accounts/${account_id}/envelopes/${envelope_id}/custom_fields
Now, I assume you actually want something else, which is to show values to the recipients on the envelope.
That is done by actually adding tabs and settings their values like this:
(giving you here a complete example with various different tabs)
ENVELOPE
{
"customFields": {
"textCustomFields": [{
"name": "salary",
"required": "false",
"show": "true",
"value": "123000"
}]
},
"documents": [
{
"documentBase64": "' > $request_data
cat $doc1_base64 >> $request_data
printf '",
"documentId": "1",
"fileExtension": "docx",
"name": "Lorem Ipsum"
}
],
"emailBlurb": "Sample text for email body",
"emailSubject": "Please Sign",
"envelopeIdStamping": "true",
"recipients": {
"signers": [{
"clientUserId": "1000",
"email": "{USER_EMAIL}",
"name": "{USER_NAME}",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [{
"anchorString": "/sn1/",
"anchorUnits": "pixels",
"anchorXOffset": "20",
"anchorYOffset": "10"
}],
"textTabs": [{
"anchorString": "/legal/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "false",
"tabId": "legal_name",
"tabLabel": "Legal name",
"value": "{USER_NAME}"
}, {
"anchorString": "/familiar/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "false",
"tabId": "familiar_name",
"tabLabel": "Familiar name",
"value": "{USER_NAME}"
}, {
"anchorString": "/salary/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "true",
"tabId": "salary",
"tabLabel": "Salary",
"value": "$123,000.00"
}]
}
}]
},
"status": "Sent"
}
TEMPLATE
{
"customFields": {
"textCustomFields": [{
"name": "app metadata item",
"required": "false",
"show": "true",
"value": "1234567"
}]
},
"status": "Sent",
"templateId": "'"${template_id}"'",
"templateRoles": [{
"clientUserId": "1000",
"email": "'"${SIGNER_EMAIL}"'",
"name": "'"${SIGNER_NAME}"'",
"roleName": "signer",
"tabs": {
"checkboxTabs": [{
"selected": "true",
"tabLabel": "ckAuthorization"
}, {
"selected": "true",
"tabLabel": "ckAgreement"
}],
"listTabs": [{
"documentId": "1",
"pageNumber": "1",
"tabLabel": "list",
"value": "green"
}],
"radioGroupTabs": [{
"groupName": "radio1",
"radios": [{
"selected": "true",
"value": "white"
}]
}],
"textTabs": [{
"tabLabel": "text",
"value": "Jabberwocky!"
}, {
"bold": "true",
"documentId": "1",
"font": "helvetica",
"fontSize": "size14",
"height": "23",
"locked": "false",
"pageNumber": "1",
"required": "false",
"tabId": "name",
"tabLabel": "added text field",
"value": "'"${SIGNER_NAME}"'",
"width": "84",
"xPosition": "280",
"yPosition": "172"
}]
}
}, {
"email": "'"${CC_EMAIL}"'",
"name": "'"${CC_NAME}"'",
"roleName": "cc"
}]
}

DocuSign UNKNOWN_ENVELOPE_RECIPIENT Getting Error While all fields i made correct

I am using PHP as language using Raw API.
When Creating envelope i m posting following JSON Code.
{
"compositeTemplates": [
{
"compositeTemplateId": "b55d12e6-d82b-445c-910e-7e04a4480a82",
"serverTemplates": [
{
"templateId": "b55d12e6-d82b-445c-910e-7e04a4480a82",
"sequence": "1"
}
]
}
],
"recipients": {
"signers": [
{
"clientUserId": "1001",
"email": "dev#gmail.com",
"tabs": {
"emailTabs": [
{
"anchorXOffset": "429",
"anchorYOffset": "309",
"value": "dev#gmail.com",
"recipientId": "1"
}
],
"textTabs": [
{
"anchorXOffset": "429",
"anchorYOffset": "309",
"name": "Job Title",
"value": "JobTitleValue",
"recipientId": "1"
}
],
"fullNameTabs": [
{
"anchorXOffset": "37",
"anchorYOffset": "165",
"recipientId": "1",
"value": "Signer One"
}
]
},
"name": "Signer One",
"recipientId": "1",
"routingOrder": "1",
"roleName": "WebUser"
}
]
},
"sender": {
"accountId": "-------"
},
"status": "sent"
}
But when i m calling recipient view API i m getting this "UNKNOWN_ENVELOPE_RECIPIENT" ERROR.
JSON data when calling API.
{
"authenticationMethod": "email",
"clientUserId": "1001",
"email": "dev#gmail.com",
"recipientId": "1",
"returnUrl": "-----",
"userName": "Signer One"
}
Also When i m calling get list on envelope recipient list
"signers": [
{
"creationReason": "sender",
"canSignOffline": "true",
"isBulkRecipient": "false",
"recipientSuppliesTabs": "true",
"requireUploadSignature": "false",
"name": "Rakesh Jangid",
"firstName": "",
"lastName": "",
"email": "rakesh#crystaltechesolutions.com",
"recipientId": "1",
"routingOrder": "1",
"note": "",
"roleName": "Owner",
"status": "delivered",
"completedCount": "0",
"deliveredDateTime": "2021-06-23T09:22:23.3800000Z",
"deliveryMethod": "email",
"recipientType": "signer"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"seals": [],
"witnesses": [],
"notaries": [],
"recipientCount": "1",
"currentRoutingOrder": "1"
}
can any one help me to get Receipent View links from API.
"clientUserId": "1001"
This line has to also be on the recipient/signer, not just when requesting the recipient view.
So add this:
"name": "Signer One",
"recipientId": "1",
"routingOrder": "1",
"roleName": "WebUser",
"clientUserId": "1001"

JSON Docusign Inline mulitpule Documents

I have my Json working for single document and transforms the PDF fields, but when I try to add second document. I Get JSON Parse error.
This works
"document": {
"documentId": "1",
"name": "Test Contract With Fields.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}
this also works but doesn't transforms the PDFFields.
"inlineTemplates": [
{
"documents": [
{
"documentBase64": "<Base64BytesHere>",
"documentId": "1",
"name": "test",
"transformPdfFields": "true"
},
{
"documentBase64": "<Base64BytesHere>",
"documentId": "2",
"name": "test 2",
"order": "2"
}
],
Adding Square [] and second document breaks. Tried making Documents
"document": [{
"documentId": "1",
"name": "Test Contract With Fields.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
},
{
"documentId": "2",
"name": "Test Contract With Fields 2.pdf",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}]
**Update: Complete JSON
Looking to add a second **document****
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [
{
"compositeTemplateId": "1",
"inlineTemplates": [
{
"sequence": "1","documents": [
{
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working", "order": "2"
}
],
"recipients": {
"signers": [
{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true",
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"documentId": "1",
"tabLabel": "text 1",
"recipientId": "1"
}
],
"fullNameTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "20",
"height": "10",
"width": "20",
"tabLabel": "Text 2",
"recipientId": "1"
}
],
"dateSignedTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "30",
"height": "10",
"width": "20",
"tabLabel": "text 3",
"recipientId": "1"
}
]
}
}
]
}
}
],
"document": {
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
} }
]
There are 3 "models" for constructing envelopes. I recommend using composite templates in the intended way, where you manage each document contribution to the envelope by enclosing within separate compositeTemplate elements. I reworked your JSON like this:
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [{
"compositeTemplateId": "1",
"document": {
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
},
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true"
}]
}
}]
},
{
"compositeTemplateId": "2",
"document": {
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working",
"transformPdfFields": "true"
},
"inlineTemplates": [{
"sequence": "1",
"recipients": {
"signers": [{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true"
}]
}
}]
}
]
}
In this fashion, any number of additional documents you wish to add would simply be another compositeTemplate element added to the array. This works for additional documents regardless of whether you wish to transform PDF fields, documents sourced from DocuSign templates, or any additional document for which you want to apply a template to overlay.
Note that the use of compositeTemplateId is only needed to relate multipart form attachments, which is a cleaner way to handle your documents rather than base64 encoding them in documentBase64 elements.
Here is the fixed JSON:
{
"emailBlurb": "Test Blurb",
"emailSubject": "Test subject",
"status": "sent",
"compositeTemplates": [
{
"compositeTemplateId": "1",
"inlineTemplates": [
{
"sequence": "1","documents": [
{
"documentBase64": "'.$documentHashpdf.'",
"documentId": "2",
"name": "Not working", "order": "2"
}
],
"recipients": {
"signers": [
{
"email": "*******",
"name": "********e",
"recipientId": "1",
"smsAuthentication": {
"senderProvidedNumbers": ["******"]
},
"idCheckConfigurationName": "SMS Auth $",
"requireIdLookup": "true",
"clientUserId": "1001",
"defaultRecipient": "true",
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"documentId": "1",
"tabLabel": "text 1",
"recipientId": "1"
}
],
"fullNameTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "20",
"height": "10",
"width": "20",
"tabLabel": "Text 2",
"recipientId": "1"
}
],
"dateSignedTabs": [
{
"pageNumber": "1",
"documentId": "1",
"xPosition": "20",
"yPosition": "30",
"height": "10",
"width": "20",
"tabLabel": "text 3",
"recipientId": "1"
}
]
}
}
]
}
},
{
"documentId": "1",
"name": "Working",
"transformPdfFields": "true",
"documentBase64": "'.$documentHashpdf.'"
}
]}
]
}

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"
}

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